我的问题是当数据profil运行时,就像它根本没有拿起covert_adapter_category一样....我似乎无法看到什么错过了......任何想法?
数据流导入的输出:
Starting profile execution, please wait...
Warning: Please do not close the window during importing/exporting data
Starting Mage_Dataflow_Model_Convert_Adapter_Io :: load
Loaded successfully: "/opt/bitnami/apps/magento/htdocs/var/import/Categories.csv".
Starting Mage_Dataflow_Model_Convert_Parser_Csv :: parse
Method "parse" not defined in adapter catalog/convert_adapter_category.
Finished profile execution.
config.xml中:
<?xml version="1.0"?>
<config>
<modules>
<Import_Catalog>
<version>0.1.0</version>
</Import_Catalog>
</modules>
<global>
<models>
<catalog>
<rewrite>
<convert_adapter_category>Import_Catalog_Model_Convert_Adapter_Category</convert_adapter_category>
</rewrite>
</catalog>
</models>
</global>
</config>
protected $_stores;
/**
* Category display modes
*/
protected $_displayModes = array( 'PRODUCTS', 'PAGE', 'PRODUCTS_AND_PAGE');
public function parse()
{
$batchModel = Mage::getSingleton('dataflow/batch');
/* @var $batchModel Mage_Dataflow_Model_Batch */
$batchImportModel = $batchModel->getBatchImportModel();
$importIds = $batchImportModel->getIdCollection();
foreach ($importIds as $importId) {
//print '<pre>'.memory_get_usage().'</pre>';
$batchImportModel->load($importId);
$importData = $batchImportModel->getBatchData();
$this->saveRow($importData);
}
}
答案 0 :(得分:1)
您当前的config.xml
设置为使用您的实施Mage_Catalog_Model_Convert_Adapter_Category
重写Magento对Import_Catalog_Model_Convert_Adapter_Category
的定义。不幸的是,就我所见,Mage_Catalog_Model_Convert_Adapter_Category
实际上并不存在于Magento中。
我建议您更改config.xml
以为您的模型定义自己的类前缀,如下所示:
<config>
...
<global>
<models>
<customimport>
<class>Import_Catalog_Model</class>
</customimport>
</models>
</global>
...
</config>
然后编辑数据流配置文件,以便在实现逻辑后使用名为customimport/convert_adapter_category
的适配器。
答案 1 :(得分:1)