Topic: Managing Inventory Smartly

I have a straight-forward app that allows users to add products to a cart. Because each item is one-of-a-kind, it gets put into a kind of holding zone when a user adds it to her cart. If the user goes through with the purchase, the item is removed from the (public side of the) site. If she cancels the purchase, the item is returned to the store.

My concern is when she closes her browser without completing the purchase or canceling it. Is there a smart way to clear her session after a certain amount of time and process the logic to return the item to the store?

Re: Managing Inventory Smartly

Maybe a cron job that runs every day or so to clean up all the abandoned cart items...

Last edited by tconley (2007-05-04 19:00:18)

Re: Managing Inventory Smartly

tconley wrote:

Maybe a cron job that runs every day or so to clean up all the abandoned cart items...

Yeah that's what I've been doing to clear the shopping carts and sessions for my site.

heres the cron script I used

cd /home/login_name/application_folder ; /usr/local/bin/ruby ./script/runner 'CGI::Session::ActiveRecordStore::Session.destroy_all(["updated_at < ?", 1.day.ago ])' -e production

it's on a shared host so it would have to be adapted to whatever your using.