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

问题描述 投票:1回答:2

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

创建订单需要模块名称。如果我把它留空,我会收到错误:

验证错误:“Property Order-> module is empty”

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

验证错误:“属性订单 - >模块无效”

我该怎么办 ?虽然我在付款领域遇到同样的问题?

这是我发送的内容:

<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>

任何帮助/想法将非常感谢,谢谢!

web-services prestashop prestashop-1.6
2个回答
2
投票

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

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

真可惜Prestashop没有回应API调用的原因......即使激活了prestashop的DEV模式和PaymentModule的DEBUG。

谢谢你的帮助sarcom!


0
投票

您需要在prestashop管理员端启用付款选项(例如支票付款),然后需要添加带有前缀ps_moduleName的模块,不带任何空格。我确实喜欢这个,$ xml-> order-> module =“ps _”。strtolower(str_replace('','',$ order_data ['payment_method']));如果有任何错误,您可以尝试这个。如果您有任何更好的解决方案,那么我知道。谢谢。

© www.soinside.com 2019 - 2024. All rights reserved.