Magento get Filter Options shop by Attribute

Magento get Filter Options shop by Attribute

$layer = Mage::getModel("catalog/layer");

    $category = Mage::getModel("catalog/category")->load(3);
    $layer->setCurrentCategory($category);
    $attributes = $layer->getFilterableAttributes();

    foreach ($attributes as $attribute)
    {
      
        $filterBlockName = 'catalog/layer_filter_attribute';
      
    
$result = Mage::app()->getLayout()->createBlock($filterBlockName)->setLayer($layer)->setAttributeModel($attribute)->init();
        foreach($result->getItems() as $option) {
            echo $option->getLabel().'<br/>';
            echo $option->getValue();
        }
    }
   

Share this

Related Posts

Previous
Next Post »

1 comments:

comments
Anonymous
22 October 2018 at 02:58 delete

Thank you for sharing this information

Magento development company

Reply
avatar

Pageviews from the past week