cancel
Showing results for 
Search instead for 
Did you mean: 

Add attribute to invoice pdf

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Add attribute to invoice pdf

Hi,

 

I want to add some attributes to the invoice pdf in app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php

I will like to have the attributes right after the name, and I found this code that showing the name:

 

 

// draw Product name
        $lines[0] = array(array(
            'text' => Mage::helper('core/string')->str_split($item->getName(), 35, true, true),
            'feed' => 35,

        )
		);

How do I add the attribute, so I comes after the name, on the same line?

 

I found this code to show the attribute, but with this code the attribute comes under the product name, and I want it to be on the same line:

 

$product = Mage::getModel('catalog/product')->setStoreId($item->getStoreId())->loadByAttribute('sku', $this->getSku($item));
		$attribute = $product->getResource()->getAttribute('storrelse');
		if ($attribute)
		{
			$_storrelse = $attribute ->getFrontend()->getValue($product);
		}
			$lines[][] = array(
				'text'  => ''.$_storrelse,
				'feed'  => 35
		);

can anybody help me to optimize my code?

 

1 REPLY 1

Re: Add attribute to invoice pdf