Skip to content

Instantly share code, notes, and snippets.

@mrkodssldrf
Created June 24, 2014 09:28
Show Gist options
  • Save mrkodssldrf/ba1f8d72ddae0177f5fc to your computer and use it in GitHub Desktop.
Save mrkodssldrf/ba1f8d72ddae0177f5fc to your computer and use it in GitHub Desktop.
Add Product Attributes to Magento Order Email
// File <yourtemplate>/email/order/items/order/default.phtml //
.......
<?php /** Get product attributes */ ?>
<?php $_product = Mage::getModel('catalog/product')->load($_item->getProduct()->getId()) ?>
<?php $_attributes = $_product->getAttributes() ?>
<?php $_arrDisplayAttributes = array('of_attributes_display') ?>
<?php foreach($_attributes as $_attribute) : ?>
<?php $_attributeCode = $_attribute->getAttributeCode() ?>
<?php if(in_array($_attributeCode, $_arrDisplayAttributes)) : ?>
<?php if($_attribute->getFrontend()->getValue($_product) != '') : ?>
<dt><strong><em><?php echo $_attribute->getFrontend()->getLabel($_product) ?></em></strong></dt>
<dd style="margin:0; padding:0 0 0 9px;"><?php echo nl2br($_attribute->getFrontend()->getValue($_product)) ?></dd>
<?php endif ?>
<?php endif ?>
<?php endforeach ?>
<?php /** // Get product attributes */ ?>
......
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment