2011-04-26 141 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。

这是适合我的!