Skip to content

Instantly share code, notes, and snippets.



Created Apr 13, 2012
What would you like to do?
Magento Color Attribute Swatches Implementation
<?php foreach ($this->getItems() as $_item): ?>
<?php if ($_item->getCount() > 0): ?>
// Add attribute option image before label
<?php if($_item->getName() == "Color") : ?>
<img src="<?php echo Mage::helper('attributeoptionimage')->getAttributeOptionImage($_item->getValue()); ?>" alt="" />
<?php endif; ?>
<a href="<?php echo $this->urlEscape($_item->getUrl()) ?>"><?php echo $_item->getLabel() ?></a>
<?php else: echo $_item->getLabel() ?>
<?php endif; ?>
(<?php echo $_item->getCount() ?>)
<?php endforeach ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment