Template override not being used
-
25-02-2021 - |
题
Magento 2.2.7
I've placed my version of Wishlist list.phtml in my template directory at
/app/design/frontend/Local/argento-stripes-custom/Magento_Wishlist/template/item/list.phtml
However, this is not being used. Template hints shows its calling the default Magento Block & templates, vis
/httpdocs/vendor/magento/module-wishlist/view/frontend/templates/item/list.phtml
Magento\Wishlist\Block\Customer\Wishlist\Items
If I use a layout file to declare my my phtml file then I get an error about data not being available;
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceBlock name="customer.wishlist" >
<action method="setTemplate">
<argument name="template" xsi:type="string">Magento_Wishlist::item/list.phtml</argument>
</action>
</referenceBlock>
</page>
Do I have to declare my own module to override Magento's Wishlist?
解决方案
/app/design/frontend/Local/argento-stripes-custom/Magento_Wishlist/template/item/list.phtml
The reason your template is not being used is becasue your path is incorrect, you are specifying template not templates if you change this your overwrite should work fine