2
votes

I've gotten quite used to overwriting magento's frontend layout files, so I thought it would be easy to overwrite a phtml template in the admin panel - but I've gotten nowhere in the last six hours. All tutorials I've found so far are concentrating on creating a controller, but I only need to overwrite two phtml files since I only want to change the dispaly of the ordered items a little.

Specifically I want to overwrite the default/template/sales/order/view/items.phtml, normally i'd just match that path in my design folder of my own module and call it a day.

I can overwrite the block php file in Mage/Adminhtml/Sales/Order/View/Items.php through my config.xml:

<config>
...
   <global>
   ...
     <blocks>
     ...
        <adminhtml>
            <rewrite>
                <sales_order_view_items>MyCompany_MyModule_Block_Adminhtml_Sales_Order_View_Items</sales_order_view_items>
            </rewrite>
        </adminhtml>
      </blocks>
    ...
    </global>
 ...
 </config>

How can I tell Magento to use my phtml file in design/adminhtml//default/sales/order/view/items.phtml ?

Shouldn't these lines in my config.xml work?

<config>
...
<adminhtml>
    <layout>
        <updates>
            <my_module>
                <file>order_list.xml</file>
            </my_module>
        </updates>
    </layout>
</adminhtml>
...
</config>

Any help is really appreciated! I really hope I've just overlooked something...

1

1 Answers

0
votes

What you could do is put your custom module before Mage_Adminhtml

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <My_Module before="Mage_Adminhtml">My_Module_Adminhtml</My_Module>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

Then copy to your order_list.xml

<adminhtml_sales_order_view> 
    .... 
</adminhtml_sales_order_view> 

from /app/design/adminhtml/default/default/layout/sales.xml

In order_list.xml you could now replace the block type and template file (phtml) location