2011-04-26 199 views
1

我正在使用Magento的核心API創建目錄產品。它在Magento 1.4.1.1版本上正常工作,但相同的代碼在Magento ver 1.5.0.1上不起作用。Magento API版本不兼容

這裏是我的代碼:

require 'rubygems' 
require 'soap/wsdlDriver' 

WSDL_URL = 'http://example.code/api/v2_soap/?wsdl=1' 


soap = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver 

session = soap.login('theuser','theuser123') 

data = { "name" => "BARRACUDA", "description" => "fill", "short_description" => "fill", "weight" => "12", "status" => 1, "visibility" => 4, "price" => 350.00 , "tax_class_id" => "2", "qty" => 10, "stock_availability" => "0", "category_ids" => [3] } 

a1 = soap.call('catalogProductCreate',session,"simple",1,"black: ONT-920-B",data) 

有任何問題,我的代碼,或任何加入的Magento版本1.5.0.1新的東西?

感謝

+1

你對API請求有什麼反應? – 2011-04-26 12:51:41

回答

1

問題是缺少日期字段一個屬性

data = { "name" => "BARRACUDA", "description" => "fill", "short_description" => "fill", "weight" => "12", "status" => 1, "visibility" => 4, "price" => 350.00 , "tax_class_id" => "2", "qty" => 10, "stock_availability" => "0", "category_ids" => [3], "websites" => [1] } 

需要提及的數據陣列中的網站ID在Magento 1.5。

這是適合我的!