0

There is an extension which I want to add a little more features on. To achieve that I need to modify two .phtml files in

app/design/adminhtml/default/default/template/Orderpreparation/Packing/Index.phtml app/design/adminhtml/default/default/template/Orderpreparation/Packing/Products.phtml

I found that Index.phtml is mentioned in

app/design/adminhtml/default/default/layout/orderpreparation.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <adminhtml_orderpreparation_packing_index>
        <reference name="head">
            ...
        </reference>
        <reference name="content">
            ...
            <block type="Orderpreparation/Packing_Index" name="onepagepreparation" as="onepagepreparation" template="Orderpreparation/Packing/Index.phtml">
            </block>
        </reference>
    </adminhtml_orderpreparation_packing_index>
</layout>

On the packing page in the admin, selecting an option in a dropdown list with trigger Products.phtml to be loaded via AJAX and I can't find anywhere of triggering the Products.phtml.

If I want to override Index.phtml should I just create an xml file in layout folder as below:

app/design/adminhtml/default/default/layout/my_own_xml_to_override_index.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <adminhtml_orderpreparation_packing_index>
        <reference name="content">
            <block type="Orderpreparation/Packing_Index" name="onepagepreparation" as="onepagepreparation" template="MyOwnFiles/Packing/Index.phtml">
            </block>
        </reference>
    </adminhtml_orderpreparation_packing_index>
</layout>

Do I have do anything else to make sure Index.phtml will be override by my own phtml?

No idea how to I setup to override the Products.phtml?

Do I need to create a new extension in this case?


I created my own extension and below is the config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Company_ErpFlyerReminder>
            <version>1.0.0</version>
        </Company_ErpFlyerReminder>
    </modules>
    <adminhtml>
        <layout>
            <updates>
                <flyerreminder>
                    <file>packingflyerreminder.xml</file>
                </flyerreminder>
            </updates>
        </layout>
    </adminhtml>
    <frontend>
        <layout>
            <updates>
                <flyerreminder>
                    <file>flyerreminder.xml</file>
                </flyerreminder>
            </updates>
        </layout>
    </frontend>
    <global>
        <blocks>
            <flyerreminder>
                <class>Company_ErpFlyerReminder_Block</class>
            </flyerreminder>
            <adminhtml>
                <rewrite>
                    <packing_index>Company_ErpFlyerReminder_Block_Packing_Index</packing_index>
                </rewrite>
            </adminhtml>
        </blocks>
    </global>
</config>

app/etc/modules/Company_ErpFlyerReminder.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Company_ErpFlyerReminder>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <MDN_Orderpreparation/>
            </depends>
        </Company_ErpFlyerReminder>
    </modules>
</config> 

app/code/local/Company/ErpFlyerReminder/Block/Packing/Index.php

<?php
class Rycomau_ErpFlyerReminder_Block_Packing_Index extends MDN_OrderPreparation_Block_Packing_Index
{
}
  • Can you provide config.xml of your module? – Jaimin Sutariya Jul 20 '17 at 8:40
  • I don't have a config.xml because I am trying to override that without making a new extension. But if you mean the config.xml of the extension I am trying to override I can provide that. – noob Jul 20 '17 at 12:47
  • In which file you are defining your file my_own_xml_to_override_index.xml? We do it in extension's config.xml file. – Jaimin Sutariya Jul 20 '17 at 12:54
  • You are right so I updated my question with my config.xml – noob Jul 21 '17 at 0:10
1

You have defined your adminhtml layout xml with name packingflyerreminder.xml

Create a file app/design/adminhtml/default/default/layout/packingflyerreminder.xml with below code

<?xml version="1.0"?>
<layout version="0.1.0">
    <adminhtml_orderpreparation_packing_index>
        <reference name="onepagepreparation">
            <action method="setTemplate"><template>MyOwnFiles/Packing/Index.phtml</template></action>
        </reference>
    </adminhtml_orderpreparation_packing_index>
</layout>

Now create your phtml file at app/design/adminhtml/default/default/template/MyOwnFiles/Packing/Index.phtml with your custom code.

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.