打破我的头;-)我正在使用xmlrpc for php ..
我得到了将此请求发送到服务器的说明:
'lines':[{'product_cod':'ZOIX333','qty':1.0,'price_unit':366.00,'discount_pct':0.0,'taxes':33.00,'tax_included':True}], #{...},{},{}]
所以我尝试了:
$order_line_items = array(
array(
'product_cod' => new xmlrpcval('ZWWX4135', "string") ,
'qty' => new xmlrpcval('1.0', "string") ,
'price_unit' => new xmlrpcval('166.00', "string") ,
'discount_pct' => new xmlrpcval('0.0', "string") ,
'taxes' => new xmlrpcval('16.44', "string") ,
'tax_included' => new xmlrpcval('true', "string")
),
array(
'product_cod' => new xmlrpcval('ZWWX4136', "string") ,
'qty' => new xmlrpcval('1.0', "string") ,
'price_unit' => new xmlrpcval('176.00', "string") ,
'discount_pct' => new xmlrpcval('0.0', "string") ,
'taxes' => new xmlrpcval('17.44', "string") ,
'tax_included' => new xmlrpcval('true', "string")
)
);
然后将其添加到 xmlrpc 请求中:
'lines' => new xmlrpcval($order_line_items, "struct") ,
这会产生一个错误:PHP Fatal error: Call to a member function serialize() on a non-object in /var/www/vhosts/sitename.com/httpdocs/openerp/xmlrpc.inc on line 3006
但是,传递单个项目数组是可行的。
所以我不知道如何为多个产品创建一个数组并将其转换..
任何帮助都非常感谢!
谢谢,巴斯