0

The Compare Products sidebar on category pages does not show up, and I was trying to figure out why. So I temporarily deleted files under the app/design/frontend/customer-name/default folder to see if it would come back (with help of version control to restore them). I discovered that when I temporarily delete the file in app/design/frontend/customer-name/default/Magento_Catalog/layout/catalog_category_view.xml, the Compare Products sidebar on category pages returns.

When I try to re-add this file with only boilerplate layout xml code, it disappears again. Adding a layout xml file with only boilerplate code should not change anything, right? Here is that file before I delete it:

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="css/listing.css" />
        <css src="css/brand.css" />
        <link src="Magento_Catalog::js/body-class-tag-brand-modify.js" />
        <link src="js/category.js" />
    </head>
<body>
        <referenceContainer name="content" >
            <block class="Magento\Catalog\Block\Category\View" name="this.is.a.brand" template="Magento_Catalog::category/brand_tag_class.phtml"/>
           <block class="CompanyName\CategoryPage\Block\FeaturedInCategory" name="category.products.list.no.toolbar" template="Magento_Catalog::product/list_without_toolbar.phtml" />
        </referenceContainer>
        <move element="category.image" destination="columns.top" before="page.main.title"/>
    </body>
</page>

Here is the file when I re-add with only boilerplate layout xml code:

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

Discovered a solution. The boilerplate was wrong. The difference is the value of page layout="2columns-left" in the 2nd line, instead of page layout="1column".

<?xml version="1.0"?>
<page layout="2columns-left" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="css/listing.css" />
        <css src="css/brand.css" />
        <link src="Magento_Catalog::js/body-class-tag-brand-modify.js" />
        <link src="js/category.js" />
    </head>
<body>
        <referenceContainer name="content" >
            <block class="Magento\Catalog\Block\Category\View" name="this.is.a.brand" template="Magento_Catalog::category/brand_tag_class.phtml"/>
           <block class="CompanyName\CategoryPage\Block\FeaturedInCategory" name="category.products.list.no.toolbar" template="Magento_Catalog::product/list_without_toolbar.phtml" />
        </referenceContainer>
        <move element="category.image" destination="columns.top" before="page.main.title"/>
    </body>
</page>

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.