【问题标题】:Magento event observer for bulk import for products用于批量导入产品的 Magento 事件观察者
【发布时间】:2011-09-05 15:34:48
【问题描述】:

是否有“批量导入产品/客户”的活动?

我打算为我的供应商制作一个模块,以通过后端以 xml/csv 格式上传他们的产品信息。当他们上传时,我需要更新我的 Solr 记录。

感谢

【问题讨论】:

  • 什么是“批量导入产品/客户”?你是说系统 -> 导入/导出工具吗?
  • 是的...我需要一种在后端缓存此“导入/导出”工具的方法。

标签: events magento observer-pattern


【解决方案1】:

您可以将 Mage_Catalog_Model_Convert_Adapter_Product::saveRow() 覆盖为:
1> 在 config.xml 中

<global>
    <models>
...
        <catalog>
            <rewrite>
                <!-- Override Mage_Catalog_Model_Convert_Adapter_Product -->
                <convert_adapter_product>MagePsycho_Productimport_Model_Convert_Adapter_Product</convert_adapter_product>
            </rewrite>
        </catalog>
...
    </models>
</global>

2> 创建类文件为

class MagePsycho_Productimport_Model_Convert_Adapter_Product extends Mage_Catalog_Model_Convert_Adapter_Product
{    
    public function saveRow(array $importData)
    {
      parent::saveRow($importData);
      //do your extra stuffs here..
    }
}

注意:这只是一个想法,您需要自己开发完整的工作模块。

谢谢
问候
法师心理

【讨论】:

  • 谢谢魔法师。这个想法奏效了。尽管我也必须覆盖其他几个模型。 :)
猜你喜欢
  • 2013-03-23
  • 2016-05-05
  • 1970-01-01
  • 1970-01-01
  • 2014-07-15
  • 1970-01-01
  • 1970-01-01
  • 2016-09-19
  • 2014-07-09
相关资源
最近更新 更多