Magento: Layered Navigation on Advanced Search Results

10,126

Hey I have succeeded in bringing the layered navigation in advanced search page. Perform following steps: Step 1: In catalogsearch.xml update like below
`

    <label>Advanced Search Result</label>
    <update handle="page_two_columns_right" />
    <!-- Mage_Catalogsearch -->
    <reference name="root">
        <action method="setTemplate"><template>page/3columns.phtml</template></action>
    </reference>
    <reference name="left">
        <block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
    </reference>`

Step 2: Clear your cache and you are good to go.

Now for getting filter worked you have do some modification in the in request url e.g. in advanced search price filter goes like this price[from]=1&price[to]=100 instead of price=1,100

Share:
10,126
Adam Moss
Author by

Adam Moss

I am a 3x Magento Certified Developer working at Space48 in the UK. I am the owner of the Magento Fox Blog where I write articles and tutorials.

Updated on June 04, 2022

Comments

  • Adam Moss
    Adam Moss almost 2 years

    I need to show the layered navigation filters on the Magento advanced search results page, just like it does on the catalogsearch results page.

    I have already moved the XML block as needed into catalogsearch_advanced_result:

    <reference name="left">
    <block type="catalogsearch/layer" name="catalogsearch.leftnav" template="catalog/layer/view.phtml"/>
    </reference>
    

    The block is called, but nothing shows up. I have traced through the core files and found that in Catalog/Block/Layer/View.php this function doesn't return any attributes (line 161):

    protected function _getFilterableAttributes()
    {
        $attributes = $this->getData('_filterable_attributes');
        if (is_null($attributes)) {
            $attributes = $this->getLayer()->getFilterableAttributes();
            $this->setData('_filterable_attributes', $attributes);
        }
    
        return $attributes;
    }
    

    I traced getFilterableAttributes() into the Catalog/Model/Layer.php file, but from this point it becomes difficult to work out where the difference between catalogsearch and advanced search is.

    I basically just want to get this working in any way possible. Any help or guidance would be much appreciated!

    EDIT:

    My product attributes are set up correctly as below:

    enter image description here