Create a attribute
and then
edit app/code/core/Mage/Catalog/Block/Navigation.php
public function getAllManu()
{
$product = Mage::getModel(‘catalog/product’);
$attributes = Mage::getResourceModel(‘eav/entity_attribute_collection’)
->setEntityTypeFilter($product->getResource()->getTypeId())
->addFieldToFilter(‘attribute_code’, ‘manufacturer’); //can be changed to any attribute
$attribute = $attributes->getFirstItem()->setEntity($product->getResource());
$manufacturers = $attribute->getSource()->getAllOptions(false);
return $manufacturers;
}
and then
edit app/design/frontend/default/default/template/catalog/navigation/top.phtml
and then
edit app/code/core/Mage/Catalog/Block/Navigation.php
public function getAllManu()
{
$product = Mage::getModel(‘catalog/product’);
$attributes = Mage::getResourceModel(‘eav/entity_attribute_collection’)
->setEntityTypeFilter($product->getResource()->getTypeId())
->addFieldToFilter(‘attribute_code’, ‘manufacturer’); //can be changed to any attribute
$attribute = $attributes->getFirstItem()->setEntity($product->getResource());
$manufacturers = $attribute->getSource()->getAllOptions(false);
return $manufacturers;
}
and then
edit app/design/frontend/default/default/template/catalog/navigation/top.phtml
- <select id=“select-manufacturer” onchange=“window.location.href=this.value”>
- <option value=“#” selected=“selected”>–Select Manufacturer–</option>
- <?php foreach ($this->getAllManu() as $manufacturer): ?>
- <option value=“/catalogsearch/advanced/result/?manufacturer[]=<?php echo $manufacturer['value'] ?>”><?php echo $manufacturer['label'] ?></option>
- <?php endforeach; ?>
- </select>
No comments:
Post a Comment