Add product image in new order email

  1. First Step

Edit the file: app/design/frontend/YOUR_PACKAGE/YOUR_THEME/template/email/order/items.phtml

After this line:

<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"> <?php echo $this->__('Sku') ?></th>

Add this:

<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Image') ?></th>
  1. Second Step

Edit the file: app/design/frontend/YOUR_PACKAGE/YOUR_THEME/template/email/order/items/order/default.phtml

Note: If this file doesn't exist in your package then you can find this file from base package (app/design/frontend/base/default/template/email/order/items/order/default.phtml)

After this line:

<td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $this->escapeHtml($this->getSku($_item)) ?></td>

Add this:

<img src="<?php echo Mage::getModel('catalog/product_media_config')  
                ->getMediaUrl($_product->getThumbnail()); ?>"  width="135" height="135" alt="<?php echo $_item->getName() ?>" />  

EDIT


For configurable product parent image display :

Edit the file app/design/frontend/YOUR_PACKAGE/YOUR_THEME/template/email/order/items/order/default.phtml

After this line:

<?php $_order = $this->getItem()->getOrder() ?>

Add this:

<?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());  
}

?>

Then, if not already done, after this line:

<td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $this->escapeHtml($this->getSku($_item)) ?></td>

Add this line:

<img src="<?php echo Mage::getModel('catalog/product_media_config')  
                ->getMediaUrl($_product->getThumbnail()); ?>"  width="135" height="135" alt="<?php echo $_item->getName() ?>" />  

Tags:

Order Email