Add Product Images In Magento Transactional Emails

In order to add the order Image to the transaction email templates (order), you need to play with the following two files:
1.) Edit the file: app/design/frontend/base/default/template/email/order/items.phtml Locate this line (Around Line 32) :
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"> <?php echo $this->__('Sku') ?></th>

And Add this right under it:
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Image') ?></th>
Go ahead and save and overwrite the file. 2.) Edit the file: app/design/frontend/base/default/template/email/order/items/order/default.phtml Locate this line (Around Line 48):
<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>
And add this right under it:
	<?php $_product = Mage::getModel('catalog/product')
                ->setStoreId($_item->getOrder()->getStoreId())
                ->load($_item->getProductId()); ?>
< img src="<?php echo Mage::getModel('catalog/product_media_config')
                 ->getMediaUrl($_product->getThumbnail()); ?>"  width="135" height="135" alt="<?php echo $_item->getName() ?>" />
				 

No comments:

Post a Comment