我想使用Bigcommerce PHP庫獲取產品圖像。我會怎麼做?如何通過PHP SDK獲取產品圖像
$products=Bigcommerce::getProducts();
foreach($products as $product) {
echo $product->name;
echo $product->price;
}//here i retrieve price and name of products
我想使用Bigcommerce PHP庫獲取產品圖像。我會怎麼做?如何通過PHP SDK獲取產品圖像
$products=Bigcommerce::getProducts();
foreach($products as $product) {
echo $product->name;
echo $product->price;
}//here i retrieve price and name of products
從代碼看來,它看起來像getProductImages尚未實現。我添加了一個快速補丁。
$images = Bigcommerce::getProductsImages(243);
print_r($images)
下面的代碼將讓你的產品圖片...
$products=Bigcommerce::getProducts();
foreach($products as $product) {
echo $product->name;
echo $product->price;
echo $product->images[0]->image_file
}
- 如果它尚未(https://github.com/bigcommerce/bigcommerce-api-php/pull/61)
的代碼看起來是這樣的合併,透過這個下拉請求該行
echo $product->images[0]->image_file
將爲您提供特定產品的第一張圖片。爲了獲得多個圖像,您需要遍歷列表。要獲得確切的url,只需在image_file的開頭附加您的store_url/product_images。所以確切的網址變成
'https://store_url/product_images/'.$product->images[0]->image_file
請記住用您的商店鏈接替換「store_url」。
讓我知道你是否需要任何其他幫助。
乾杯:)
看看這個答案 http://stackoverflow.com/questions/17698921/get-image-url-from-bigcommerce-api-with-php – Saran