Monday, 16 March 2015

Add product image in customer order details page in frontend in magento

Add product image in customer order details page in frontend

Path : app/design/frontend/default/template/sales/order/view/items/renderer/default.phtml

<td>
<?php $_product = Mage::getModel('catalog/product')->load($_item->getId()); ?>
<img src="<?php echo Mage::helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="" />
</td>
For the second case use the following code for simple and configure product:
<td>
<?php

if($_item->getProductType() == 'configurable') {
$_product = $_item->getProduct();
}else{
$_product = Mage::getModel('catalog/product')->load($_item->getId());
}

?>
<img src="<?php echo Mage::helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="" />
</td>


Add product image in customer order details page in backend

Path : app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml

<td>
<?php $_product = Mage::getModel('catalog/product')->load($_item->getId()); ?>
<img src="<?php echo Mage::helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="" />
</td>
For the second case use the following code for simple and configure product:
<td>
<?php

if($_item->getProductType() == 'configurable') {
$_product = $_item->getProduct();
}else{
$_product = Mage::getModel('catalog/product')->load($_item->getId());
}

?>
<img src="<?php echo Mage::helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="" />
</td>


No comments:

Post a Comment