Magento覆盖块使块消失

时间:2013-06-07 21:14:13

标签: magento

所以我重写了一个添加了一些标签的块。我要做的就是删除几个标签。但是,即使我的代码中的die()杀死了所有东西(所以它被调用),我得到一个空白点,其中的选项卡曾经是。这是代码:

config.xml中:

<global>
        <blocks>
            <affiliateplusext>
                <class>Blizzardlabs_Affiliateplusext_Block</class>
            </affiliateplusext>                
            <affiliateplusstatistic>
                <rewrite>
                    <frontend_diagrams>Blizzardlabs_Affiliateplusext_Block_Frontend_Diagrams</frontend_diagrams>
                </rewrite>
            </affiliateplusstatistic>
        </blocks>
</global>

他们的布局文件:

class Magestore_Affiliateplusstatistic_Block_Frontend_Diagrams extends Mage_Adminhtml_Block_Widget_Tabs
{
    public function __construct(){
        parent::__construct();
        $this->setId('diagram_tab');
        $this->setDestElementId('diagram_tab_content');
        $this->setTemplate('affiliateplusstatistic/widget/tabshoriz.phtml');
    }

    protected function _prepareLayout(){
        $this->addTab('sales',array(
            'label'     => $this->__('Sales Amount'),
            'content'   => $this->getLayout()->createBlock('affiliateplusstatistic/frontend_diagrams_sales')->toHtml(),
            //'active'  => true,
        ));

        $this->addTab('transactions',array(
            'label'     => $this->__('Transactions'),
            'content'   => $this->getLayout()->createBlock('affiliateplusstatistic/frontend_diagrams_transactions')->toHtml(),
        ));

        $this->addTab('commissions',array(
            'label'     => $this->__('Commissions'),
            'content'   => $this->getLayout()->createBlock('affiliateplusstatistic/frontend_diagrams_commissions')->toHtml(),
        ));

        $this->addTab('clicks',array(
            'label'     => $this->__('Clicks'),
            'content'   => $this->getLayout()->createBlock('affiliateplusstatistic/frontend_diagrams_clicks')->toHtml(),
        ));

        $this->addTab('impressions',array(
            'label'     => $this->__('Impressions'),
            'content'   => $this->getLayout()->createBlock('affiliateplusstatistic/frontend_diagrams_impressions')->toHtml(),
        ));

        $this->setChild('totals',$this->getLayout()->createBlock('affiliateplusstatistic/frontend_diagrams_totals'));
        $this->setChild('filters',$this->getLayout()->createBlock('affiliateplusstatistic/frontend_filters'));

        return parent::_prepareLayout();
    }
}

我的布局文件:

<?php
class Blizzardlabs_Affiliateplusext_Block_Frontend_Diagrams extends Magestore_Affiliateplusstatistic_Block_Frontend_Diagrams
{
    protected function _prepareLayout(){
        $this->addTab('sales',array(
            'label'     => $this->__('Sales Amount'),
            'content'   => $this->getLayout()->createBlock('affiliateplusstatistic/frontend_diagrams_sales')->toHtml(),
            'active'    => true,
        ));
//      
//      $this->addTab('transactions',array(
//          'label'     => $this->__('Transactions'),
//          'content'   => $this->getLayout()->createBlock('affiliateplusstatistic/frontend_diagrams_transactions')->toHtml(),
//      ));
//      
//      $this->addTab('commissions',array(
//          'label'     => $this->__('Commissions'),
//          'content'   => $this->getLayout()->createBlock('affiliateplusstatistic/frontend_diagrams_commissions')->toHtml(),
//      ));
//      
//
//        
//        $this->setChild('totals',$this->getLayout()->createBlock('affiliateplusstatistic/frontend_diagrams_totals'));
//        $this->setChild('filters',$this->getLayout()->createBlock('affiliateplusstatistic/frontend_filters'));

        return parent::_prepareLayout();
    }
}

没有错误或日志。请帮忙!

1 个答案:

答案 0 :(得分:1)

我不确定布局xml的操作顺序..但是我知道我已经从设计文件夹中的local.xml中删除了其他模块的标签,如下所示:

<module_controller_action> <!-- **(Direct accordingly) -->
    <reference name="the_specific_tabs_block_name">
        <action method="removeTab"><name>transactions</name></action>
    </reference>
</module_controller_action>

比制作课程和扩展原作更好。 (如果有效)

祝你好运。