Add product image to totals area

This article is on adding item photos to summary section.

If you need to display product image thumbnail in your total block html then you can do so:

  • edit the file app/design/frontend/base/default/template/onestepcheckout/summary.phtml or the file in your theme folder
  • add following

<img src="<?php echo $this->helper('catalog/image')->init($item->getProduct(), 'small_image')->resize(163, 100);?>" />

to the place where you need your image to be displayed

for configurable products you can use

  • <img src="<?php echo $this->helper('catalog/image')->init($item->getOptionByCode('simpleproduct')->getProduct(), 'smallimage')->resize(163, 100);?>" />

or :

<?php

if($item->getProductTypeId="configurable"){

$ChildProduct=Mage::getModel('catalog/product')->loadByAttribute('sku',$item->getSku());

$found=Mage::helper('catalog/image')->init($ChildProduct, 'thumbnail');

}

?>

<img src='<?php echo Mage::helper('catalog/image')->init($ChildProduct, 'thumbnail')->resize(163, 100);?>'/>