using below code i can able to get all filterable attributes for a category,

    $json = array();

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

    $category = Mage::getModel("catalog/category")->load(3); // Jeaan 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) {
        $json[$attribute->getAttributeCode()][] = array(
            'attribute_name' => $option->getLabel(),
            'attribute_value' => $option->getValue()
   return $json;

Now i'm trying to set an filter and get it's related attribute's i.e,. need to fetch it's second level of visible attributes after filter.

did anyone have any hint to solve this ?

  • Can you specify what you mean by 'second level visible attributes' in your question? The ones that are visible when you click an option? Jan 13, 2015 at 7:14
  • @Sander Yes ones that are visible when you click an option. Jan 13, 2015 at 7:20
  • Did you check the block class for layared navigation to see how magento does it? Jan 13, 2015 at 7:31