Open eMatsiyana opened 11 years ago
This is completely untested, but try adding this to a line at the top of your PHP file:
use Bigcommerce\Api\Resource\ProductImage as ProductImage;
Whats the correct way to upload/insert images to product. Is possible through this api???
$image = $fields["images"]; BigCommerce_Api::createResource( '/products/' . $productId . '/images', $image );
As per the API, images, among other properties, are Read Only, and cannot be created with the Product Resource. You simply need to specify these Read-Only Resources as their own API calls.
I have been trying to upload Product images through the API without Success. The Code below states that, the images field can not be writen to and i get the 400 error..
$fields = array( "product_id" => "$prodid", "images" => array("image_file" => "$image")); $apiresult=BigCommerce_Api::updateProduct($prodid, $fields);
So i tried the code below.
$image = new Bigcommerce_Api_ProductImage(); $image->product_id = $prodid; $image->image_file = $image; // etc.. $image->create();
Which then says the Class 'ProductImage' not found.
Is this a namespace issue?