I am displaying a image of ordered products in “My Order” in user dashboard.
<?php
$orderId = $_order->getId();
$order = Mage::getModel('sales/order')->load($orderId);
$items = $order->getAllItems();
foreach ($items as $itemId => $_item)
{
if($_item->getProductType() == 'configurable')
{
$product = $_item->getProduct();
}else{
$product = Mage::getModel('catalog/product')->setStoreId($_item->getOrder()->getStoreId())->load($_item->getProductId());
}
?>
<img src="<?php echo Mage::helper('catalog/image')->init($product, 'small_image')->resize(75); ?>" width="75" height="75" />
<?php }?>
All works fine. but it display all images of configurable products. i want to display the selected configurable simple product image.
Any help will highly appreciated
2
Answers
i used
getAllVisibleItems
instead ofgetAllItems
and Now it is working.Use the below code:
Hope this helps!