As far as I can tell Magento2 is not working as expected here.

In /Magento_CatalogSearch/layout/ I have 4 XML files:


In the top of each of these files I have the following line:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

Notice it says layout="1column". I have cleared caches, I have re-indexed.

Despite all of this my search results page is still using 2columns-left.

My search results page is using 2columns-left as its template file. How do I change this so my search results page is using 1column?

Here is the full contents of catalogsearch_result_index.xml:

<?xml version="1.0"?>
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <attribute name="class" value="page-products"/>
        <referenceContainer name="content">
            <block class="Magento\CatalogSearch\Block\Result" name="search.result" template="result.phtml" cacheable="false">
                <block class="Magento\CatalogSearch\Block\SearchResult\ListProduct" name="search_result_list" template="product/list.phtml" cacheable="false">
                        <!-- If argument's position depends on image size changeable in VDE:
                        <argument name="positioned" xsi:type="string">positions:list-secondary</argument>
                    <block class="Magento\Catalog\Block\Product\ProductList\Toolbar" name="product_list_toolbar" template="product/list/toolbar.phtml" cacheable="false">
                        <block class="Magento\Theme\Block\Html\Pager" name="product_list_toolbar_pager" cacheable="false"/>
                    <action method="setToolbarBlockName">
                        <argument name="name" xsi:type="string">product_list_toolbar</argument>
                    <block class="Magento\Framework\View\Element\RendererList" name="category.product.type.details.renderers" as="details.renderers">
                        <block class="Magento\Framework\View\Element\Template" as="default"/>
                <action method="setListOrders"/>
                <action method="setListModes"/>
                <action method="setListCollection"/>
  • Have you clear cache? – Rakesh Jesadiya Apr 22 '16 at 10:29
  • several times, and ive re-indexed – Jimmery Apr 22 '16 at 10:30
  • plz show your catalogsearch_result_index.xml file content. catalogsearch_result_index.xml is responsible for result page. – Rakesh Jesadiya Apr 22 '16 at 10:32
  • This file from theme or core module files? – Rakesh Jesadiya Apr 22 '16 at 10:44
  • @Rakesh done that - I havent changed this file much tbh – Jimmery Apr 22 '16 at 10:45

In catalogsearch_result_index.xml use <update handle="1column"/> after <layout> start.

So it should be like this

<body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd"> 
<update handle="1column"/>........your other codes

Clear cache, deploy static files and check

  • when you put <layout xmlns:xsi="... did you mean to put <body xmlns:xsi="... or are you suggesting that I should change body to layout? – Jimmery Apr 22 '16 at 10:42
  • Sorry that should be body. That was a typo mistake! I update my answer.. Let me know if it works or not – Asish Hira Apr 22 '16 at 10:48
  • ok, putting <update handle="1column"> directly after the <body> tag results in the page being completely blank? – Jimmery Apr 22 '16 at 10:48
  • You forgot the closing / @jimmery – Ben Crook Jun 23 '16 at 6:41
  • 1
    How do you use 1-column layout only for "no results" and keep 2-column for when there are results? – thdoan Mar 7 '17 at 8:48

You have to just add below file inside app/design/frontend/{Package}/{themename}/Magento_CatalogSearch/ content for catalogsearch_result_index.xml

 <?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

Remove var folder from root.

  • plz check using above working code. – Rakesh Jesadiya Apr 22 '16 at 10:58
  • this is what I already have, as stated in my question - and it doesnt work – Jimmery Apr 22 '16 at 11:31

I'm putting this here since it essentially provides the intended result, even though it doesn't do it the perfect way. Changing the layout attribute or using a update handle (mentioned in previous examples) of Magento_CatalogSearch/layout/catalogsearch_result_index.xml did not actually change the layout of the page as you can confirm by checking the body class. I would love to know why this isn't working since the same approach works in other modules. It could be something on my installation, but judging by the other responses here it could be something else.

If you target the Main Sidebar you can essentially achieve the desired 1column layout.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="sidebar.main" remove="true" />

My page element layout attribute is set to "1column" here, but through testing it is being ignored.

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.