Actually i am trying to import products to my volusion store via Volusion API using PHP cURL method, the products are insert and update successfully but there is an issues with category and images. images and categories are not inserted.
When i open my admin the categories and images are not assign. Untill i assign by manual then it show on front end.
Anyone knows please help me. My code as under..
- My XML file..
<?xml version="1.0" encoding="utf-8"?>
<product>
<productcode>960BX2SSD1</productcode>
<upc_code>649528774156</upc_code>
<productmanufacturer>Crucial</productmanufacturer>
<category>SATA3</category>
<categorytree></categorytree>
<productprice>259</productprice>
<stockstatus>Y</stockstatus>
<productweight>0.25</productweight>
<length>0</length>
<width>0</width>
<height>0</height>
<photo_alttext>960BX2SSD1.JPG</photo_alttext>
<photourl>http://www.malabs.com/i/960BX2SSD1.JPG</photourl>
<productdescription><p><b>SpecificationS</b></p><ul><li><strong>Mfr Part Number:</strong> CT960BX200SSD1</li><li><strong>Capacity:</strong> 960 GB</li><li><strong>Form Factor:</strong>;</productdescription>
</product>
- 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://xxxxxxxxxxxxx/net/WebService.aspx?Login=xxxxxxxxxxxxx&EncryptedPassword=xxxxxxxxxxx&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;
?>
Where is the mistake that images and categories are missing.
category, categorytree and photourl are virtual columns and can't be imported, according to the Volusion documentation.
It does work using a CSV import, however it's not officially supported.
I've never used it before, but if your categories already exist in the admin and you're trying to assign new products to these categories, check out this documentation:
https://support.volusion.com/hc/en-us/articles/208850308-Product-Management-Categories-Products-Link-Developer-
I prefer to use the CSV import method. You're not limited to 100 records per transaction and you can insert/update the virtual fields like a list of category IDs. I start with whatever backend system I'm using, then dynamically generate a CSV file.