Skip to content

Instantly share code, notes, and snippets.

@trev
Created April 13, 2012 06:11
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save trev/2374287 to your computer and use it in GitHub Desktop.
Magento Color Attribute Swatches Implementation
<ol>
<?php foreach ($this->getItems() as $_item): ?>
<li>
<?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() ?>)
</li>
<?php endforeach ?>
</ol>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment