2

i would like add a colum in my invoice PDF.

so I changed the "draw ()" function found in the "app / code / core / Mage / Sales / Model / Order / Pdf / Items / Invoice" file by adding "item-> getEan ()

but i dont'woks.What method should I use to get the "EAN"?

thank you

5

I'm going to assume EAN is an attribute you added to your product. The $item you're referring to is actually an invoice item and not a product so it doesn't have all the attributes available that a product would, it only has the things it needs for the invoice structure.

You can try doing the following:

$item->getProduct()->getEan()

I however suspect that wont work and you'll want to use:

Mage::getResourceModel('catalog/product')
     ->getAttributeRawValue( $item->getProductId() , 'ean', $order->getStoreId());

Using that you should be able to add the EAN to the draw() method in the invoice class. Be aware that you will need to adjust the table header as well and add the EAN in there somewhere.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.