Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to save a value into the table when IE is closed?

Status
Not open for further replies.

diem

Programmer
Jul 25, 2001
28
0
0
US
Hello everyone,

I'm working on an Online Ordering website. The customers can select any item and add to Shopping Cart. The process of ordering online is working ok if they end the order by checking out. However, if the customers close the IE before checking out (means the order is cancelled), then how do I clear the shopping cart? If they open IE window again, I need to able to know that the previous order is cancelled and empty the shopping cart. So, is there any way that I can set a flag in the table to keep track this before IE window is closed. Anyone who already has done this, please advise. Any help would be very appreciated . Thanks a lot.
 
hi diem,

what are you storing the cart in?

=========================================================
if (!succeed) try();
-jeff
 
Hi Jeff,

I store all items of shopping cart in an Access table. If customer#1 adds some items into this table and then close IE window, the table at this time is not empty. So, if customer#2 creates a whole new order, then this shopping cart table needs to have no items. This customer#2 shouldn't see the items that customer#1 added to shopping cart previously.
So, I want to save a flag in a table whenever the user close the IE window in the middle of the order. I think I have to use onunload Javascript event and also use VBscript to save this flag. But I couldn't figure out a way to accomplish this. Do you or anyone know any trick to do this? Thanks very much
 
diem,

you're using ASP? you can use the Session_onEnd function of your global.asa to run code to clean the cart. unfortunately, session_onend is unreliable on certain versions of IIS - it doesn't always fire. for this reason, I would store the sessionID with each cart - then when the cart is called, if the cart's sessionID doesn't match the current sessionID, you can clear the cart.

you could then also store a browser cookie called "lastSessionID" or something, and store the current sessionID in it when they create a cart...so if they abort and come back later, you can check for this cookie, and present them with their items if they wish to continue shopping. :)

hope this helps!
=========================================================
if (!succeed) try();
-jeff
 
Hi Jeff,

Thanks a lot for your help! Your idea about using sessionID works great. It's exactly what I tried to do, I learned a useful tip. Thanks very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top