2

I am using the below mentioned code to move the Layered navigation above content on Search pages in catalogsearch_result_index.xml

<body>
    <move element="catalogsearch.leftnav" destination="content" before="-" />
</body>

But it is not showing above content on search pages.

Please help me in correcting the code, if i am missing something in this

3
  • can you elaborate your code
    – ben
    Jun 27, 2018 at 10:52
  • You can try This <move element="catalogsearch.leftnav" destination="header.container" />
    – ben
    Jun 27, 2018 at 10:54
  • Not working:( this is the code, i have overwrite this file (/app/design/frontend/Vendor_Theme/base/Magento_CatalogSearch/layout/catalogsearch_result_index.xml ) in my theme for getting this.
    – Vinay
    Jun 27, 2018 at 13:27

1 Answer 1

2

You need to use <move element="sidebar.main" destination="content" before="-"/> The layered navigation for the search results page is defined in /vendor/magento/module-layered-navigation/view/frontend/layout/catalogsearch_result_index.xml and the referenceContainer is sidebar.main not catalogsearch.leftnav.

1
  • 1
    For anyone else who comes across this, for v2.4.5 this will break the search toolbar sorter. Oct 18, 2022 at 0:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.