2

Is there any method by which we can move the category filters after the attribute filters in layered navigation using layout config files

Searching i reached this question in stackoverflow

But i want to know whether it is possible with layout xml files OR Alter the order of occurrence in layer\view.phtml ( is this not at all a good idea?)

1 Answer 1

1

I would suggest that the best way to achieve this would be to rewrite Mage_Catalog_Block_Layer_View in a custom module and then change the function getFilters so that it looks something like the following:

public function getFilters()
{
    $filters = array();
    $filterableAttributes = $this->_getFilterableAttributes();
    foreach ($filterableAttributes as $attribute) {
        $filters[] = $this->getChild($attribute->getAttributeCode() . '_filter');
    }

    if ($categoryFilter = $this->_getCategoryFilter()) {
        $filters[] = $categoryFilter;
    }

    return $filters;
}
2
  • did same thing only, but just to alter the order of appearance we need to write code in custom module. If would have been much easier if possible with layout xml files.
    – zamil
    Jan 18, 2014 at 11:28
  • 2
    I dont think you can as it treats all filters as the same even if they are categories or product attributes. one other option would be to do an array sort in the template but I would suggest the rewrite would be better. Jan 18, 2014 at 11:49

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.