Jump to content
kostigas

Cannot create order programmatically

Recommended Posts

Hello, I am trying to create an order using Prestashop webservices. I managed to create a customer, an address for the customer and a cart. The way i see it the next step is to create an order, unfortunately when i create the order using the /api/orders?schema blank i get an error 500 as return. The weird thing is that it creates an order but it does not assign a current state, it leaves it 0, so to make it valid i have to get to the back office every time and select the current state from there. I also noticed that the delivery option is not generated and i guess that is not a field that i have to complete manually. I checked the php_error log and it says:  Uncaught Error: Call to a member function get() on null in ... classes/Tools.php:801. I tried inserting the delivery option manually to the database before creating the order but I'm still getting that error. When i try to create an order using the Prestashop front end instead of my custom one everything works fine, so I'm 100% sure that there's something I'm doing wrong and it's not a problem in Tools.php file.

Share this post


Link to post
Share on other sites

delivery_option is on some kind of weird format, it's combined from address and carrier ID. But I guess you saw that in the database. The order state is being set by the payment module if I am correct

Share this post


Link to post
Share on other sites
1 hour ago, rhythm said:

delivery_option is on some kind of weird format, it's combined from address and carrier ID. But I guess you saw that in the database. The order state is being set by the payment module if I am correct

Thanks for the attention. Can you help me proceed with my problem? I am sure that the customer and the address are created successfully because if I try to make an order from the prestashop front end it is created successfully.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More