Prestashop Webservices - 属性 OrderDetail->product_price 在创建订单时为空
Prestashop Webservices - Property OrderDetail->product_price is empty on order creation
感谢 Prestashop WebServices,我正在尝试创建订单。我成功创建了客户、地址和购物车,但订单创建崩溃了。这是我使用以下 curl 请求时遇到的错误:
curl -i -X POST -d @tmpOrder.text http://secretKey@localhost:8888/api/orders
Property OrderDetail->product_price is empty
这是我用来创建购物车(并尝试创建订单)的 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>
我终于找到问题所在了。好像是我产品的product_attribute_id
不对。因此,它在价格数组中寻找不存在的价格。
感谢 Prestashop WebServices,我正在尝试创建订单。我成功创建了客户、地址和购物车,但订单创建崩溃了。这是我使用以下 curl 请求时遇到的错误:
curl -i -X POST -d @tmpOrder.text http://secretKey@localhost:8888/api/orders
Property OrderDetail->product_price is empty
这是我用来创建购物车(并尝试创建订单)的 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>
我终于找到问题所在了。好像是我产品的product_attribute_id
不对。因此,它在价格数组中寻找不存在的价格。