Magento how to display configurable product All associated product image in view page

open this file  app/design/frontend/default/default/template/catalog/product/view.php

and Add this code

if($_product->getTypeId() == "configurable"):
    echo "<b>Associated Product Image :</b><hr><br>";
     * Load product by product id
    $product = Mage::getModel('catalog/product')->load($this->getProduct()->getId());

     * Get child products id (only ids)
    $childIds = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($product->getId());

     * Get children products (all associated children products data)
    $childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$product);
    foreach($childProducts as $childProduct)
        <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."catalog/product".$childProduct->getThumbnail() ?>" alt="<?php echo $childProduct->getName() ?>" title="<?php echo $childProduct->getName() ?>" width="50px" height="50px" />

Delete Cache and refresh browser  :)

1 comment:

  1. Great blog. All posts have something to learn. Your work is very good and i appreciate you and hoping for some more informative posts.keep writing
    magento development company in bangalore