0

How can I get image of configurable product. I found this code but it returns null

$_swatchUrl = Mage::helper('configurableswatches/productimg');
1

The methods available in the helper you mentioned allows you to retrieve the image urls for the configurable swatches. For example the url of pink/white/blue swatch url for a super attribute such as color (ex: media/catalog/swatches/1/21x21/media/pink.png). You can check in .../configurable/swatches.phtml how is being used by the core:

$_swatchUrl = Mage::helper('configurableswatches/productimg') ->getSwatchUrl($_product, $_option->label, $_swatchInnerWidth, $_swatchInnerHeight, $_swatchType);

But you want to take the image of a parent/configurable product so just follow the code from .../catalog/product/view/media.phtml

src="<?php echo $this->helper('catalog/image')->init($_product, 'image') ?>"
which is retrieving the image of the product in the product view/page.

Note: above sample of codes were taken from Magento ver. 1.9.2.4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.