1

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.

<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;
  
?>
Doulat Khan
  • 493
  • 5
  • 24

1 Answers1

1

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

<xmldata>
  <Categories_Products_Link>
    <CategoryID>10</CategoryID>
    <ProductID>20</ProductID>
  </Categories_Products_Link>
</xmldata>
Phil S
  • 179
  • 2
  • Thank u so much bro. can u tell me that are we able that we can add image url to products. – Doulat Khan Nov 08 '16 at 09:37
  • In our store, we have several photos for each product, so I don't use those product image fields. There are two ways to upload the images this way ........ either upload the images in the admin, or upload them directly to volusion using SFTP. – Phil S Nov 08 '16 at 15:39