Hi,
I'm able to create carts, customers and addresses and my order is also created but with the id_carrier 0 although the cart has the correct id.I cannot have the order with the right id_carrier, and shipment costs. This causes the order to have the status "payment error".
The code used to create the order:
`
order.id_address_delivery = this.props.navigation.getParam('idAddress');//81
order.id_address_invoice = this.props.navigation.getParam('idAddress');//81
order.id_cart = this.props.navigation.getParam('idCart');//145
order.id_customer = this.props.navigation.getParam('idCustomer');//78
order.id_currency = "1";
order.id_lang = "1";
order.id_shop = "1";
order.id_carrier = '7';
order.conversion_rate = "1";
order.module = "stripe_official";
order.payment = "Payment by Stripe";
order.total_paid = this.props.navigation.getParam('total');//54.50
order.total_paid_real = "0";
order.total_products = this.props.navigation.getParam('subTotal');//47.80
order.total_products_wt = this.props.navigation.getParam('subTotal');//47.80
order.total_shipping = this.props.navigation.getParam('shipment'); `//6.70
Screenshots
Payment error
"CTT" is the carrier that was suppose to be in order
The values of the cart
)
The values of the order
The response when i make the order... notice the values of id_carrier and shipment
Additionnal information
PrestaShop version: 1.7.5.0
I'm using react native to create the app that uses prestashop's api
Thank you for your answers in advance.
Hi @mskuser1,
Thanks for your report.
I manage to reproduce the issue with PS1.7.4.4 & PS1.7.5.0.
I used this XML sent
<prestashop>
<order>
<id/>
<id_address_delivery>1</id_address_delivery>
<id_address_invoice>1</id_address_invoice>
<id_cart>10</id_cart>
<id_currency>1</id_currency>
<id_lang>1</id_lang>
<id_customer>1</id_customer>
<id_carrier>2</id_carrier>
<current_state>1</current_state>
<module>ps_checkpayment</module>
<invoice_number/>
<invoice_date/>
<delivery_number/>
<delivery_date/>
<valid>0</valid>
<date_add/>
<date_upd/>
<shipping_number/>
<id_shop_group>1</id_shop_group>
<id_shop>1</id_shop>
<secure_key/>
<payment>Ch猫que</payment>
<recyclable/>
<gift/>
<gift_message/>
<mobile_theme/>
<total_discounts/>
<total_discounts_tax_incl/>
<total_discounts_tax_excl/>
<total_paid>57.48</total_paid>
<total_paid_tax_incl/>
<total_paid_tax_excl/>
<total_paid_real>57.48</total_paid_real>
<total_products>40.90</total_products>
<total_products_wt>49.08</total_products_wt>
<total_shipping/>
<total_shipping_tax_incl/>
<total_shipping_tax_excl/>
<carrier_tax_rate/>
<total_wrapping/>
<total_wrapping_tax_incl/>
<total_wrapping_tax_excl/>
<round_mode/>
<round_type/>
<conversion_rate>1</conversion_rate>
<reference/>
<associations>
<order_rows>
<order_row>
<id/>
<product_id>3</product_id>
<product_attribute_id>13</product_attribute_id>
<product_quantity>1</product_quantity>
<product_name/>
<product_reference/>
<product_ean13/>
<product_isbn/>
<product_upc/>
<product_price/>
<unit_price_tax_incl/>
<unit_price_tax_excl/>
</order_row>
</order_rows>
</associations>
</order>
</prestashop>
In the BO => order detail, I get payment error & the shipping cost = 0拢.
I attached a video record.
https://drive.google.com/file/d/1iSKRvSxDDW56F4b_oZsg1QRWvlU566e0/view
We will see how to fix it.
Thanks!
Dear Prestashop and @khouloudbelguith,
I have solved the problem after a lot of hours spent, most of them looking into PHP code. For those with the same error, the problem was with the delivery options which now has to be in a similar json format with the id_address and id_carrier: {"id_address_delivery":"id_carrier,"}.
To ensure that you don't commit the same errors as mine I will explain what you need to make a successful order:
create a cart with the fields: id_currency, id_lang, id_shop, id_carrier and associations (object)-> cart_rows (object)-> cart_row(array)-> id_product, quantity, id_product_attribute
create a customer with the fields: email, firstname, id_gender, lastname, id_shop, passwd, id_lang, active, id_default_group
create a address with the fields: alias, phone, city, postcode, address1, id_country, firstname, lastname, id_customer
edit the cart with the fields: id, id_currency, id_lang, id_shop, id_address_delivery, id_address_invoice, id_carrier, delivery_option, secure_key, id_customer
create a order with the fields: id_address_delivery, id_address_invoice, id_cart, id_customer, id_currency, id_lang, id_shop, id_carrier, conversion_rate, module, payment, current_state, secure_key, total_paid, total_paid_real, total_paid_tax_incl, total_products, total_products_wt
And after this you will still have a default state because no matter what you send Prestashop will ignore it and put the default one. To solve this apparently you can edit the order because prestashop only overwrites in the creation not in edits.
Prestashop... please consider improving your documentation! It just sucks really. You have a lot of complaints about it but still no improvement. I know you also have a lot of issues open (1017 at the time of post) but half of this exist because you don't have a good documentation, for example mine i wouldn't have open an issue if you had wrote somewhere that i need to set delivery_option. And your forums are fulled with people asking something without an answer.
This issue (http://forge.prestashop.com/browse/PSCSX-8736) was posted in 2017 the only post it has is from the person that posted the issue, he also found the answer, in a similar way to mine, but you somehow changed how the delivery_option is set and forgot to documented so you create a problem that was already solved.
Another issue (http://forge.prestashop.com/browse/PSCSX-8448) created in 2016 he actually got an answer (after a year) that said you were going to look into it. 2 years later we are still waiting for your response...
My issue was open for almost 5 months now with no apparent resolution, please make an effort to improve you documentation.
Best regards,
Miguel Neves
Hi Miguel,
when I make
1) Create customer
2) Create Address
3) Create Cart
4) Create Order
5) Update Order (PUT method - with same data)
I think that all is ok. i had same problem like you.
Josef Francu
Hi @karaya6
Dont you have a payment error in your order history on the first place in your history log?
Hi Stepel,
yes, I have Payment error status in order history - I know that麓s not so good, but it麓s usable.
I close this one. Please see https://github.com/PrestaShop/PrestaShop/issues/19906
Most helpful comment
Dear Prestashop and @khouloudbelguith,
I have solved the problem after a lot of hours spent, most of them looking into PHP code. For those with the same error, the problem was with the delivery options which now has to be in a similar json format with the id_address and id_carrier: {"id_address_delivery":"id_carrier,"}.
To ensure that you don't commit the same errors as mine I will explain what you need to make a successful order:
create a cart with the fields: id_currency, id_lang, id_shop, id_carrier and associations (object)-> cart_rows (object)-> cart_row(array)-> id_product, quantity, id_product_attribute
create a customer with the fields: email, firstname, id_gender, lastname, id_shop, passwd, id_lang, active, id_default_group
create a address with the fields: alias, phone, city, postcode, address1, id_country, firstname, lastname, id_customer
edit the cart with the fields: id, id_currency, id_lang, id_shop, id_address_delivery, id_address_invoice, id_carrier, delivery_option, secure_key, id_customer
create a order with the fields: id_address_delivery, id_address_invoice, id_cart, id_customer, id_currency, id_lang, id_shop, id_carrier, conversion_rate, module, payment, current_state, secure_key, total_paid, total_paid_real, total_paid_tax_incl, total_products, total_products_wt
And after this you will still have a default state because no matter what you send Prestashop will ignore it and put the default one. To solve this apparently you can edit the order because prestashop only overwrites in the creation not in edits.
Prestashop... please consider improving your documentation! It just sucks really. You have a lot of complaints about it but still no improvement. I know you also have a lot of issues open (1017 at the time of post) but half of this exist because you don't have a good documentation, for example mine i wouldn't have open an issue if you had wrote somewhere that i need to set delivery_option. And your forums are fulled with people asking something without an answer.
This issue (http://forge.prestashop.com/browse/PSCSX-8736) was posted in 2017 the only post it has is from the person that posted the issue, he also found the answer, in a similar way to mine, but you somehow changed how the delivery_option is set and forgot to documented so you create a problem that was already solved.
Another issue (http://forge.prestashop.com/browse/PSCSX-8448) created in 2016 he actually got an answer (after a year) that said you were going to look into it. 2 years later we are still waiting for your response...
My issue was open for almost 5 months now with no apparent resolution, please make an effort to improve you documentation.
Best regards,
Miguel Neves