Magento:扩展社区模块

时间:2010-08-03 12:49:34

标签: magento

我想扩展一个社区模块的Unirgy_Dropship_Block_Adminhtml_Shipment_View类,它将Mage_Adminhtml_Block_Sales_Order_Shipment_View扩展到My_Bshipment_Block_Adminhtml_Shipment_View,下面是我的xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
 <modules>
  <My_Bshipment>
   <version>0.1.0</version>
  </My_Bshipment>
 </modules>
 <global>
  <models>
   <bshipment>
    <class>My_Bshipment_Model</class>
   </bshipment>
  </models>
        <resources>       
            <bshipment_setup>
                <setup>
                    <module>My_Bshipment</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </bshipment_setup>
            <bshipment_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </bshipment_write>
            <bshipment_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </bshipment_read>
        </resources>
  <blocks>
   <udropship>
    <rewrite>
     <adminhtml_shipment_view>My_Bshipment_Block_Adminhtml_Shipment_View</adminhtml_shipment_view>
    </rewrite>
   </udropship>
  </blocks>
 </global>
</config>

我的模块配置文件看起来像

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
      <My_Bshipment>
  <active>true</active>
  <codePool>local</codePool>
  <depends>
   <Unirgy_Dropship/>
   <Mage_Adminhtml/>
  </depends>
      </My_Bshipment>
    </modules>
</config>

请指出我的错误,不要叫我的班级

此致 SAURABH

1 个答案:

答案 0 :(得分:4)

快速查看,上面的配置将覆盖分组类名为

的块
udropship/adminhtml_shipment_view

<blocks>
    <udropship>
        <rewrite>
            <adminhtml_shipment_view>My_Bshipment_Block_Adminhtml_Shipment_View</adminhtml_shipment_view>
        </rewrite>
    </udropship>
</blocks>

但是,Magento从不使用此分组的类名创建块。它创建一个具有分组类名

的类
adminhtml/sales_order_shipment_view

让您的配置重写上面的分组类名,然后定义要扩展的类

Unirgy_Dropship_Block_Adminhtml_Shipment_View