Magento - Show thumbnails in sales/order screen

Magento - Show thumbnails in sales/order screen

September 16, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - Show thumbnails in sales/order screen

Displaying Product Thumbnails in Magento Order Screen

As a senior developer working with Magento, I often encounter requests like this from clients who need to customize their order management screens. In this case, we’ll show you how to display product thumbnails for both simple and configurable products on the sales/order screen in Magento 1.6.2.

Understanding the Current Setup

You’ve already made a good start by adding code to app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml. This allows you to display an image for simple products using Mage::helper(‘catalog/image’). However, as you noted, this approach fails when dealing with configurable products because the associated simple product doesn’t have an image.

Retrieving the Correct Image

To resolve this issue, we need to adjust our approach so that it retrieves the image from the parent configurable product instead of the child simple product. Here’s how:

  1. Load the Parent Configurable Product: First, load the parent configurable product using Mage::getModel(‘catalog/product’)->load($_item->getProductId()). This ensures we have access to the correct item.

  2. Get the Associated Simple Products: Next, retrieve all associated simple products using $simpleProducts = $parentProduct->getTypeInstance()->getUsedProducts(null, $parentProduct). This gives us an array of all child simple products linked to the configurable product.

  3. Find the Matching Simple Product: Loop through the simple products and find the one that matches your item’s ID. You can do this with a foreach loop: foreach($simpleProducts as $_simpleProduct) if($_simpleProduct->getId() == $_item->getProductId()) { $product = $_simpleProduct; break; }

  4. Initialize and Resize the Image: Once you have the correct simple product, initialize the image using Mage::helper(‘catalog/image’)->init($product, ‘small_image’) and resize it as needed: $imageUrl = Mage::helper(‘catalog/image’)->init($product, ‘small_image’)->resize(135);

Implementing the Solution

Here’s how your modified default.phtml code should look:

<?php $parentProduct = Mage::getModel('catalog/product')
    ->setStoreId($_item->getOrder()->getStoreId())
    ->load($_item->getProductId());
$simpleProducts = $parentProduct->getTypeInstance()->getUsedProducts(null, $parentProduct);
foreach($simpleProducts as $_simpleProduct) {
    if($_simpleProduct->getId() == $_item->getProductId()) {
        $product = $_simpleProduct;
        break;
    }
}
?>
<p align="center"><img src="<?php echo Mage::helper('catalog/image')->init($product, 'small_image')->resize(135); ?>" width="135" height="135" alt="" /></p>

Testing the Solution

After implementing this code, the order view screen should now display thumbnails for both simple and configurable products. The image shown will always be the one associated with the parent configurable product.

Conclusion

Displaying product images in the Magento sales/order screen requires a careful understanding of how to handle both simple and configurable products. By modifying your template file as described above, you can ensure that the correct image is displayed for all products, improving the visual appeal and practicality of your order management interface.

Remember, customizing core files like default.phtml may lead to issues during upgrades. Consider creating a custom module or using a theme’s local.xml file to apply this modification instead. For more advanced customizations, consider hiring a professional Magento development service from reputable companies like Laravel Company.

Happy coding! Let me know if you have any other questions about Magento development or e-commerce solutions in general.

Magento 1 Catalog Themes Admin

Our network