2
votes

i am using configurable products for clothing items, t -shirt, shirts, jumpers etc.

The all come in color options (which are the associated products). Lets say for arguments sake that there are only green. black and blue options available. Obviously with magento you can only use 1 parent image that is used throughout the store to represent that product.

Now, is it possible that when filtering by color using layered navigation, that the associated child product image is used as the thumbnail instead of the parent image.

1

1 Answers

1
votes

Yes you need to load the product, then grab the image and output it.

To load the product by id use this code:

$product = Mage::getModel('catalog/product')->load($id);

To get the image: $attributes = $prod->getTypeInstance(true)->getSetAttributes($prod);

$galleryData = $product->getData('media_gallery');

foreach ($galleryData['images'] as &$image) {
    var_dump($image);
}

This code will allow you to sse which image you want to use

Hope this was helpful

Pesach