销售订单视图上的“自定义"选项卡 [英] Custom tab on sales order view

查看:67
本文介绍了销售订单视图上的“自定义"选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不修改核心代码的情况下将新标签添加到Magento的销售订单视图中? 我在网上看到了一些教程,但他们希望您在/app/design/adminhtml/default/default/template中添加/修改文件.

How do I add a new tab to the sales order view in Magento without modifying core code? I've seen a few tutorials on the web, but they want you to add/modify files in /app/design/adminhtml/default/default/template.

这是核心目录吗?当您安装插件时,它可以安装到这些目录吗?

Is this a core directory? When you install a plugin, can it install to these directories?

推荐答案

在许多方面,修改默认主题是错误的,因此我不建议这样做.

Modifying default theme is wrong in many ways, so I wouldn't recomment it.

如果此新标签页是扩展程序的一部分,则可以通过将其添加到adminhtml的布局更新文件中来插入自己的标签页.

If this new tab is a part of your extension, you can insert your own tab by adding it in your layout update file for adminhtml.

如果仍然没有这样的文件,则必须在config.xml中添加布局文件声明

If you still don't have such file, you have to add layout file declaration in your config.xml

<adminhtml>
    <layout>
        <updates>
            <my_extension>
                <file>my_extension.xml</file>
            </my_extension>
        </updates>
    </layout>
</adminhtml>

然后,您必须在/app/design/adminhtml/default/default/layout/中创建一个名为my_extension.xml的文件(如您在config.xml中声明的那样),其内容如下:

Then you have to create a file named my_extension.xml (as you declared it in config.xml) in /app/design/adminhtml/default/default/layout/ with the following content:

<?xml version="1.0"?>
<layout version="0.1.0">
    <adminhtml_sales_order_view>
        <reference name="sales_order_tabs">
            <action method="addTab"><name>my_tab</name><block>my_extension/Adminhtml_Sales_Order_View_Tab_Custom</block></action>
        </reference>
    </adminhtml_sales_order_view>
</layout>

但是请确保插入的块实现了Mage_Adminhtml_Block_Widget_Tab_Interface.

But make sure that the block you insert implements Mage_Adminhtml_Block_Widget_Tab_Interface.

更新:我已将答案编辑为对初学者更友好

UPDATE: I've edited answer to be more beginner-friendly

这篇关于销售订单视图上的“自定义"选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆