“101:产品不存在。” (Magento API)product.update

"101: Product not exists." (Magento API) product.update

我看到了 documentation 但我仍然没有在我的代码中找到错误。

我正在尝试将 excel 文件中的产品添加到 Magento 系统,然后 在每个商店视图中更新它(多语言商店)。

为此,我完成了以下 PHP 脚本。在这段代码中,我只读取了一个 Excel 行(只是为了向您展示它是如何工作的)然后我将它添加到 Magento(实际上是 working)然后我正在尝试更新内容(出现 错误 )。请注意 $col[9] 是保存 SKU 的变量。

注意:我使用的是 SOAP,但不是 V2。

$rowdata=$sheet->rangeToArray('A' . $row.':'.$maxcol . $row, NULL, TRUE, FALSE);
$col=$rowdata[0];
//$soap is the client. $session_id is the logged in SOAP session.
$attributeSets = $soap->call($session_id, 'product_attribute_set.list');
$attributeSet = current($attributeSets);
$result = $soap->call($session_id, 'catalog_product.create', array('simple',     $attributeSet['set_id'], $col[9], array(
    'categories' => array(2),
    'websites' => array(1),
    'name' => $col[1],
    'description' => $col[10],
    'short_description' => $col[13],
    'weight' => '10',
    'status' => '1',
    'url_key' => 'product-url-key',
    'url_path' => 'product-url-path',
    'visibility' => '4',
    'price' => $col[20],
    'tax_class_id' => 1,
    'meta_title' => 'Product meta title',
    'meta_keyword' => 'Product meta keyword',
    'meta_description' => 'Product meta description'
)));
var_dump ($result);
$updatearray=  array(
    'name' => $col[2],
    'description' => $col[11],
    'short_description' => $col[14]
);
$update = $soap->call($session_id, 'catalog_product.update',    array($col[9], $updatearray, 'fr'));
var_dump ($update);

如果你们能提供任何帮助,我将不胜感激!

我刚刚找到了这个问题的 修复方法,但它确实没有意义。

因此,当我们通过电话发送 SKU 时,我们需要额外发送 space。这意味着 $update 需要像这样:

 $soap->call($session_id, 'catalog_product.update',    array($col[9].' ', $updatearray, 'fr'));