I am looking to add or remove content from a Magento site based on which filters are being applied. Specifically, detecting when filters of the same type are being applied.
For instance, if items from a sports store can be sorted by league, I am looking to detect if NBA and NFL are selected filters. I can successfully detect if one league is being filtered for using something like this:
$_filters = Mage::getSingleton('catalog/layer')->getState()->getFilters();
if (is_array($_filters)) {
foreach ($_filters as $_filter) {
$filterName = $_filter->getName();
$filterLabel = $_filter->getLabel();
}
}
I was unable to loop through and detect multiple filters from the same category (in this case, League), because it seems to only add one filter per type. Is there another method for detecting applied filters that would help with this situation?
Thanks for any help, it is much appreciated.
Plugin Mana Filters will allow you to do what you want ,
You can use Mana Filters Modules that will allow you to have multiple filters from same type, then you can loop etc .. !
http://www.manadev.com/advanced-layered-navigation-ce
Thanks