Skip to main content
added 80 characters in body
Source Link
Prince Patel
  • 22.9k
  • 10
  • 98
  • 121

Create catalog_category_view.xml in your theme

app/design/frontendcode/Vendor/themeModule/Magento_Catalogview/frontend/layout/catalog_category_view.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>
        <referenceContainer name="content">
            <block class="Magento\Framework\View\Element\Template" name="custom.block" template="Magento_Catalogtemplate="Vendor_Module::myCustomFile.phtml" />
        </referenceContainer>
    </body>
</page>

Now create myCustomFile.phtml and place your custom code

app/design/frontendcode/Vendor/themeModule/Magento_Catalogview/frontend/templates/myCustomFile.phtml

<?php

echo "This is my custom file for product list page";

?>

Create catalog_category_view.xml in your theme

app/design/frontend/Vendor/theme/Magento_Catalog/layout/catalog_category_view.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>
        <referenceContainer name="content">
            <block class="Magento\Framework\View\Element\Template" name="custom.block" template="Magento_Catalog::myCustomFile.phtml" />
        </referenceContainer>
    </body>
</page>

Now create myCustomFile.phtml and place your custom code

app/design/frontend/Vendor/theme/Magento_Catalog/templates/myCustomFile.phtml

Create catalog_category_view.xml

app/code/Vendor/Module/view/frontend/layout/catalog_category_view.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>
        <referenceContainer name="content">
            <block class="Magento\Framework\View\Element\Template" name="custom.block" template="Vendor_Module::myCustomFile.phtml" />
        </referenceContainer>
    </body>
</page>

Now create myCustomFile.phtml and place your code

app/code/Vendor/Module/view/frontend/templates/myCustomFile.phtml

<?php

echo "This is my custom file for product list page";

?>
Source Link
Prince Patel
  • 22.9k
  • 10
  • 98
  • 121

Create catalog_category_view.xml in your theme

app/design/frontend/Vendor/theme/Magento_Catalog/layout/catalog_category_view.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>
        <referenceContainer name="content">
            <block class="Magento\Framework\View\Element\Template" name="custom.block" template="Magento_Catalog::myCustomFile.phtml" />
        </referenceContainer>
    </body>
</page>

Now create myCustomFile.phtml and place your custom code

app/design/frontend/Vendor/theme/Magento_Catalog/templates/myCustomFile.phtml