打破我的头;-)我对php使用了xmlrpc。
我得到了将此请求发送到服务器的指令:
'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") ,这将在第3006行生成一个错误: PHP致命错误:对/var/www/vhosts/sitename.com/httpdocs/openerp/xmlrpc.inc中非对象的成员函数serialize()的调用
但是,传递单个项目数组是可行的。
所以我不知道如何为多个产品创建一个数组,并将其转换为..
如有任何帮助,非常感谢!
谢谢,巴斯
发布于 2014-06-21 14:41:59
$order_line_items[] = new xmlrpcval(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")
),'struct');
$order_line_items[] = new xmlrpcval(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")
),'struct');
'lines' => new xmlrpcval($order_line_items, "array")希望能对你有所帮助
https://stackoverflow.com/questions/19834036
复制相似问题