2

I want to override sales order history for customer in frontend like this:

app/code/Test/SuccessPage/view/frontend/layout/sales_order_history.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="customer_account"/>
    <body>
        <referenceContainer name="content">
          <referenceBlock name="sales.order.history.extra.containe">
              <action method="setTemplate">
                  <argument name="template" xsi:type="string">Test_SuccessPage::order/history.phtml
              </action>
          </referenceBlock>
        </referenceContainer>
    </body>
</page>

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

<h1> This is a test page </h1>

unfortunately the above code doesnt work at all, it still load the vendor history.phtml

1 Answer 1

3

Try following way:


<?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="sales.order.history">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Test_SuccessPage::order/history.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>
6
  • how to set custom block class for this? or override the default block here? Commented Oct 16, 2018 at 7:55
  • @jafarpinjar you can overwrite bock class using preference.
    – Sohel Rana
    Commented Oct 16, 2018 at 10:23
  • yes i am using like that, this is the issue magento.stackexchange.com/questions/246603/…? Commented Oct 16, 2018 at 12:18
  • unfortunately this didn't work Commented Oct 27, 2018 at 12:59
  • @AshwaniShukla make sure your module load after Magento_Sales module
    – Sohel Rana
    Commented Oct 28, 2018 at 3:32

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.