Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Clearing cart when a customer leaves/signs off


Aklem

Recommended Posts

Posted

Ok, so I am looking for some information about this problem, maybe a contribution or just some pointing in the right direction:

 

Scenario: A customer logs in, shops around, adds a couple items to their cart. They decide not to buy anything, and then leave or log out. Two weeks/months/years later, same customer logs in for the next time and adds a product to their cart. They go to checkout, and notice EXTRA products in their cart and get suspicious, but these are just the extra products that they left in from before -- unfortunately they don't remember that. Even worse, sometimes they even FORGET to look at their cart contents before they pay, and end up ordering products that they did not intend to.

 

Question: How do I erase the contents when they log out, or when they have been signed out for a certain length of time?

 

Thanks,

Ak

Posted

Hi Ak,

 

here are the steps:

 

- create a new column in the basket table for the session

- when storing products from session to basket table, store the session_id in that new column

- when a user logs in, check if his id is found in basket table, if yes and the session_id is different, delete those rows

 

this will of course delete everything even from an hour before.

 

alternatively, store the date added with time and clean the table every 2nd day or so - depends on what you need

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...