Jay
Jay

Reputation: 841

How to change category filter position in magento layer navigation

I am using magento 1.7,

I have four filter in layer on left sidebar of category page.

They are listed as

categorie brands size color.

I want to change category and brands position I want brands to position first like as follows.

brands categories size color.

How can I do that

Upvotes: 2

Views: 9846

Answers (1)

Rajiv Ranjan
Rajiv Ranjan

Reputation: 1869

Open Attributes which is using in layered navigation and there is field/textbox to add position values Under Front End properties.

Put position as per your requirement.

Then reindex also.

If want to set Category filter position, then follow these steps:

Copy file: app\code\core\Mage\Catalog\Block\Layer\View.php Paste file: app\code\local\Mage\Catalog\Block\Layer\View.php

Then Update code of app\code\local\Mage\Catalog\Block\Layer\View.php file.

Replace getFilters() function code with below code:

public function getFilters()
{
    $filters = array();
    $catFilters = array(); // Created New array
    if ($categoryFilter = $this->_getCategoryFilter()) {
        $catFilters[] = $categoryFilter; // Assign category to new array
    }

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

    /* Pushed category filter array to position 1, if want to change position then update value in this function. */
    array_splice( $filters, 1, 0, $catFilters ); 
    return $filters;
}

Hope it will help!

Upvotes: 5

Related Questions