如何在“销售订单管理"页面中添加标签? [英] How do I add a tab to the Sale Order Admin Page?

查看:114
本文介绍了如何在“销售订单管理"页面中添加标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在magento的管理员中向订单页面添加自定义标签.有没有一种方法可以通过简单的覆盖来实现?

I want to add a custom tab to the order page in the admin of magento. Is there a way to do this with a simple override?

推荐答案

假设您知道如何做一个模块,下面是您需要执行的步骤:

Assuming you know how to do a module, here are the steps you need to perform:

  1. 布局更新:要在管理员的xml布局文件中收听"管理员的订单视图呈现句柄并添加标签:

  1. layout update: in your admin's xml layout file you want to "listening" to the admin's order view rendering handle and add your tab:

<layout>
    <adminhtml_sales_order_view>
        <reference name="sales_order_tabs">
            <action method="addTab"><name>the_name_of_your_tab</name><block>the_block_alias_of_your_module/path_to_your_tab_file</block></action>
        </reference>
    </adminhtml_sales_order_view>
</layout>

  • 标签文件:我通常会尝试遵循Magento的文件夹结构,因此该文件位于 app/code/local-or-community/YourNamespace/YourModule/Block中/Adminhtml/Order/View/Tab/File.php ,并且至少具有:

  • the tab file: I generally try to respect Magento's folder structure, so this file would be in app/code/local-or-community/YourNamespace/YourModule/Block/Adminhtml/Order/View/Tab/File.php and will have at least:

    <?php
    class YourNamespace_YourModule_Block_Adminhtml_Order_View_Tab_File
        extends Mage_Adminhtml_Block_Template
        implements Mage_Adminhtml_Block_Widget_Tab_Interface
    {
        protected $_chat = null;
    
        protected function _construct()
        {
            parent::_construct();
            $this->setTemplate('yourmodule/order/view/tab/file.phtml');
        }
    
        public function getTabLabel() {
            return $this->__('Tab label');
        }
    
        public function getTabTitle() {
            return $this->__('Tab title');
        }
    
        public function canShowTab() {
            return true;
        }
    
        public function isHidden() {
            return false;
        }
    
        public function getOrder(){
            return Mage::registry('current_order');
        }
    

  • .phtml文件,该文件必须遵守您在块的__construct()中指定的路径,并且应具有以下内容:

  • The .phtml file, which has to respect the path you specified in the block's __construct(), and should hace something like:

    <div class="entry-edit">
        <div class="entry-edit-head">
            <h4><?php echo $this->__('a title'); ?></h4>
        </div>
        <div class="fieldset fieldset-wide">
            the content you want to show
        </div>
    </div>
    

  • 希望有帮助

    这篇关于如何在“销售订单管理"页面中添加标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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