Jump to content

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.

Link to comment
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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...