I want to change the default SKU field inside the transactional email item field, to a custom attribute.

Therefore I need to edit the following file:


I want to change the following value:

<?php echo $this->escapeHtml($this->getSku($_item)) ?>

My custom attribute value is "dpn" and it is named "DPN".

How can I change this?

I tried the following but that does not work:

<?php echo $this->escapeHtml($this->getDpn($_item)) ?>

You need to understand that calling $this->getSku() or $this->getDpn() is referring to a method that you can/could find in the related Block, in your case:


in which you'll find the relevant getSku() method. You could in turn extend this class and add your getDpn() method, but I believe what you are trying to do it get a product's attribute.

If it's the case, you only have to do

<?php echo $this->escapeHtml($_item->getProduct()->getDpn()) ?>

But be aware that it might be costly because Magento will internally call app\code\core\Mage\Sales\Model\Order\Item.php:getProduct() which instantiates the given product.

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.