Skip to content

Instantly share code, notes, and snippets.

@ravixp
Last active July 13, 2017 14:32
Show Gist options
  • Select an option

  • Save ravixp/38262ed3963f34bd11bf348387c49398 to your computer and use it in GitHub Desktop.

Select an option

Save ravixp/38262ed3963f34bd11bf348387c49398 to your computer and use it in GitHub Desktop.
Magento 1: Add the product image on the email order (template/email/order/items/order/default.phtml)
<?php $_item = $this->getItem() ?>
<?php $_order = $this->getItem()->getOrder() ?>
<?php if ($_item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
$parentId = Mage::getModel('catalog/product_type_configurable')
->getParentIdsByChild($_item->getProductId());
$_product = Mage::getModel('catalog/product')
->setStoreId($_item->getOrder()->getStoreId())
->load($parentId);
} else {
$_product = Mage::getModel('catalog/product')
->setStoreId($_item->getOrder()->getStoreId())
->load($_item->getProductId());
} ?>
...
...
<td class="cell-content product-image" style="padding: 3px 9px; vertical-align: top;">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(125,125); ?>" width="125" height="125" alt="<?php echo $_item->getName() ?>" style="border: 1px solid #ddd;" />
</td>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment