Jump to content

How to create a new order programmatically?


gabriel_icoz

Recommended Posts

Hi, I'm nor a PrestaShop programmer, and I have a problem.
I need to place a new order programmatically. How this would work; I'm writing a module to import orders from Google Merchant, but I can't figure out how to create a new order. From what I got so far I understood that I need a customer and a cart.
1. I need to check if the email is already on the database, and create a new customer if I got a new email.
2. I need to create a new cart, ok..... but I need a cart ID, where do I get this cart ID? can I just use some random number?


Thank you so much.

Link to comment
Share on other sites

cart ID's - like many numbers in Prestashop - are auto-increase values in the database.

I am not exactly a specialist in all Prestashop's functions. The core tables you need are ps_orders and ps_order_detail. Their references to the ps_customer and ps_address tables are also important. The role of ps_cart is not exactly clear to me. It plays a role when the order has not been paid. But with the payment the order is created and although this has a link to the cart it is not clear to me what role it still plays.

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...