0

I am new in Magento 2. I want to add new custom text on listing page. I've attached a screenshot for reference.I have copy list.phtml from

 /vendor/magento/module-catalog/view/frontend/templates/product/list.phtml

to dafault LUMA theme

   app/design/frontend/Magento/Luma/Magento_Catalog/templates/product/list.phtml

I have added text in list.phtml of theme location file.my problem is that changes is not showing list page. but when i have same text changed in core list.phtml file changes is showing.

After Following commands run

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy 
php bin/magento cache:flush
php bin/magento cache:clean
2
  • check in admin you have selecting Magento Luma Theme
    – Moin Malek
    Commented Nov 22, 2017 at 14:04
  • @MoinMalek selected theme LUMA
    – pramod24
    Commented Nov 22, 2017 at 17:39

3 Answers 3

1

If you using magento default luma theme that you cannot use Template changes logic -

app/design/frontend/{Vendor}/{Theme}/Magento_Catalog/templates/product/list.phtml

for luma theme bcoz of this theme is register under vendor/ folder.

In this create case, you should edit at core or need to create custom module from where you can template via layout

This module should consist of below files:

  • app/code/app/code/{vendorname}/{Modulename}/registration.php
  • app/code/{vendorname}/{Modulename}/composer.json
  • app/code/{vendorname}/{Modulename}/etc/module.xml
  • app/code/{vendorname}/view/frontend/layout/catalog_category_view.xml
  • app/code/{vendorname}/view/frontend/templates/product/list.phtml

catalog_category_view.xml code should be:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
    <referenceBlock name="category.products.list">
         <action method="setTemplate">
            <argument name="template" xsi:type="string">{vendorname}_{Modulename}::product/list.phtml</argument>
         </action>
    </referenceBlock>
</body></page>

And app/design/frontend/Magento/Luma/Magento_Catalog/templates/product/list.phtml need to copy at app/code/{vendorname}/view/frontend/templates/product/list.phtml

0

Theme name should be in lower case.

app/design/frontend/Magento/luma/Magento_Catalog/templates/product/list.phtml

Please check below link.

https://github.com/magento/magento2/tree/2.2-develop/app/design/frontend/Magento/luma/Magento_Catalog

0

Make sure you are in developer mode and then I try to clean pub/static and var/view_preprocessed and redeploy static content. If this doesn't work try and extend the layout. In app\design\frontend\vendor\theme\Magento_Catalog\layout\catalog_category_view.xml

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.