Doulat Khan Doulat Khan - 1 year ago 82
PHP Question

How to add and update categories 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 categories id is not insert and update.

  1. This is my XML code with name dataPro.txt.

<productname>Test Product TA</productname>
<lastmodified>1/5/2016 10:25:00 AM</lastmodified>
<productmanufacturer>ASUS TeK</productmanufacturer>
<categorytree>New: Parts and Accessories</categorytree>

  1. This my PHP script.

$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 {


// Display the Xml Returned on the Browser

echo $data;


Answer Source

Once you have products and categories already in your Volusion database, call the API and pass XML like this:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download