1

我正在尝试使用 datapump api 创建可配置的产品。我可以创建简单的产品。但我无法创建/链接可配置产品。这是我的数据数组。我错过了什么吗?

Array(['type'] => 'simple',['sku'] => 'A001-2',['price'] => 10,['color'] => 'Blue',['qty'] => 100,['is_in_stock'] => 1,['name'] => 'A001-2',['tax_class_id'] => 1,['store'] => 'admin',)

Array(['type'] => 'simple',['sku'] => 'A001-1',['price'] => 10,['color'] => 'Indigo',['qty'] => 100,['is_in_stock'] => 1,['name'] => A001-1,['tax_class_id'] => 1,['store'] => admin,)

Array(['type'] => 'configurable', ['sku'] => 'A001',['name'] => 'TREAD JEANS',['description'] => 'Latest Edition of gunshot jeans',['price'] => 55.5,['simples_skus'] => 'A001-2,A001-1',['configurable_attributes'] => 'color',['qty'] => 100,['is_in_stock'] => 1,['tax_class_id'] => 1,)
4

3 回答 3

0

据我所知,您缺少强制性attribute_set数据。尝试为您的项目定义属性集并重新导入。

于 2013-04-24T14:17:54.847 回答
0

最后我自己找到了解决方案。由于我不使用 csv 文件导入,我不得不从“plugins.conf”文件中删除 Magmi_CSVDataSource。现在我的数据源是这样的

[PLUGINS_DATASOURCES]
class = ""

以前是这样的

[PLUGINS_DATASOURCES]
class = "Magmi_CSVDataSource"

这对我有用。现在我可以使用数据泵导入可配置产品。

于 2013-04-25T05:48:41.553 回答
0

我看到你已经实现了它的修改plugins.conf。你也可以在没有修改的情况下做到这一点。这是一个示例代码:

<?php
// assuming that your script file is located in magmi/integration/datapump/product.php,
// include "magmi_defs.php" , once done, you will be able to use any magmi includes without specific path.
require_once("../../inc/magmi_defs.php");
//Datapump include
require_once("../inc/magmi_datapump.php");

// create a Product import Datapump using Magmi_DatapumpFactory
$dp=Magmi_DataPumpFactory::getDataPumpInstance("productimport");

$dp->beginImportSession("default","create");
$newProductData = array(
    'type'          => 'simple',
    'sku'           => "A001-2",
    'qty'           => 1000,
    'color'         => 'Blue',
    'price'         => 10,
    'name'          => 'A001-2',
    'tax_class_id'  => 1,
    'is_in_stock'   => 1,
    'store'         => 'admin'
);
$dp->ingest($newProductData);

$newProductData = array(
    'type'          => 'simple',
    'sku'           => "A001-1",
    'qty'           => 1000,
    'color'         => 'Indigo',
    'price'         => 10,
    'name'          => 'A001-1',
    'tax_class_id'  => 1,
    'is_in_stock'   => 1,
    'store'         => 'admin'
);
$dp->ingest($newProductData);

$newProductData = array(
    'type'          => 'configurable',
    'sku'           => "A001",
    'qty'           => 1000,
    'price'         => 10,
    'simples_skus'  => 'A001-2,A001-1',
    'configurable_attributes' => 'color',
    'name'          => 'TREAD JEANS',
    'tax_class_id'  => 1,
    'is_in_stock'   => 1,
    'store'         => 'admin'
);
$dp->ingest($newProductData);
$dp->endImportSession();
?>

不要忘记启用Configurable Item processor使用 magmi UI。

于 2016-02-15T20:08:44.013 回答