简体   繁体   中英

Get image url from BigCommerce API with PHP

Can anybody help me to retrieve Image URL for a BigCommerce Product in PHP? I tried with Bigcommerce::getProductImages($product->id); but it doesn't helps. I hope the API gets updated in latest version. Pls suggest an exact solution. Thanks in advance.

From the code, it looks like the getProductImages has not been implemented. I added a quick patch. Use this pull request if it has not been merged yet ( https://github.com/bigcommerce/bigcommerce-api-php/pull/61 )

The code looks like this -

$images = Bigcommerce::getProductsImages(243);
print_r($images)

when iterating thru products you can grab the product ID and loop through this:

$images = BigCommerce_Api::getCollection('/products/'.$productID.'/images');

    foreach($images as $image) {
        $curImage=$image->image_file;
            echo '<img src="'.$storeURL.'/product_images/'.$curImage.'"/>';
        }

hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM