Extending magento admin with xml
in /admin/sales_order/view/ I want to add a link on the left menu where I want to show extra product options I’ve added to in the frontend. All I need to do is extend the core xml and add somthing like:
<adminhtml_sales_order_view>
&开发者_开发问答lt;reference name="sales_order_tabs">
<action method="addTab"><name>my_name</name><block>my/block</block></action>
</reference>
</adminhtml_sales_order_view>
I tried making my own module, but I just can't get i right. Can anyone help me?
Here's the solution I ended up with.
Create a new module the usual way.
Have this config.xml in /company/module/etc:
<?xml version="1.0"?>
<config>
<global>
<blocks>
<MODULE_NAME>
<class>Company_Module_Block</class>
</MODULE_NAME>
</blocks>
</global>
<adminhtml>
<layout>
<updates>
<MODULE_NAME>
<file>module_name.xml</file>
</MODULE_NAME>
</updates>
</layout>
</adminhtml>
</config>
In /app/design/adminhtml/default/default/layout have your module_name.xml with something like:
<?xml version="1.0"?>
<layout version="0.1.0">
<adminhtml_sales_order_view>
<reference name="sales_order_tabs">
<action method="addTab"><name>your_name</name><block>module/block_name</block></action>
</reference>
</adminhtml_sales_order_view>
</layout>
Hope this helps those looking for the same answer. Of course you have to fill your block with content, look at the core blocks for examples. This was just to demonstate how to extend the core with xml.
http://inchoo.net/ecommerce/magento/coffeefreak-blank-magento-extension-for-building-main-admin-menu-with-sidebar-and-tabs/
精彩评论