i have read a lot about this part. Lots of people want to have some custom attributes in the PDF invoices and on the adminHtml part.

I am not able to get it work on the PDF. it works on the Cart, Checkout, adminHtml but not on the pdf.

I modify (rewrite): app/code/local/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php different ways.

The attribute i try to call is "vpe" and is located after // custom options All I get is an empty value. By the way: the attribute must be called from the correct shop. In shop A i do not use this VPE. The invoice is from shop B and VPE is used on all products (its visible on the AdminHtml page) These ways did not work:


  $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $this->getSku($item), array('vpe'));
     if ($product) {
          $lines[][] = array(
               'text'  => 'vpe:'.$product->getData('vpe'),
               'feed'  => 34


$_item = $this->getItem();

$storeId =  $_item->getStoreId();
$productId = $_item->getProductId();
$product = Mage::getModel('catalog/product')->load($productId);

$_vpe = $product->getData('vpe');

$attributes = $product->getAttributes();
$dispAttribs = array('vpe');
foreach ($attributes as $attribute) {...
        $attributeCode = $attribute->getAttributeCode();
        if(!in_array($attributeCode, $dispAttribs)) continue;
        $label = $attribute->getFrontend()->getLabel($product);
        $value = $attribute->getFrontend()->getValue($product);

            $_vpe = $value;

$lines[][] = array(
    'text' => Mage::helper('core')->__('vpe: ') . $_vpe,
    'feed' => 34

Using Magento


I found another way to try:

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

After inserting this i get some VPE but from the wrong shop. any ideas?

  • This question is NOT duplicate, because i need to know how i can get the information from different shops.
    – DvdEnde
    Oct 16, 2014 at 8:50

1 Answer 1


hi try this add store code product obejct

 $product = Mage::getModel('catalog/product')->setStoreId($item->getStoreId())->loadByAttribute('sku', $this->getSku($item));

then you can get Product:


try this

  • thx Amit, but the value is still empty. I put in this: $product = Mage::getModel('catalog/product')->setStoreId($item->getStoreId())->loadByAttribute('sku', $this->getSku($item)); if ($product) { $lines[][] = array( 'text' => 'vpe:'.$product->getData('vpe'), 'feed' => 34 ); } BUT its writing the text vpe only. not the value i also expect
    – DvdEnde
    Oct 7, 2014 at 10:00

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