2

In customer account dashboard there's a recent orders block, i tried to override it like this:

app/code/Test/SuccessPage/view/frontend/layout/customer_account_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>
 <referenceContainer name="content">
 <referenceBlock name="customer_account_dashboard_top">
 <action method="setTemplate">
 <argument name="template" xsi:type="string">Test_SuccessPage::order/recent.phtml</argument>
 </action>
 </referenceBlock>
 </referenceContainer>
 </body>
</page>

app/code/Test/SuccessPage/view/frontend/templates/order/recent.phtml

<h1> Success !! </h1>

Unfortunately, it's not working at all

asked Oct 3, 2017 at 7:02
4
  • remove reference container from your customer_account_index.xml file Commented Oct 3, 2017 at 7:18
  • @ABHISHEKTRIPATHI not working at all Commented Oct 3, 2017 at 7:25
  • may be the parameters you are passing should be passed in single inverted coma https://magento.stackexchange.com/questions/86188/magento-2-changing-a-blocks-template Commented Oct 3, 2017 at 7:33
  • @ABHISHEKTRIPATHI single inverted coma not working too Commented Oct 3, 2017 at 7:38

2 Answers 2

0

Code is seems Ok. May be you need to depends Module at app/code/Test/SuccessPage/etc/module.xml.

<?xml version="1.0" encoding="utf-8" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
 <module name="Test_SuccessPage" setup_version="2.0.0">
 <!-- add this -->
 <sequence>
 <module name="Magento_Customer"/>
 </sequence>
 </module>
</config>
answered Oct 3, 2017 at 7:42
3
  • not working either Commented Oct 3, 2017 at 7:50
  • Please share your full module? Commented Oct 3, 2017 at 7:53
  • I have same issue. It's not working. Commented Apr 4, 2018 at 5:43
0

Update code in your layout file.

=> Test/SuccessPage/view/frontend/layout/customer_account_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_account_dashboard_top">
 <action method="setTemplate">
 <argument name="template" xsi:type="string">Test_SuccessPage::order/recent.phtml</argument>
 </action>
 </referenceBlock>
 </body>
</page>
answered Oct 3, 2017 at 7:13
7
  • not working at all Commented Oct 3, 2017 at 7:25
  • Did you cleared cache. It's working fine for me. Commented Oct 3, 2017 at 7:31
  • yes i already cleared cache, and static content deploy Commented Oct 3, 2017 at 7:34
  • I see, I test using SR_Stackexchange. Commented Oct 3, 2017 at 7:36
  • so i should make layout.xml inside layout folder? Commented Oct 3, 2017 at 7:51

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.