Magento: Layered Navigation on Advanced Search Results
Asked Answered
A

1

2

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

Arly answered 6/11, 2012 at 9:51 Comment(9)
Are your attributes is_filterable_in_search (and not just is_filterable) ?Deannedeans
See my edits above, this is how my attributes are set up.Arly
Advanced search and layered navigation don't mix.Hooknosed
I don't see why not - it just has to work in the same way the catalogsearch works. It just needs to append a querystring based on the filters chosen (which are narrowed down by the product collection data)Arly
Last week I bumped into the same problem that you are having, I solved by just not using the advanced search and just posting the correct parameters to the list page. (Means I created my own advanced search that just uses the layered navigation.)Phi
@Kenny, that's a brilliant idea, the only issue is that the attributes that exist in my advanced search form are text attributes, so they won't be recognised as filters on the category page..Arly
Again I had the same issue, and decided to change them from text attributes to multi-select attributes. I know it's a bit more work to create all the possible values but it's the cleanest solution IMO.Phi
Hello, how have you solved your problem? :DChristean
@Phi Do you mind share how you accomplish that, really appreciate it.Camass
C
3

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

Camey answered 28/2, 2013 at 5:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.