如何覆盖选项卡相关的adminhtml

How to override tab related adminhtml

我需要覆盖此块 Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Related。

config.xml

<global>
        <blocks>
            <adminhtml>
                <rewrite>
                    <product_edit_tab_related>Company_Module_Block_Adminhtml_Product_Edit_Tab_Related</product_edit_tab_related>
                </rewrite>
            </adminhtml>
        </blocks>

    </global>

Related.php

class Company_Module_Block_Adminhtml_Product_Edit_Tab_Related extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Related
{


    /**
     * Prepare collection
     *
     * @return Mage_Adminhtml_Block_Widget_Grid
     */
    protected function _prepareCollection()
    {}
}

只需要覆盖 _prepareCollection 函数,但我不能。

你能帮帮我吗?

解决方案 1:- Related.php 应该是:-

<?php
class Company_Module_Block_Adminhtml_Catalog_Product_Edit_Tab_Related extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Related
{
   protected function _prepareCollection()
    {

    }
}