I have added an custom attribute to products. i want to show this attribute in order transaction email.
Is there a way to do this?
Thanks.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityAn SO answer provides some great insight on this:
As the answer reveals, email items renderer will be working with order items, not the actual products. So if you've added this attribute to the product, then you can either:
Obviously the former is simpler, but will create some overhead processing that could impact performance. Once you choose your path there, you can proceed to the item renderer templates:
app/design/frontend/base/default/template/
:
bundle/sales/order/items/renderer.phtml
sales/order/items/renderer/default.phtml
downloadable/sales/order/items/renderer/downloadable.phtml
There may be more, depending on what you have done to customize your installation. Also, the above only apply to front-end order item rendering. In any case, extend one or more of these templates to stuff in your attribute, eg:
# File: app/design/frontend/[package]/[theme]/template/sales/order/items/renderer/default.phtml
...
<?php $_item = $this->getItem() ?>
<tr class="border" id="order-item-row-<?php echo $_item->getId() ?>">
<td><h3 class="product-name"><?php echo $this->htmlEscape($_item->getName()) ?></h3>
<p><?php echo $this->__('Your Custom Attribute: %s', $_item->getYourCustomAttribute()); ?></p>
<?php if($_options = $this->getItemOptions()): ?>
<dl class="item-options">
...
Remembering that if your attribute is not available on the item model, you will have to load it from the product instead.
package/theme
Also, are we talking about frontend orders? Please update your question to show your work so far.
Dec 28, 2014 at 20:20