简体   繁体   English

如何使用Volusion API在Volusion中创建新类别

[英]How to create new categories in Volusion using Volusion API

Actually I have a store and importing products and categories both from my vendor store to my store, the products are inserted and updated successfully but the categories are not inserted and updated. 实际上我有一个商店并从我的供应商商店到我的商店导入产品和类别,产品已成功插入和更新,但未插入和更新类别。

I want to create/add new category through API. 我想通过API创建/添加新类别。

My category.txt file. 我的category.txt文件。

 <?xml version="1.0"?> <Volusion_API> <Categories_Products_Link> <CategoryID>107</CategoryID> <ProductID>63015</ProductID> </Categories_Products_Link> </Volusion_API> 

Here is my cURL script of Importing. 这是我的导入cURL脚本。

 <?php $file = file_get_contents('category.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; ?> 

Just remove the following from your category.txt this 只需从您的category.txt中删除以下内容即可

 <?xml version="1.0"?> <Volusion_API></Volusion_API> 

Because it is already defined in your cURL script, and Volusion API not support double defined tags. 因为它已经在您的cURL脚本中定义,并且Volusion API不支持双重定义的标记。

Remove the above and pass to your cURL script and run the cURL script it will work. 删除上面的内容并传递给您的cURL脚本并运行它将起作用的cURL脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM