Although not the best method, we wrote a quick and easy means to remove layered navigation filters that are dependant on other filters being enabled. This code should really be in the block and popped into an extension – with the attributes administrable via the backend, but for the purposes of this tutorial – we are just going to hardcode it into the template and let you decide how you want to improve it. 1 Open ./app/design/frontend/default/default/template/catalogue/layer/view.phtml 2 Add <?php /*Create filter dependencies*/ $_activeFilters[] = array(); $_filters = Mage::getSingleton(‘Mage_Catalog_Block_Layer_State’)->getActiveFilters(); $_depends = array( "fits product" => array("product manufacturer") ); foreach ($_filters as $_filter): $_activeFilters[] = strtolower($_filter->getName()); endforeach; ?> just before 3 Replace the contents of <dl id="narrow-by-list"> … </dl> with <?php $_filters = $this->getFilters() ?> <?php foreach ($_filters as $_filter): ?> <?php if($_filter->getItemsCount()): ?> <?php /*Hide filters whose dependencies are not enabled*/ $_showFilter = true; if(isset($_depends[strtolower($_filter->getName())])): $_filterDepends = … Continue reading
Dependant layered navigation filters in Magento
5