0

I have no luck overriding template Magento_Sales::items/column/qty.phtml in my custom module like so:

file app/code/Maghos/Backorders/view/adminhtml/layout/sales_order_view.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="column_qty">
            <action method="setTemplate">
                <argument name="template" translate="true" xsi:type="string">Maghos_Backorders::items/column/qty.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

After cache flush Magento is still loading this vendor file: vendor/magento/module-sales/view/adminhtml/templates/items/column/qty.phtml instead of my custom Maghos/Backorders/view/adminhtml/templates/items/column/qty.phtml.

What I am missing?

1 Answer 1

0

Try to add <update handle="sales_order_transactions_grid_block"/> <update handle="sales_order_item_price"/> and remove translate="true" attribute from argument then php bin/magento cache:flush

3
  • Thanks, but it doesn't work. It's still loading vendor file.
    – tesar.hk
    Sep 2, 2020 at 7:27
  • Try to add <update handle="sales_order_transactions_grid_block"/> <update handle="sales_order_item_price"/> and remove translate="true" attribute from argument then php bin/magento cache:flush Sep 2, 2020 at 7:36
  • Still no luck. If I comment out this line in vendor sales_order_view.xml : <block class="Magento\Sales\Block\Adminhtml\Items\Column\Qty" name="column_qty" template="Maghos_Backorders::items/column/qty.phtml" group="column"/> my custom phtml renders. So I thinkg there is a problem in my action method="setTemplate" declaration.
    – tesar.hk
    Sep 2, 2020 at 9:01

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.