How to add a tab to the sales order admin page?

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

+4
source share
1 answer

Assuming you know how to make a module, follow these steps:

  • layout update . In your xml admin layout file, you want to β€œlisten” to the render handler of the administration order submission and add your own 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> 
  • tab file . I usually try to respect the Magento folder structure, so this file will be in the application / 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'); } 
  • A .phtml file that should respect the path you specify in the __construct () block and should have 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> 

Hope this helps

+9
source

All Articles