在Prestashop API上创建订单:模块名称出错

问题描述:

我试图通过Prestashop API(v1.6.1.13)创建订单。我没有写任何模块,我的目标只是使用它的API而不在prestashop上安装任何东西。在Prestashop API上创建订单:模块名称出错

创建订单需要模块名称。如果我留空我得到的错误:

Validation error: "Property Order->module is empty"

如果我写它说一个假名字:

Validation error: "Property Order->module is not valid"

我该怎么办?虽然我与付款字段有同样的问题?

这里是我送:

<prestashop> 
<order> 
    <id_address_delivery>1299</id_address_delivery> 
    <id_address_invoice>1300</id_address_invoice> 
    <id_cart>218</id_cart> 
    <id_currency>1</id_currency> 
    <id_lang>2</id_lang> 
    <id_customer>214</id_customer> 
    <id_carrier>2</id_carrier> 
    <current_state>2</current_state> 
    <module></module> 
    <invoice_number>0</invoice_number> 
    <delivery_number>0</delivery_number> 
    <valid>1</valid> 
    <date_add>2017-06-27 23:00:46</date_add> 
    <date_upd>2017-06-28 11:50:13</date_upd> 
    <id_shop_group>1</id_shop_group> 
    <id_shop>1</id_shop 
    <payment>MyPayment</payment> 
    <recyclable>0</recyclable> 
    <gift>0</gift> 
    <mobile_theme>0</mobile_theme> 
    <total_discounts>0</total_discounts> 
    <total_discounts_tax_incl>0</total_discounts_tax_incl> 
    <total_discounts_tax_excl>0</total_discounts_tax_excl> 
    <total_paid>27</total_paid> 
    <total_paid_tax_incl>27</total_paid_tax_incl> 
    <total_paid_tax_excl>27</total_paid_tax_excl> 
    <total_paid_real>27</total_paid_real> 
    <total_products>27</total_products> 
    <total_products_wt>27</total_products_wt> 
    <total_shipping>0</total_shipping> 
    <total_shipping_tax_incl>0</total_shipping_tax_incl> 
    <total_shipping_tax_excl>0</total_shipping_tax_excl> 
    <carrier_tax_rate>0</carrier_tax_rate> 
    <total_wrapping>0</total_wrapping> 
    <total_wrapping_tax_incl>0</total_wrapping_tax_incl> 
    <total_wrapping_tax_excl>0</total_wrapping_tax_excl> 
    <conversion_rate>1</conversion_rate> 
    <reference>170627369</reference> 
    <associations> 
    <order_rows> 
     <order_row> 
     <product_id>2</product_id> 
     <product_attribute_id>7</product_attribute_id> 
     <product_quantity>2</product_quantity> 
     <product_name>Blouse</product_name> 
     <product_reference>demo_2</product_reference> 
     <product_ean13>0</product_ean13> 
     <product_price>27</product_price> 
     <unit_price_tax_incl>27</unit_price_tax_incl> 
     <unit_price_tax_excl>27</unit_price_tax_excl> 
     </order_row> 
    </order_rows> 
    </associations> 
</order> 
</prestashop> 

任何帮助/想法将不胜感激,谢谢!

+0

如果我发送 Bankwire稍后引发异常:“致命错误:未捕获错误:调用成员函数validateOrder()on boolean”。我认为这是由于**付款**字段是无效的。 什么是用任何Prestashop API创建订单的好过程? –

+0

Hi Toine Seiter,你看过[这个](https://www.prestashop.com/forums/topic/228545-webservice-api-how-to-create-a-full-order-customer-cart-and -订购/)?我想这应该是一个很好的开始。不过,我想你必须先创建购物车,然后检索该ID,然后创建订单。 '付款'字段可以是'货到付款'这个名字,'module'应该是模块'cashondelivery'的技术名称。 – sarcom

+0

谢谢你的帮助。是的,我有一个送货地址,一个开票单,一个客户和一个购物车。我尝试了模块=“cashindelivery”和付款=“货到付款”,但它在validateOrder()上失败。 –

在支付模块中的一些调试步骤后,我找到了解决方案。 module应该是一个有效的模块名称(我使用“bankwire”)并且payment可以是你想要的(例如外部源的名称)。

我正在测试一个国家被禁用的地址......启用国家解决问题。

很遗憾Prestashop不响应API调用的原因......即使激活了PaymentModule的prestashop和DEBUG的DEV模式。

感谢您的帮助sarcom!

+0

我很高兴你已经解决了:)。欢迎Toine;) – sarcom