繁体   English   中英

Magento Custom Module创建以覆盖私有函数中的行

[英]Magento Custom Module creation to overwrite a line in a private function

我正在创建一个自定义模块,作为对Magento Core中一段代码的补丁修复。 我要使用的私有功能是

 protected function _prepareExport()

这是我要使用的此功能部分:

 foreach ($dataRows as $productId => &$productData) {
            foreach ($productData as $storeId => &$dataRow) {
                if ($defaultStoreId != $storeId) {
                    $dataRow[self::COL_SKU]      = null;
                    $dataRow[self::COL_ATTR_SET] = null;
                    $dataRow[self::COL_TYPE]     = null;
                } else {
                    $dataRow[self::COL_STORE] = null;
                    $dataRow += $stockItemRows[$productId];
                }

特别:

 $dataRow += $stockItemRows[$productId];

这是我的自定义模块:

class Gfore_ImportExport_Model_Export_Entity_Product extends 
  Mage_ImportExport_Model_Export_Entity_Product
   {

     protected function _prepareExport()
     {
        $dataRow = array_merge($dataRow,$stockItemRows[$productData]);
     }


}

我的问题是:我可以像这样简单地覆盖那一行吗? 还是我需要更具体。

解决方案1:-

您是否在自定义模块config.xml文件中使用过?

您的config.xml标记应如下所示:-

<models>
      <importexport>
        <class>Gfore_ImportExport_Model</class>
        <resourceModel>importexport_mysql4</resourceModel>
      </importexport>
       <importexport>
                <rewrite>
                    <export_entity_product>Gfore_ImportExport_Model_Export_Entity_Product</export_entity_product>
                </rewrite>
      </importexport>
    </models>

2-在Magento 1.9中,新订单电子邮件未收到。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM