Jump to content

Issue when deleting cart with module


Recommended Posts

Hello,

I got a module that allows me to delete certain unnecessaries datas in order to free up space in the database. This module provides me with an URL that I use with another cron job module.

Among the data to be deleted, I checked the "carts without orders" option, so it deletes all carts older than xx days. This cart deletion is causing a major bug. Users who have an open cart at the time of deletion can no longer add products to the cart afterward.

Here is the description of the bug:

- From the front office: adding a product to the cart -> product is added but the cart remains empty, and the same happens with every new attempt.
- From the database: a new cart is indeed created in ps_cart, and a product is added with its quantity in ps_cart_product. With each new attempt by the user, a new row is created in both of these tables.

In conclusion, from what I observe in the database, a new cart is indeed created, but the front office does not display it (the cart remains empty, no quantity appears in the small number next to the icon, etc.). It's as if the user's "session" is still acting as if the previous cart is still there; the deletion of the latter did not notify the session at the same time. I tried clearing the cookies, but that didn't change anything.

Does anyone have an idea of what's going on?
Thanks.

Link to comment
Share on other sites

Hi.

If the cart is deleted and the Prestashop delete() function is used, it is no longer possible to add anything to the same cart because the cart ID no longer exists.

With this function, customer session deletion and automatic logout should be called.
In general, modules for such deletion of data from the database should also include a backup of the database.

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