How to import item images?

Comments

3 comments

  • Avatar
    Chris Muench

    You can only import via API.

    0
    Comment actions Permalink
  • Avatar
    bob

    Is there any documentation as to how exactly import images via the API?

    0
    Comment actions Permalink
  • Avatar
    Chris Muench

    here is an example of updating an item with id with one image

     

    //////////////////////////////////////////////////////////

    $api_base_url = 'http://localhost/phppos/PHP-Point-Of-Sale/index.php/api/v1/';

    $api_key = 'gks0c4g04okkg4004sgcgsw00w8wsgs8k0kck44k';

    ///////////////////////////////////////////////////////////




    $data[1] = 'http://phppos.com/logoRAW/LOGO_FOR_TRADEMARK.jpg';




    foreach($data as $item_id => $image_url)

    {

    //open connection

    $curl = curl_init();




    $post_data = json_encode(array('images' => array(array('image_url' => $image_url,'main_image' => TRUE))));

    //set the url, number of POST vars, POST data

    curl_setopt($curl, CURLOPT_URL, $api_base_url.'items/'.$item_id);

    curl_setopt($curl, CURLOPT_HTTPHEADER, array(

       'x-api-key:'.$api_key,

    'accept: application/json',

       ));

    curl_setopt($curl,CURLOPT_POST, 1);

    curl_setopt($curl,CURLOPT_POSTFIELDS, $post_data);




    //execute post

    curl_exec($curl);

    sleep(3);

    }
    0
    Comment actions Permalink

Please sign in to leave a comment.