【问题标题】:"101: Product not exists." (Magento API) product.update“101:产品不存在。” (Magento API)product.update
【发布时间】:2016-06-10 18:46:31
【问题描述】:

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

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

为此,我完成了以下 PHP 脚本。在这段代码中,我只读取了一个 Excel 行(只是为了向您展示它是如何工作的),然后我将它添加到 Magento(实际上这是工作),然后我正在尝试更新东西(给出错误)。请注意,$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);

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

【问题讨论】:

    标签: php excel soap magento-1.9


    【解决方案1】:

    我刚刚找到了解决这个问题的修复,但这真的没有意义。

    所以,当我们通过电话发送 SKU 时,我们需要额外发送一个空格。这意味着 $update 需要是这样的:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-02-24
      • 2016-11-28
      • 2017-04-29
      • 1970-01-01
      • 1970-01-01
      • 2010-10-28
      • 1970-01-01
      相关资源
      最近更新 更多