感谢Prestashop WebServices,我正在努力创建订单。我成功创建了客户,地址和购物车,但订单创建正在崩溃。以下是使用以下curl请求时出现的错误:
curl -i -X POST -d @tmpOrder.text http://secretKey@localhost:8888/api/orders
Property OrderDetail-> product_price为空
以下是我用来创建购物车的XML文件(并试图创建我的订单。
tmpCart.text
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<cart>
<id></id>
<id_address_delivery>6</id_address_delivery>
<id_address_invoice>6</id_address_invoice>
<id_currency>1</id_currency>
<id_customer>2</id_customer>
<id_guest></id_guest>
<id_lang>1</id_lang>
<id_shop_group>1</id_shop_group>
<id_shop>1</id_shop>
<id_carrier>2</id_carrier>
<recyclable></recyclable>
<gift></gift>
<gift_message></gift_message>
<mobile_theme></mobile_theme>
<delivery_option></delivery_option>
<secure_key></secure_key>
<allow_seperated_package></allow_seperated_package>
<date_add></date_add>
<date_upd></date_upd>
<associations>
<cart_rows>
<cart_row>
<id_product>2</id_product>
<product_price>26.999852</product_price>
<id_product_attribute>1</id_product_attribute>
<id_address_delivery>6</id_address_delivery>
<quantity>2</quantity>
</cart_row>
</cart_rows>
</associations>
</cart>
</prestashop>
tmpOrder.txt
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<order>
<id></id>
<id_address_delivery>6</id_address_delivery>
<id_address_invoice>6</id_address_invoice>
<id_cart>42</id_cart>
<id_currency>1</id_currency>
<id_lang>1</id_lang>
<id_customer>2</id_customer>
<id_carrier>2</id_carrier>
<current_state>1</current_state>
<module>cheque</module>
<payment>Chèque</payment>
<total_paid>1</total_paid>
<total_paid_real>54</total_paid_real>
<total_products>2</total_products>
<total_products_wt>54</total_products_wt>
<conversion_rate>1</conversion_rate>
<reference></reference>
<associations>
<order_rows>
<order_row>
<id></id>
<product_id>2</product_id>
<product_attribute_id>1</product_attribute_id>
<product_quantity>2</product_quantity>
<product_name>TEST</product_name>
<product_reference></product_reference>
<product_ean13></product_ean13>
<product_upc></product_upc>
<product_price>26.999852</product_price>
<unit_price_tax_incl>26.999852</unit_price_tax_incl>
<unit_price_tax_excl>26.999852</unit_price_tax_excl>
</order_row>
</order_rows>
</associations>
</order>
</prestashop>
答案 0 :(得分:1)
我终于发现了什么是错的。似乎我的产品product_attribute_id
错了。因此,它正在寻找价格阵列中不存在的价格。