Inside the account, I want to edit the order history page (/sales/order/history/). Currenty the items of the order are not loaded on this page.

How can I load the items of the specific order, to get the productimages. I want to show the purchased productimages inside the order history table.

So I want to load the items inside the <?php foreach ($_orders as $_order): ?>.

How can I achieve that?

I am running Magento

1 Answer 1


for shows items in order history you can add following code inside

<?php foreach ($_orders as $_order): ?>

and Code is

<?php $orderId = $_order->getId(); 
            $order = Mage::getModel('sales/order')->load($orderId);
            $items = $order->getAllItems();
            foreach ($items as $itemId => $_item)
                echo "Product Id = ".$_item->getProductId()."<br>";
                echo "Product Name = ".$_item->getName()."<br>";
                echo "Product Price = ".$_item->getPrice()."<br>";   
                echo "Product SKU = ".$_item->getSku()."<br>";
                echo "Ordered Qty = ".$_item->getQtyToInvoice()."<br>";
                $_product = Mage::getModel('catalog/product')->load($_item->getProductId());
                $_proImage = Mage::getModel('catalog/product_media_config')->getMediaUrl( $_product->getThumbnail() );
                echo "<img src=".$_proImage." />";

Hope it will help you.

  • Great. But is displays all the images of Configurable products. can you please look to this. thanks
    – Amir Iqbal
    May 15, 2018 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.