5

It seems like am missing the sidebar in my search result page, for more deatil refer to the image below. How do I add the same sidebar that, I have on the category page?

I have tried adding widgets but that didn't work for me.

I have tried this:

Edit the search results page?

https://www.magestore.com/magento-2-tutorial/magento-2-how-to-configure-catalog-search/

enter image description here

5
  • Did you make changes in layout xml? And clear cache if it is running?
    – ajthinking
    Nov 28 '19 at 15:39
  • Do your custom attributes set to filter with results under the settings, if not they will only show on standard category page Nov 28 '19 at 18:33
  • Have you tried to check with the luma theme only? (disable third party theme module if any) then check
    – Saphal Jha
    Nov 29 '19 at 5:44
  • did you tried my ans please let me knw if it works for you and accept it so that other may find it helpful-thanks
    – Pramod
    Nov 29 '19 at 6:31
  • Did you disable layered navigation? Dec 2 '19 at 4:44
5
+100

You can find this layout file catalogsearch_result_index.xml in your app/code or app/design directory first.

Try to run below command in your CLI that will return all files which named as catalogsearch_result_index.xml in your Magento

find -type f -name 'catalogsearch_result_index.xml'

After running above command you can see following output in console.

./vendor/magento/module-msrp/view/frontend/layout/catalogsearch_result_index.xml
./vendor/magento/module-advanced-search/view/frontend/layout/catalogsearch_result_index.xml
./vendor/magento/module-layered-navigation/view/frontend/layout/catalogsearch_result_index.xml
./vendor/magento/module-swatches/view/frontend/layout/catalogsearch_result_index.xml
./vendor/magento/module-directory/view/frontend/layout/catalogsearch_result_index.xml
./vendor/magento/google-shopping-ads/view/frontend/layout/catalogsearch_result_index.xml
./vendor/magento/module-wishlist/view/frontend/layout/catalogsearch_result_index.xml
./vendor/magento/module-catalog-search/view/frontend/layout/catalogsearch_result_index.xml
./app/design/frontend/Vendor/Theme/Magento_CatalogSearch/layout/catalogsearch_result_index.xml

Here I can see only one file here from app/design directory. You will also get same vendor files in result. But you need to check app/code and app/design files first. Here in my case I check below XML file first.

app/design/frontend/Vendor/Theme/Magento_CatalogSearch/layout/catalogsearch_result_index.xml

You need to check below lines are available there in your catalogsearch_result_index.xml files or not ?

<referenceContainer name="sidebar.main" remove="true" />
<referenceBlock name="catalogsearch.leftnav" remove="true" />
<referenceContainer name="sidebar.additional" remove="true" />

If any single line available there in that layout files, please try to comment out that line and just clear and flush Magento cache, and then check you can get your sidebar back. Because in layout whenever we add remove="true" there then it will remove particular container or block.

Note : If you have any single line in your layout file then you just need to comment that line and need to clear Magento cache once. Then it will work same as default Magento.

Hope this will help you!

6
  • Hi! Great reply. I never got the result ./app/design/frontend/Vendor/Theme/Magento_CatalogSearch/layout/catalogsearch_result_index.xml I did get: ./app/code/Mageplaza/LayeredNavigation/view/frontend/layout/catalogsearch_result_index.xml But there is no referenceContainer or referenceBlock in that file ^^. Im using the Porto theme som maybe the file is stored somewhere else? Nov 30 '19 at 15:43
  • Yes vendor means any namespace like in your case that is Mageplaza and module/theme name means LayeredNavigation in your case. I think something removed using layout file otherwise this block won't remove automatically. Let me know if you need more help then. Nov 30 '19 at 16:26
  • If you got same name's XML file in app/code pr app/design directory then check that all, only in that file may be something removed otherwise check this file in vendor directly and compare that file with default Magento's file. It may be possible dor some reason you changed that file.. Nov 30 '19 at 16:29
  • Or do you have custom layout file for catalog search results? Nov 30 '19 at 16:29
  • One more thing please confirm with CSS. That is not hide through CSS, that also possible here. Nov 30 '19 at 18:03
3

most likely this is because of the "sidebar" or "sidebar.additional" container has been removed from your theme layout.

In order to fix this issue, please follow the steps below:

Look for remove="true" in the theme layout XML files. For this you need to check out all these files in our theme in general:

app/design/frontend/ThemeVendor/themename/*/layout/*.xml

Remove or comment lines that look like this

<referenceContainer name="sidebar.additional" remove="true" />

or

<referenceContainer name="sidebar" remove="true" />

hope this will solve your issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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