How do I add a tab to the Sale Order Admin Page?

前端 未结 1 1245
鱼传尺愫
鱼传尺愫 2021-01-19 07:29

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?

1条回答
  •  梦谈多话
    2021-01-19 07:55

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

    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:

      
          
              
                  the_name_of_your_tabthe_block_alias_of_your_module/path_to_your_tab_file
              
          
      
      
    2. 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:

      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');
          }
      
    3. The .phtml file, which has to respect the path you specified in the block's __construct(), and should hace something like:

      __('a title'); ?>

      the content you want to show

    Hope That Helps

    0 讨论(0)
提交回复
热议问题