如何更新“inventory_level"Bigcommerce 中 sku id 的产品? [英] How to update "inventory_level" of product by sku id in Bigcommerce?

查看:24
本文介绍了如何更新“inventory_level"Bigcommerce 中 sku id 的产品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更新产品的库存水平,但不幸的是没有成功.这是我的代码.我想更新产品的inventory_level"但允许这样做..

I am trying to update the inventory level of a products but unfortunately not getting success.Here is my code. I want to update product's "inventory_level" but enable to do so..

<?php

require "bigcommerce.php";
use Bigcommerce\Api\Client as Bigcommerce;


Bigcommerce::configure(array(
    'store_url' => 'https://store-nos85a.mybigcommerce.com/',
    'username' => 'admin',
    'api_key' => '4b7c4bba19f290a728e00be6ae7133cda71f477b'
    ));

Bigcommerce::setCipher('RC4-SHA');
Bigcommerce::verifyPeer(false);
            $product = Bigcommerce::getProduct(76); 
            print_r($product->skus);
                       foreach($product->skus as $sku)
                        {
                           
                            if($sku->id==5)
                                {
                              $fields = array("inventory_level"=>112);
                              Bigcommerce::updateProduct(76,$fields);
                                }
                            echo "id :  ".$sku->id;
                            echo " Invntory Level: ".$sku->inventory_level."<br/>";
                            echo " SKU : ".$sku->sku."<br/>";
                           
                        }
                                                    
           
?>

此处 Bigcommerce::updateProduct(76,$field); 不起作用.

推荐答案

我正在尝试做同样的事情(不同的编程语言).我呼吁得到他们的支持.看来您仍然必须引用 product_id.

I am trying to do the same thing (different programming language). I have a call into their support. It seems like you still must reference the product_id.

您不能仅通过 SKU 进行更新.您必须知道 product_id.我通过请求所有产品并将响应加载到数组(product_id、sku 等)中来解决这个问题.然后我通读数组,使用 SKU 从我们的系统中获取数量,并使用关联的 product_id 发布(PUT)inventory_level.

You cannot update simply by SKU. You must know the product_id. I got around this by requesting all products and loading the response into an array (product_id, sku, etc.). I then read thru the array, get the quantity from our system using the SKU, and post (PUT) the inventory_level using the associated product_id.

恕我直言,这对他们来说是一个巨大的疏忽.谁在乎网站上的 product_id 是什么?

IMHO this is a huge oversight on their part. Who cares what the product_id is on the website?

我要求提供一项允许按 SKU 进行更新的增强功能.

I have asked for an enhancement that allows updating by SKU.

这篇关于如何更新“inventory_level"Bigcommerce 中 sku id 的产品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆