/** * Add layerd navigation filters on current layer block * * @param Mage_Catalog_Block_Layer_View $block * * @return $this */ protected function _addLayeredNavigation($block) { $stateBlock = $block->getLayout()->createBlock('catalog/layer_state')->setLayer($block->getLayer()); $block->setChild('layer_state', $stateBlock); $filterableAttributes = Mage::getResourceModel('factfinder_asn/product_attribute_collection'); foreach ($filterableAttributes as $index => $attribute) { $filter = $block->getLayout()->createBlock('factfinder_asn/catalog_layer_factfinder')->setAttributeModel($attribute)->setLayer($block->getLayer())->init(); $block->setChild($attribute->getAttributeCode() . '_filter', $filter); // remove category filter - it's enough to add it as a child if ($attribute->getAttributeCode() == 'category') { $filterableAttributes->removeItemByKey($index); } } $block->setData('_filterable_attributes', $filterableAttributes); return $this; }