Quantcast
Channel: Opinion: Shopify Community - Shopify APIs & SDKs
Viewing all articles
Browse latest Browse all 25503

can't upload images while creating a product with PHP by Dean

$
0
0

Hi ,  I'm learning to develop the shopify APP throgh examaple from here:http://www.shopify.com/partners/blog/17056443-how-to-generate-a-shopify-api-token#

Here is my code

$add_data = array(
    "product"=> array (
        "title"=>" My new product with image 1" ,
        "body_html"=> "<strong>Good snowboard!</strong>",
        "vendor"=> "Burton",
        "product_type"=>"Snowboard",
        "variants"=> array( array (
                            "option1"=> "First",
                            "price"=> "10.00",
                            "sku"=> "123",
                            "inventory_quantity"=> 100
                        ) ,
                        array ( "option1"=> "Second",
                                "price"=> "20.00",
                                "sku"=> "123" ,
                                "inventory_quantity"=> 200)
                        ),
            "images"=> array (array ( "src"=>"http://www.dhresource.com/albu_511171335_00-1.thumb/xiaomi-mi3-killer-android-cell-phone-htm.jpg&quot;)
                            )    
    )
);

$add_response = shopify_call($token, $shop, "/admin/products.json", $add_data, "POST");
var_dump(json_decode($add_response['response']));

Every data in the array is successful to be written ,while  "variants" and  "images" not .

Could anyone tell me why , please???

 


Viewing all articles
Browse latest Browse all 25503


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>