【发布时间】:2015-06-14 10:58:35
【问题描述】:
我正在尝试使用 magento 1.9 中的 xmlrpc api 向商店添加产品列表。我已经创建了需要大量修补的产品,但我无法在产品的“团体价格”字段中添加行。
这是我的 productCreate 函数的当前版本:
public function productCreate(MagentoProduct $product)
{
$parameters = [
'simple',
'4', // attribute set
$product->sku,
[
'website_ids' => [2, 3, 4, 7],
'category_ids' => [7],
'name' => $product->name,
'description' => $product->description,
'short_description' => $product->short_description,
'weight' => $product->weight,
'url_key' => $product->url_key,
'url_path' => $product->url_path,
'price' => $product->price,
'tax_class_id' => $product->tax_class_id,
'meta_title' => $product->meta_title,
'meta_keyword' => $product->meta_keyword,
'meta_description' => $product->meta_description,
'status' => 1,
'group_price' => [
'website_id' => 1,
'cust_group' => 2,
'price' => '100.0',
],
]
];
return $this->client->call('product.create', $parameters);
}
我尝试使用数量为 0 或 1 的层级价格,但它们保存到了错误的表中。如果我通过 xmlrpc api 检索一些现有产品,那么我确实会在没有任何数量的层级价目表中获得组价格,但以这种方式创建它们是行不通的。
在上面的函数中,我在(未记录的)group_price 字段中设置值。我现在得到的错误是:
'fXmlRpc\Exception\ResponseException' 带有消息'Dubbele website groep prijs klantengroep。'
翻译为:
重复的网站组价格客户组。
有人知道设置团价的正确方法吗?
【问题讨论】:
标签: php magento xml-rpc magento-1.9