简体   繁体   English

Prestashop创建订单API

[英]Prestashop Create Order API

i try to create an API connection so i can create orders in Prestashop via API, in their DOC: http://doc.prestashop.com/download/attachments/720902/CRUD+Tutorial+EN.pdf?version=1&modificationDate=1301486324000 我尝试创建一个API连接,这样我就可以在他们的DOC中通过API在Prestashop中创建订单: http ://doc.prestashop.com/download/attachments/720902/CRUD+Tutorial+EN.pdf?version = 1&modificationDate = 1301486324000

there is no information about creating orders, and when i try to create something myself everything fails: 没有关于创建订单的信息,当我尝试创建自己的东西时,一切都失败了:

$xml = $webService->get(array('url' => 'http://mysite.com/prestashop/api/orders?schema=synopsis'));

$resources = $xml -> children() -> children();
$resources->children()->id_address_delivery = 1;
$resources->children()->id_address_invoice = 1;
$resources->children()->id_cart = 1;
$resources->children()->id_currency = 1;
$resources->children()->id_lang = 2;
$resources->children()->id_customer = 1;
$resources->children()->id_carrier = 2;
$resources->children()->total_paid = '1';
$resources->children()->total_paid_real = '1';
$resources->children()->total_products = 1;
$resources->children()->total_products_wt = 1;
$resources->children()->conversion_rate = 0.1;

$resources->children()->module = 'cheque';
$resources->children()->payment = 'Cheque';

$xml = $webService->add(array('resource' => 'orders',
'postXml' => $resources->asXML()
));

Gives errors etc, does somebody here has proper documentation available? 给出错误等,这里有人有适当的文档吗? Or a script which runs in making simple orders? 还是一个在制作简单订单时运行的脚本?

You need to get the schema then foreach the lines returned, or just supply the values manually. 您需要获取架构然后预先返回返回的行,或者只是手动提供值。

here is a sample of getting the schema of the selected method. 这是获取所选方法的模式的示例。

$xml = $webService -> 
  get(array('url' => 'http://mysite.com/prestashop/api/customers?schema=blank'));

You need to create Customer , Address , Cart and finally Order . 您需要创建客户地址购物车和最终订单 And before creating an order you must have products in the cart and must set id_address_delivery & id_address_invoice. 在创建订单之前,您必须在购物车中包含产品,并且必须设置id_address_delivery和id_address_invoice。

You can read more details on my blog PrestaShop web service create order errors 您可以在我的博客上阅读更多详细信息PrestaShop Web服务创建订单错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM