Magento2 – Fix Invalid Template File: ‘Magento_catalog::product/list.phtml’

errorlistlogmagento2

I noticed I am getting error in my magento 2.2.6 website's system.log continuously

[2021-09-16 10:10:56] main.CRITICAL: Invalid template file: 'Magento_catalog::product/list.phtml' in module: 'Magento_Catalog' block's name: 'category.products.list' [] []
[2021-09-16 10:10:56] main.INFO: 1 [] []
[2021-09-16 10:10:56] main.INFO: 1 [] []
[2021-09-16 10:10:56] main.INFO: 5 [] []

Please see my html\app\design\frontend\my_theme\default\Magento_Catalog\layout\catalog_category_view.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="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="page.top">
           <container name="category.view.container" htmlTag="div" htmlClass="category-view" before="breadcrumbs">
               <block class="Magento\Catalog\Block\Category\View" name="category.image" template="Magento_Catalog::category/image.phtml"/>
               <block class="Magento\Theme\Block\Html\Title" name="page.main.title" template="html/title.phtml" after="sidebar.main"/>
           </container>
        </referenceContainer>
        <referenceContainer name="content">
            <block class="Magento\Cms\Block\Block" name="slide-category" before="-">
                <arguments>
                    <argument name="block_id" xsi:type="string">slide-category</argument>
                </arguments>
            </block>
        </referenceContainer>
        <referenceContainer name="sidebar.additional">
            <block class="Magento\Cms\Block\Block" name="category-view-left-custom-block" after="-">
                <arguments>
                    <argument name="block_id" xsi:type="string">category-view-left-custom-block</argument>
                </arguments>
            </block>
            <referenceBlock name="wishlist_sidebar" remove="true"/>
            <referenceBlock name="sale.reorder.sidebar" remove="true"/>
        </referenceContainer>

        <referenceContainer name="content">
            <referenceBlock class="Magento\Catalog\Block\Product\ListProduct" name="category.products.list" as="product_list">
                <action method="setDefaultDirection">
                    <argument name="dir" xsi:type="string">desc</argument>
                </action>
            </referenceBlock>
        </referenceContainer>
        <move element="category.view.container" destination="content" before="-"/>
    </body>
</page>

I can't find any error .Please help to solve this.

Best Answer

There is typo error in your xml file.

Magento_catalog::product/list.phtml should be Magento_Catalog::product/list.phtml

C should be capital in module name.

Just open catalog_category_view.xml from vendor/theme folder and update module name with capital.

You can also enable developer mode to see error on front if you are on local/development environment!

Hope above will help!

Related Topic