Reputation: 157
I want to create product in bigcommerce store using bigcommerce Api. Following code works fine to create product in Bc store
$product = array('name' => 'ABC Blocks', 'type' => 'physical', 'price' => '19.99', 'weight' => 2.3, 'categories' => array(26), 'availability' => 'available', 'is_visible' => true));
Bigcommerce_Api::createProduct($product);
How can I pass images url ? I am trying following codes but unable to create
$image = array('image_file'=>'https://developer.bigcommerce.com/assets/hero-image.png','is_thumbnail'=>false,'sort_order'=>1,'description'=>'');
$product = array('name' => 'ABC Blocks', 'type' => 'physical', 'price' => '19.99', 'weight' => 2.3, 'categories' => array(26), 'availability' => 'available', 'is_visible' => true,'images' => array('image_file' => $image));
Bigcommerce_Api::createProduct($product);
Any help will be greatly appreciated!!thanks
Upvotes: 4
Views: 514
Reputation: 232
Here's an example structure from the api about how primary image data should look.
"primary_image": {
"id": 247,
"zoom_url": "https://cdn.url.path/bcapp/et7xe3pz/products/32/images/247/in_123__14581.1393831046.1280.1280.jpg?c=1",
"thumbnail_url": "https://cdn.url.path/bcapp/et7xe3pz/products/32/images/247/in_123__14581.1393831046.220.290.jpg?c=1",
"standard_url": "https://cdn.url.path/bcapp/et7xe3pz/products/32/images/247/in_123__14581.1393831046.386.513.jpg?c=1",
"tiny_url": "https://cdn.url.path/bcapp/et7xe3pz/products/32/images/247/in_123__14581.1393831046.44.58.jpg?c=1"
}
Use this to figure out your array structure.
Upvotes: 1