1
votes

I've created a magento (1.7 CE) local module to add, in the Admin section, some info to the product list displayed in the Orders received. Internally all seems to work good except that i'm not succeeding in replacing the template used to render each product line in the order.

In app/design/adminhtml/default/default/layout/sales.xml i have this code

<adminhtml_sales_order_view>
    <reference name="head">
        <action method="addJs"><file>mage/adminhtml/giftmessage.js</file></action>
        <action method="addJs"><file>mage/adminhtml/giftoptions/tooltip.js</file></action>
    </reference>
    <reference name="content">
        <block type="adminhtml/sales_order_view" name="sales_order_edit"></block>
    </reference>
    <reference name="left">
        <block type="adminhtml/sales_order_view_tabs" name="sales_order_tabs">
            <block type="adminhtml/sales_order_view_tab_info" name="order_tab_info" template="sales/order/view/tab/info.phtml">
                <block type="adminhtml/sales_order_view_messages" name="order_messages"></block>
                <block type="adminhtml/sales_order_view_info" name="order_info" template="sales/order/view/info.phtml"></block>
                <block type="adminhtml/sales_order_view_items" name="order_items" template="sales/order/view/items.phtml">
                    <action method="addItemRender"><type>default</type><block>adminhtml/sales_order_view_items_renderer_default</block><template>sales/order/view/items/renderer/default.phtml</template></action>
                    <...

I would like to replace the template set by the LAST line you see (the addItemRenderer).

In my module config.xml i have

<adminhtml>
   <layout>
     <updates>
       <my_ext>
                <file>myext_update.xml</file>
       </my_ext>  
     </updates>
   </layout>
</adminhtml>

and in app/design/adminhtml/default/default/layout/myext_update.xml i have

<?xml version="1.0"?>

<admin_sales_order_view>

    <reference name="left">
        <reference name="sales_order_tabs">

            <reference name="order_tab_info">

                <reference name="order_items">

                    <action method="addItemRender">
                        <type>default</type>
                        <block>adminhtml/sales_order_view_items_renderer_default</block>
                        <template>myext/sales/order/view/items/renderer/default.phtml</template>
                    </action>

                </reference>

            </reference>

        </reference>

    </reference>

</admin_sales_order_view>

Obviously i have the file in app/design/adminhtml/default/default/template/myext/sales/order/view/items/renderer/default.phtml

but it is still not used.

Do you have a solution?

2

2 Answers

1
votes

Found the solution after some day of struggling...

the code and the method is all good, but i mistyped the handle name to update in the myext_update.xml

i wrote

<admin_sales_order_view>

but , as in the original sales.xml, the handle name was

<adminhtml_sales_order_view>
0
votes

Actually this wont work as the way you proceeded. You need to update the layouts. Have some idea about layout updates also render the layout in yout module

Check here http://www.magentocommerce.com/design_guide/articles/intro-to-layouts