1

Want my search results only in 1 column. After updating my catalogsearch_result_index.xml with layout="1column" I got a blank site with a Error 500.

Clearing cache, deploy static files was done. (using Magento 2.2.6)

Any ideas?

File:

/app⁩/design/⁨frontend/⁨theme/⁨Default/Magento_CatalogSearch⁩/⁨layout⁩/catalogsearch_result_index.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <attribute name="class" value="page-products"/>
        <referenceContainer name="content">
            <block class="Magento\CatalogSearch\Block\Result" name="search.result" template="Magento_CatalogSearch::result.phtml">
                <block class="Magento\CatalogSearch\Block\SearchResult\ListProduct" name="search_result_list" template="Magento_Catalog::product/list.phtml">
                    <arguments>
                        <!-- If argument's position depends on image size changeable in VDE:
                        positions:list-secondary,grid-secondary,list-actions,grid-actions,list-primary,grid-primary
                    -->
                        <argument name="positioned" xsi:type="string">positions:list-secondary</argument>
                    </arguments>
                    <block class="Magento\Catalog\Block\Product\ProductList\Toolbar" name="product_list_toolbar" template="Magento_Catalog::product/list/toolbar.phtml">
                        <block class="Magento\Theme\Block\Html\Pager" name="product_list_toolbar_pager"/>
                    </block>
                    <action method="setToolbarBlockName">
                        <argument name="name" xsi:type="string">product_list_toolbar</argument>
                    </action>
                    <block class="Magento\Framework\View\Element\RendererList" name="category.product.type.details.renderers" as="details.renderers">
                        <block class="Magento\Framework\View\Element\Template" name="category.product.type.details.renderers.default" as="default"/>
                    </block>
                    <block class="Magento\Catalog\Block\Product\ProductList\Item\Container" name="catalogsearch.product.addto" as="addto">
                        <block class="Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare"
                               name="catalogsearch.product.addto.compare" as="compare"
                               template="Magento_Catalog::product/list/addto/compare.phtml"/>
                    </block>
                </block>
                <action method="setListOrders"/>
                <action method="setListModes"/>
                <action method="setListCollection"/>
            </block>
            <block name="search.search_terms_log" template="Magento_CatalogSearch::search_terms_log.phtml">
                <arguments>
                    <argument name="search_terms_log" xsi:type="object">Magento\CatalogSearch\Block\SearchTermsLog</argument>
                </arguments>
            </block>
            <referenceBlock name="sidebar.additional" remove="true"/>
        </referenceContainer>
    </body>
</page>
  • Can you share your XML file path, file name and the XML code please. – Pritam Info 24 Dec 20 '18 at 15:36
  • Your path seem to be wrong app/design/frontend/Vendor/theme/Magento_CatalogSearch/layout/catalogsearch_result_index.xml – Abhishek Panchal Dec 20 '18 at 16:32
0

Try by adding below code to catalogsearch_result_index.xml

app⁩/design/⁨frontend/⁨theme/⁨Default/Magento_CatalogSearch⁩/⁨layout⁩/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">
    <update handle="1column"/>
    ......
    //Your other xml
    ......
</page>
  • Doesnt work. Getting a blank site/error. – Marcel Dec 20 '18 at 16:37
0

Try below code in proper location.

app/design/frontend/Vendor/theme/Magento_CatalogSearch/layout/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">
    <body>
        <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">
                    <arguments>
                        <!-- If argument's position depends on image size changeable in VDE:
                        positions:list-secondary,grid-secondary,list-actions,grid-actions,list-primary,grid-primary
                    -->
                        <argument name="positioned" xsi:type="string">positions:list-secondary</argument>
                    </arguments>
                    <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"/>
                    </block>
                    <action method="setToolbarBlockName">
                        <argument name="name" xsi:type="string">product_list_toolbar</argument>
                    </action>
                    <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"/>
                    </block>
                    <block class="Magento\Catalog\Block\Product\ProductList\Item\Container" name="catalogsearch.product.addto" as="addto">
                        <block class="Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare"
                               name="catalogsearch.product.addto.compare" as="compare"
                               template="Magento_Catalog::product/list/addto/compare.phtml"/>
                    </block>
                </block>
                <action method="setListOrders"/>
                <action method="setListModes"/>
                <action method="setListCollection"/>
            </block>
        </referenceContainer>
        <referenceBlock name="search.result">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">Search Results</argument>
            </action>
        </referenceBlock>
        <referenceBlock name="sidebar.additional" remove="true"/>
    </body>
</page>
  • Problem solved. It was a 3rd party extension (MegaMenu). There was another catalogsearch_result_index.xml which overrides my changes. – Marcel Dec 20 '18 at 17:24

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.