Skip to content

Module Magento_AsyncOrder use setTemplate action insteade reference attribute "template" #37391

Open
@orthener

Description

Summary

Preconditions

  • Magento versions 2.4.5+
  • Module "module-async-order" in a vendor (v100.4.1)

Steps to reproduce

  1. Create a file sales_order_history.xml in your project.
  2. Set your custom template in this file
    <referenceBlock name="sales.order.history" template="Magento_Sales::order/custom-history-template.phtml" />
    
  3. Update Magento to v2.4.5+

Expected result

Sales history page use my custom template.

Actual result

Layout use template from Magento_AsyncOrder module because <action method="setTemplate"> has higher priority than <referenceBlock template="...."...

Examples

File: vendor/magento/module-async-order/view/frontend/layout/sales_order_history.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<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">Magento_AsyncOrder::order/history.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

Proposed solution

Replace

<referenceBlock name="sales.order.history">
    <action method="setTemplate">
        <argument name="template" xsi:type="string">Magento_AsyncOrder::order/history.phtml</argument>
    </action>
</referenceBlock>

with

<referenceBlock name="sales.order.history" template="Magento_AsyncOrder::order/history.phtml" />

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Area: FrameworkComponent: ThemeIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.5Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions