OSd*_*ave 10
假设您知道如何执行模块,以下是您需要执行的步骤:
布局更新:在管理员的xml布局文件中,您要"监听"管理员的订单视图呈现句柄并添加标签:
<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>
Run Code Online (Sandbox Code Playgroud)选项卡文件:我通常会尝试尊重Magento的文件夹结构,因此这个文件将位于app/code/local-or-community/YourNamespace/YourModule/Block/Adminhtml/Order/View/Tab/File.php中,并且将在最小:
<?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');
}
Run Code Online (Sandbox Code Playgroud).phtml文件,它必须遵守你在块的__construct()中指定的路径,并且应该具有如下内容:
<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>
Run Code Online (Sandbox Code Playgroud)希望有所帮助