Jump to content

Where does prestashop gets last id_cart?


Recommended Posts

Posted (edited)

As per subject, I would like to know where Prestashop storages the lastly generated unique cart id that the new cart controller utilizes to create a new cart id as soon as a new visitor presses "add to cart" and how, if possible, to modify it with a custom one.

 

This information is needed to avoid an after 1.6 to 1.7 migration conflict that causes the cart not being generated at first customer's "add to cart" click (hence with modal appearing with a "0" amount counted and no products effectively added)  due to the id_cart being already used for previously received orders. Another solution I found to be working fine is changing all the pre-existing order column id_cart in ps_orders table to cart id 1, but i think setting a grater number id as starting point (for example 50000) for new carts to be generated is a cleaner and smarter solution.

 

Thanks

Edited by nicoledesignstore (see edit history)

Share this post


Link to post
Share on other sites

  • nicoledesignstore changed the title to Where does prestashop gets last id_cart?

Prestashop finds the sql query last id_cart and adds +1.

Id_cart is defined as AUTO_INCREMENT in the ps_cart table.

So just change the starting number in the database.

ALTER TABLE ps_cart AUTO_INCREMENT = 50000

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

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