6

I tried to override wishlist view.phtml which loaded at customer account page like this:

app/code/Test/Salesman/view/frontend/layout/wishlist_index_index.xml

<?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">
    <referenceBlock name="customer.wishlist">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">Test_Salesman::wishlist/view.phtml </argument>
        </action>
    </referenceBlock> 
</page>

app/code/Test/Salesman/view/frontend/templates/wishlist/view.phtml

<h1> SUCCESS </h1>

but it always shows the original phtml file

1
  • Have you tried removing the space before the closing argument tag? Just in case.
    – Ben Crook
    Nov 8, 2017 at 10:46

1 Answer 1

1

There is 1 issue with your code. space in argument statement.

Please use below code its working fine in my system, I have tested this.

update file app/code/Test/Salesman/view/frontend/layout/wishlist_index_index.xml

<?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="customer.wishlist">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">Test_Salesman::wishlist/view.phtml</argument>
        </action>
    </referenceBlock> 
  </body>    
  </page>

if its help dont forgot accept & upvote ;)

7
  • Yogesh, why we need insert update handle in this xml? Already there is update in standard layout vendor/magento/module-wishlist/view/frontend/layout/wishlist_index_index.xml Nov 8, 2017 at 12:44
  • &Evgeny Levinsky you are right this not required i have updated answer.
    – Yogesh
    Nov 8, 2017 at 12:51
  • @Yogesh it's still not working Nov 9, 2017 at 1:52
  • @Shell Which version of magento2 you are using.
    – Yogesh
    Nov 9, 2017 at 4:47
  • @ShellSuite also try with updated answer.
    – Yogesh
    Nov 9, 2017 at 4:53

Your Answer

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

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