0

I want to over ride following tramplete:

app/code/Mageplaza/EditOrder/view/adminhtml/templates/order/edit/shipping/method/list.phtml

Declared in :

app/code/Mageplaza/EditOrder/view/adminhtml/layout/mpeditorder_quick_edit.xml

with following:

<container name="content">
    <block class="Mageplaza\EditOrder\Block\Adminhtml\Order\Edit\QuickEdit" name="mpeditorder.quick.edit" template="Mageplaza_EditOrder::order/edit/quick/form.phtml">
        <block class="Mageplaza\EditOrder\Block\Adminhtml\Order\Edit\ShippingMethod" name="mpeditorder.shipping.method" template="Mageplaza_EditOrder::order/edit/shipping/method/list.phtml" />
    </block>
</container>

I create my custom module depend on this extension having. app/code/Evx/EditOrder/view/adminhtml/layout/mpeditorder_quick_edit.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="mpeditorder.shipping.method">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Evx_EditOrder::order/edit/shipping/method/list.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

Even Adding container on top is also not working:

<?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="mpeditorder.shipping.method">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Evx_EditOrder::order/edit/shipping/method/list.phtml</argument>
            </action>
        </referenceBlock>
        </referenceContainer>
    </body>
</page>

and copy template into :

app/code/Evx/EditOrder/view/adminhtml/templates/order/edit/shipping/method/list.phtml

Template not overriding.

1

Try to set template like below code,

app/code/Evx/EditOrder/view/adminhtml/layout/mpeditorder_quick_edit.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 class="Mageplaza\EditOrder\Block\Adminhtml\Order\Edit\ShippingMethod" name="mpeditorder.shipping.method" template="Evx_EditOrder::order/edit/shipping/method/list.phtml">
        </referenceBlock>
    </body>
</page>

Hope it will help you!

2
  • Try this as well not working Sep 10 at 11:37
  • @HassanAliShahzad Then you should make sure the below things, 1. Check your "mpeditorder_quick_edit.xml" layout file is overridden by your theme. 2. Clean the cache Sep 10 at 12:17
0

Your code is perfect but You need to specify a load order in your component’s module.xml file using the <sequence> tag to ensure that needed files from other components are already loaded when your component loads.

<sequence> declares the list of components that must be loaded before the current component is loaded. It’s used for loading different kind of files: configuration files, view files (including CSS, Less, and template files), or setup classes. Note that does not affect the loading of regular classes (non-setup classes). Setup classes are classes in the component that create or update database schema or data.

so,in app/code/Evx/EditOrder/module.xml

add below code

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Evx_EditOrder" setup_version="0.0.1">
        <sequence>
            <module name="Mageplaza_EditOrder" />
        </sequence>
    </module>
</config>
3
  • yes it is like that but not working Sep 10 at 11:37
  • in config,php Evx_EditOrder is after Mageplaza_EditOrder? Sep 10 at 11:41
  • Also your recommendation is not correct in sequence it should like.<module name="Mageplaza_EditOrder"/> not current module Sep 10 at 11:43
0

Try to set the template in your Layout File as below,

app/code/Evx/EditOrder/view/adminhtml/layout/mpeditorder_quick_edit.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="mpeditorder.shipping.method">
            <arguments>
                <argument name="template" xsi:type="string">Evx_EditOrder::order/edit/shipping/method/list.phtml</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

Hope It Will Work !!

Also Make Sure that This Template is not Somewhere Overriden in Theme Files.

0

My posted code is perfectly fine for overriding the admin template. SO if any one want to override above is tested working example. Actually issue which I was facing poorly written Mageplaza Extension. They are loading template from controller.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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