Doulat Khan Doulat Khan - 29 days ago 13
PHP Question

How to add and update images or image url in Volusion using Volusion API

Actually I have a store I am importing products to my store all the product data is insert and update well but the only image or image URL is not insert and update.


  1. This is my XML code with 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 and Accessories</categorytree>
</Products_Joined>



  1. This my PHP script.



<?php
$file = file_get_contents('dataPro.txt', true);

// Create the Xml to POST to the 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 the Header

// Post and 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 for Errors
if (curl_errno($ch)){

print curl_error($ch);
} else {

curl_close($ch);
}

// Display the Xml Returned on the Browser

echo $data;

?>

Answer

We can add images by two methods, both are the manual not through API.

  1. From admin side of Volusion manually.

  2. 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/