cancel
Showing results for 
Search instead for 
Did you mean: 

Remove categories from layered navigation and place attribute filter above

Remove categories from layered navigation and place attribute filter above

Hi guys,

 

I would like to do two things !

 

  • remove category filter (because i now have two "identical" categories in layered navigation) how is the no-filter one called ?
  • place attribute filter above categorie

See here my print screen: http://prntscr.com/9e0f87 Thx !!

 

Hopefully someone can help me !

 

thx

1 REPLY 1

Re: Remove categories from layered navigation and place attribute filter above

Hello,

 

I have a suggestion for you:

For Magento Default, you look at this file: app/code/core/Mage/Catalog/Block/Layer/View.php, you will can see:

/**
     * Get all layer filters
     *
     * @return array
     */
    public function getFilters()
    {
        $filters = array();
        if ($categoryFilter = $this->_getCategoryFilter()) {
            $filters[] = $categoryFilter;
        }

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

        return $filters;
    }

This method has an array to store filterable values. It stores the category filters at the first and filterable attributes at the second. So, If you want to move category filter, you change the order of them:

/**
     * Get all layer filters
     *
     * @return array
     */
    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;
    }

 For best practise, you should override this block.

 

You try to enable Template Path Hint to find layer navigation template. And then find and remove the second unnecessary category filter template.

Problem solved? Click Accept as Solution!