Magento API版本不兼容

时间:2011-04-26 11:40:34

标签: magento

我正在使用Magento的核心API创建目录产品。它适用于Magento 1.4.1.1版,但相同的代码不适用于Magento ver 1.5.0.1。

这是我的代码:

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 个答案:

答案 0 :(得分: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] }

需要在magento 1.5中的数据数组中提及网站ID。

这对我有用!