【问题标题】:Cannot set group price on new magento products from the xml-rpc api无法从 xml-rpc api 为新的 magento 产品设置组价
【发布时间】: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


    【解决方案1】:

    magento 似乎不支持在其 api 中更新团体价格。

    您必须为此创建自己的 api。

    阅读: https://magento.stackexchange.com/questions/56481/use-api-v2-to-work-with-customer-group-prices

    还有这个

    How to update group price via SOAP api

    【讨论】:

    • 您能否在答案中提供有关如何实现这一点的主要细节,并提供链接作为附加参考。如果这些链接破坏了您的答案,那么您的答案将毫无价值。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-29
    • 1970-01-01
    相关资源
    最近更新 更多