0
votes

I am trying to change the way Magento handels the images of the products. At the moment on a configurable product it shows the images that you have uploaded to the confirgurable product.

I want it so that if the product is configurable then it will only show the images of the associated products and not images that were upload to the config product.

In my media file I've got

<?php foreach ($this->getGalleryImages() as $_image): ?>

    <li><a href="<?php echo $this->htmlEscape($_image->getLabel()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(70, 70); ?>" width="70"/></a></li>

<?php endforeach; ?>

Which I can see is pulling the images from the gallery of the configurable product, so somehow need to change this to check if it is a configurable product then if it is only pull in the images from the associated products.

I think to check if it is configurable it would be something like this?

<?php if ($_product->isSaleable() && (!$_product->isConfigurable() ?>

Then the new code to pull the associated products images in which is what I need a little help with.

1
Hey Matt, were you able to get this working as I am also trying to achieve the same. I have Simple configurable products extension installed and now want to remove the drop down menu from configurable page and just list thumbnails of associated products and dynamically change the image as per selection of thumbnail.itsandy

1 Answers

0
votes

You can get an array of used products from the configurable by calling getAllowProducts() on the configurable product.

foreach ($_product->getAllowProducts() as $_associatedProduct) {
    echo $this->helper('catalog/image')->init($_associatedProduct, 'image')
        ->resize(340,260);
}