Oh snap! You are using an old version of browser. Update your browser to get new awesome features. Click for more details.

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

Step:1
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" />
    <?php
    }
    endif;
    ?>

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 

    ReplyDelete