我正在尝试更新产品的库存水平,但不幸的是没有成功。这是我的代码。我想更新产品的“inventory_level”,但可以这样做..
<?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);
不工作。