如何通过PHP SDK获取产品图片 [英] How to get Product images via PHP SDK

查看:78
本文介绍了如何通过PHP SDK获取产品图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Bigcommerce PHP库获取产品图片.我该怎么办?

I want to get the product images using the Bigcommerce PHP library. How would I do that?

$products=Bigcommerce::getProducts();
foreach($products as $product) {
    echo $product->name;
    echo $product->price;
}//here i retrieve price and name of products

推荐答案

以下代码将为您提供产品图片...

The following code will get you the product images...

$products=Bigcommerce::getProducts();
foreach($products as $product) {
echo $product->name;
echo $product->price;
echo $product->images[0]->image_file
}

echo $product->images[0]->image_file

将为您提供特定产品的第一张图片.为了获得多个图像,您需要遍历列表.要获取确切的网址,只需将您的store_url/product_images附加在image_file的开头.因此,确切的网址变为

will give you the first image for the specific product. In order to get more than one image, you would need to iterate through the list. To get the exact url, just append your store_url/product_images at the start of the image_file. So the exact url becomes

'https://store_url/product_images/'.$product->images[0]->image_file

请记住用您的商店链接替换"store_url".

Remember to replace "store_url" with your store link.

如果您需要其他帮助,请告诉我.

Let me know if you need any other assistance.

干杯:)

这篇关于如何通过PHP SDK获取产品图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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