[thelist] in-principle, PHP/mySQL shopping basket question

Chris W. Parker cparker at swatgear.com
Wed Jul 23 11:18:13 CDT 2003

john at johnallsopp.co.uk <mailto:john at johnallsopp.co.uk>
    on Wednesday, July 23, 2003 7:13 AM said:

I'm actually dealing with the very same thing. But I think I have some
ideas and hopefully they aren't terrible.

> What rule do I implement to discard the basket. I can't tell that
> they've left the site barring timeout, and what if someone wants to
> keep their basket open overnight or similar?
> What have I missed?

You table that stores the basket information should also store the time
the basket was created and when it was last accessed (or you could call
this modified date/time). Each time the customer accesses the cart
(reads, modifies) you should update the date/time of the modified/last
accessed field.

Then periodically (maybe once a day, or once a week) you can have a php
script that goes through the basket table and discards all records that
are older than 24 hours or something like that.

I've not completely figured this out yet but that's one idea I've got on
the subject.

Another thing to think about (at least in with my own cart) is how to
deal with logged in customers and customers that are not logged in.


More information about the thelist mailing list