1
實際上,我有一個商店,我正在將商品導入到我的商店,所有產品數據都插入並更新得很好,但唯一的類別ID不是插入和更新。如何使用Volusion API在Volusion中添加和更新類別
- 這是我的名爲dataPro.txt的XML代碼。
<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>
- 這是我的PHP腳本。
<?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;
?>
感謝ü這麼多兄弟。你能告訴我,我們可以將圖片網址添加到產品中。 –
當然,我把我的意見在這裏 http://stackoverflow.com/questions/40398298 –
在我們的商店,我們有每個產品的幾張照片,所以我不使用這些產品圖像領域。以這種方式上傳圖像有兩種方法........要麼在管理員中上傳圖像,要麼使用SFTP直接將圖像上傳到恍惚中。 –