Skip to content

Instantly share code, notes, and snippets.

@Modicrumb
Created June 13, 2013 17:10
Show Gist options
  • Save Modicrumb/5775471 to your computer and use it in GitHub Desktop.
Save Modicrumb/5775471 to your computer and use it in GitHub Desktop.
Manufacturers dynamically Created
<ul id="manufacturers">
<?php
$attribute = Mage::getSingleton('eav/config')->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'manufacturer');
foreach ($attribute->getSource()->getAllOptions() as $option)
{
if ($option['label'])
{
//$cleanlink = str_replace(array(" ","'","_","."),array("-","","-",""),strtolower($option['label']));
$urlKey = str_replace("'", '', $option['label']);
$urlKey = preg_replace('#[^0-9a-z\/]+#i', '-', Mage::helper('catalog/product_url')->format($urlKey));
$urlKey = strtolower($urlKey);
$urlKey = trim($urlKey, '-');
$cleanimg = str_replace(array("'","/"),"",$option['label']);
echo "\n\t <li> <a href='/manufacturer/{$urlKey}'>{$option['label']} <img class='man-grid' src='/media/catalog/manufacturers/{$cleanimg}.jpg' /> </a></li>";
}
}
?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment