Magento Get Selected Filter In Layered Navigation

All the applied filters are stored in layer state object. You can easily retrieve them by using the following snippet:

$appliedFilters = Mage::getSingleton('catalog/layer')->getState()->getFilters();

It will return you an array of filter item objects. You can retrieve name and applied value of a single filter item by doing something like this:

foreach ($appliedFilters as $item) {
    $item->getName(); // Name of the filter
    $item->getLabel(); // Currently selected value
    $item->getFilter()->getRequestVar(); // Filter code (usually attribute code, except category filter, where it equals "cat")
}

Tags:

Php

Magento