【发布时间】:2023-03-07 00:09:01
【问题描述】:
我可以通过 Google Content API for Shopping 使用 PHP 语言在我的 Google Merchant Feed 中更新(更改为其他价格)产品销售价格。 p>
示例。 40% 折扣的产品(原价 = 100.00 欧元,售价 = 60.00 欧元):
$product = new Google_Service_ShoppingContent_Product();
$product->setOfferId($myProductId);
$product->setContentLanguage($idData[1]);
$product->setTargetCountry($idData[2]);
$product->setChannel($idData[0]);
$price = new Google_Service_ShoppingContent_Price();
$price->setValue(100.00);
$price->setCurrency('EUR');
$product->setPrice($price);
$salePrice = new Google_Service_ShoppingContent_Price();
$salePrice->setValue(60.00);
$salePrice->setCurrency('EUR');
$product->setSalePrice($salePrice);
我无法取消此折扣,我希望我的产品最终价格再次为 100.00 欧元。我试过了:
$product->setSalePrice(NULL);
但我遇到了一个致命错误:
参数 1 传递给 Google_Service_ShoppingContent_Product::setSalePrice() 必须是 Google_Service_ShoppingContent_Price 的实例
我也尝试将值设置为 0
$salePrice = new Google_Service_ShoppingContent_Price();
$salePrice->setValue(0.00);
$salePrice->setCurrency('EUR');
但 Google 不同意我的提议。
我该怎么做?
提前致谢
【问题讨论】:
标签: php google-api google-api-php-client google-shopping-api google-content-api