[thelist] Homemade Shopping Cart Question

Hassan Schroeder hassan at webtuitive.com
Mon Nov 24 19:00:02 CST 2003

Rob Smith wrote:

> Ok. Now that I've got the Wally-World Idea down. At what point to you have
> checks and balances to confirm that this G.I. Joe retro toy was actually
> sold, and not abandoned? Do you have intermittent states of information?

My shopping cart implements `HttpSessionBindingListener`, so if the
transaction isn't completed before the standard session timeout, all
products are returned to inventory as part of discarding the cart.

The `availability` field would normally indicate it was for sale;
when a product's put into a cart, `availability` is changed to the
ID of the shopping cart. Cart creation is logged, so if there were
a system crash, or I had reason to think there was a problem, it's
easy enough to see if an active session has the indicated cart.

But the `availability` is also explicitly marked as being sold if
a credit card transaction takes place successfully. :-)

All this, obviously, is done through a single inventory table, not
temporary tables (which don't work with connection pooling).

Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.

More information about the thelist mailing list