2

I want to overwrite template file sales/order/invoice/create/items.phtml which is define in sales.xml like below :

<adminhtml_sales_order_invoice_new>
    <reference name="content">
        <block type="adminhtml/sales_order_invoice_create" name="sales_invoice_create">
            <block type="adminhtml/sales_order_invoice_create_form" name="form" template="sales/order/invoice/create/form.phtml">
                <block type="adminhtml/sales_order_view_info" name="order_info" template="sales/order/view/info.phtml"></block>
                <block type="adminhtml/sales_order_payment" name="order_payment"></block>
                <block type="adminhtml/sales_order_invoice_create_items" name="order_items" template="sales/order/invoice/create/items.phtml">
                 ---- Other Code ---------
</adminhtml_sales_order_invoice_new>

I do below code for that

mymodule.xml

<adminhtml_sales_order_invoice_new>
    <reference name="order_items">
           <block type="adminhtml/sales_order_invoice_create_items" name="mymodule" template="mymodule/order/invoice/create/items.phtml">
           </block>
    </reference>
</adminhtml_sales_order_invoice_new>

But still,Magento is using default items.phtml

Where I am wrong ?

2

You have to use setTemplate action:

<adminhtml_sales_order_invoice_new>
    <reference name="order_items">
        <action method="setTemplate"><template>mymodule/order/invoice/create/items.phtml</template></action>
    </reference>
</adminhtml_sales_order_invoice_new>
  • 1
    Ohhhhhhhh yes.. :D I forgot this .. – Krupali Dec 26 '16 at 13:07

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.