Magento 1.9.3.1 – Add images/icons to attribute options to replace placeholder image of your Magento products page

magento 1.9.3.1


view.phtml around line 100 replace the if statement

<?php if($_item->getColor()): ?>

<?php
$optionId = $_item->getColor();
$optionIdurl = Mage::helper('attributeoptionimage')->getAttributeOptionImage($optionId)
?>

<a href="#" class="color_swatch">

<?php if (strpos( $this->helper('catalog/image')->init($_item, 'small_image')->resize(100, 150), 'placeholder')) {
?>
<img src="<?php echo $optionIdurl; ?>" />
<?php
} else {
?>
<img src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(100, 150); ?>" />
<?php } ?>

<?php endif; ?>

 

reference:
http://www.bubblecode.net/en/2012/02/05/magento-add-images-to-product-attribute-options/

https://github.com/aligent/magento-attribute-option-image

Leave a Reply