4

I am trying to search for products on my Magento 2.3 site. When the result is empty (there are no products found) it just shows a page saying there are no products found. Perfect!

But when there is a product found the layout of the site doesn't get loaded, not even the head.

I narrowed it down to being a problem with my XML configuration but couldn't see the problem as it works on other pages.

This is my default.xml

<?xml version="1.0" ?>

header links

    <referenceBlock name="logo">
        <arguments>
            <argument name="logo_img_width" xsi:type="number">148</argument>
            <argument name="logo_img_height" xsi:type="number">43</argument>
        </arguments>
    </referenceBlock>

    <!-- Remove Blocks -->
    <referenceBlock name="report.bugs" remove="true"/>
    <referenceBlock name="catalog.topnav" remove="true"/>
    <referenceBlock name="footer" remove="true"/>
    <referenceBlock name="header.panel.wrapper" remove="true"/>
    <referenceBlock name="navigation.sections" remove="true"/>

    <!-- Remove compare -->
    <referenceBlock name="catalog.compare.link" remove="true"/>
    <referenceBlock name="catalog.compare.sidebar" remove="true"/>
    <referenceBlock name="catalogsearch.product.addto.compare" remove="true"/>
    <referenceBlock name="category.product.addto.compare" remove="true"/>
    <referenceBlock name="crosssell.product.addto.compare" remove="true"/>
    <referenceBlock name="related.product.addto.compare" remove="true"/>
    <referenceBlock name="upsell.product.addto.compare" remove="true"/>
    <referenceBlock name="view.addto.compare" remove="true"/>

    <!-- Page Wrapper -->
    <referenceContainer name="page.wrapper">
        <container name="custom.header" htmlTag="header" htmlClass="header" before="main.content">
            <block class="Magento\Framework\View\Element\Template" name="custom_header" as="custom_header"
                   template="Magento_Theme::html/header.phtml" before="-"/>
        </container>
    </referenceContainer>

    <move element="logo" as="logo" destination="custom_header"/>
    <move element="top.search" as="topsearch" destination="custom_header"/>
    <move element="minicart" as="minicart" destination="custom_header"/>
    <move element="store_language" as="store_language" destination="custom_header"/>
    <move element="breadcrumbs" destination="custom_header" before="main.content"/>
    <move element="page.main.title" destination="custom_header" as="title" before="main.content"/>

    <referenceContainer name="footer">
        <block class="Magento\Store\Block\Switcher" name="store_switcher" as="store_switcher" after="footer_links"
               template="Magento_Store::switch/stores.phtml"/>
    </referenceContainer>

    <move element="copyright" destination="before.body.end"/>

    <referenceContainer name="before.body.end">
        <block name="bootstrap.js" class="Magento\Framework\View\Element\Template"
               template="Magento_Theme::page/js/bootstrap.phtml"/>
    </referenceContainer>
</body>

atalog\Block\Product\ProductList\Item\Container" name="catalogsearch.product.addto" as="addto">

And the Catalogsearch_result_index.xml

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

    </body>

</page>

Removing the empty Catalogsearch_result_index.xml doesn't do anything.

enter image description here

It looks like only the block is loaded the head, header, and footer are gone

0

Your Answer

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