3

i need to display value of certain applied filter in layered navigation.

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

        foreach ($appliedFilters as $item) {
            $item->getName(); 
            $item->getLabel(); 
            $item->getFilter()->getRequestVar() == 'my_attribute'; // My attribute code
                echo $item->getLabel();

                }
        ?>

This code returns all the values ​​of all the selected attributes.

I need to display only value from 'my_attribute'.

1 Answer 1

1

You are missing an if statement:

if ($item->getFilter()->getRequestVar() == 'my_attribute') {
    echo $item->getLabel();
}

All you have is

$item->getFilter()->getRequestVar() == 'my_attribute';
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.