php - How to add and update images or image url in Volusion using Volusion API -
actually have store importing products store product data insert , update image or image url not insert , update.
- this xml code name datapro.txt.
<products_joined> <productcode>3710_012t</productcode> <vendor_partno>eah5450silent/di/1gd3(lp)</vendor_partno> <productname>test product ta</productname> <hideproduct>n</hideproduct> <stockstatus>20</stockstatus> <lastmodified>1/5/2016 10:25:00 am</lastmodified> <lastmodby>2</lastmodby> <productweight>0.9</productweight> <productprice>100</productprice> <productmanufacturer>asus tek</productmanufacturer> <vendor_price>32.69</vendor_price> <numproductssharingstock>0</numproductssharingstock> <categoryids>107</categoryids> <producturl>http://tebkq.mvlce.servertrust.com/productdetails.asp?productcode=3710_012t</producturl> <photourl>http://tebkq.mvlce.servertrust.com/v/vspfiles/templates/tlztech/images/3710_012t.gif</photourl> <categorytree>new: parts , accessories</categorytree> </products_joined>
- this php script.
<?php $file = file_get_contents('datapro.txt', true); // create xml post webservice $xml_to_send = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"; $xml_to_send .= "<volusion_api>"; // $xml_to_send .= "<!--"; $xml_to_send .= $file; // $xml_to_send .= "\"\""; // $xml_to_send .= "-->"; $xml_to_send .= "</volusion_api>"; $url = "http://mysitedomian/net/webservice.aspx?login=xxxxxxxxxxx&encryptedpassword=xxxxxxxxx&import=insert-update"; // create header // post , return xml $ch = curl_init(); curl_setopt($ch, curlopt_url,$url); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_postfields, $xml_to_send); curl_setopt($ch, curlopt_httpheader, array("content-type:application/x-www-form-urlencoded; charset=utf-8", "content-action:volusion_api")); $data = curl_exec($ch); // check errors if (curl_errno($ch)){ print curl_error($ch); } else { curl_close($ch); } // display xml returned on browser echo $data; ?>
we can add images 2 methods, both manual not through api.
from admin side of volusion manually.
through ftp
ftp to:
vspfiles/photos
for more detail please click on below link.
http://adxmedia.com/articles/adding-images-to-your-volusion-store-products/
Comments
Post a Comment