What I do is set a cookie using a unique id. I store the shopping cart info in a database along with the unique id. If the shopper leaves and returns, I read the cookie and get the shopping cart info from the DB and let them pick up where they left off. I also set the unique id as a SESSION VAR so I can keep track of their shopping list while they are in SESSION, even if they have cookies disabled.
Rick Lansford -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Mischa Uppelschoten ext 10 Sent: Tuesday, August 29, 2006 9:19 PM To: Web Site Subject: re[4]: [ACFUG Discuss] saving shopping carts Well, I'm open to suggestions. It's just that I want to please my customers by offering them the shopping cart they had when they left the site. It doesn't *have* to be stored in a database, but I thought db storage was the best option for this type of data? Currently I instantiate the shopping cart object in the user's session scope and the data is flushed to the db when the session times out. Mischa. > Mischa, I was talking this over with some friends. Really, what is the need for the database storage? A few ideas were thrown around, but perhaps some background on what you are really going to achieve would help. Teddy On 8/29/06, Mischa Uppelschoten ext 10 <[EMAIL PROTECTED]> wrote: Thanks Teddy! > Mischa, Part 1: You are trying to prevent the user's shopping cart from expiring by storing it in the database and then retrieve it when they restart their session? ** Yes, that's exactly it. Part 2: OnSessionEnd takes the session scope as an argument. Thus unless you pass a scope into the application.cfc methds, you won't be able to manipulate them. I have not tried this and I am not sure this is possible, but perhaps you can test: <cffunction name="onSessionEnd" returnType="void" output="false"> <cfargument name="sessionScope" type="struct" required="true"> <cfargument name="clientScope" type="struct" required="false"> <cfset client.foo = "bar"> </cffunction> ** I tried this and added the line for clientScope (I already had session and application and those work fine). OnSessionEnd still fails silently when setting or getting variables in clientScope. Teddy On 8/29/06, Mischa Uppelschoten ext 10 < [EMAIL PROTECTED]> wrote: I'm probably missing something. Here is my situation: CFMX7. I'm using OnSessionEnd in Application.cfc to store a user's shopping cart in a database. Works fine. Currently, after the session times out, only the shopping cart page is able to instantiate a shopping cart in the user's session scope and load the old cart. I would like to change this so that any page has the ability to retrieve the shopping cart, but I'm struggeling with performance considerations; I don't want to do a database lookup on every page request. (I want every page to be able to retrieve a user's cart because I built a shopping cart indicator which is displayed on every page). I have noticed that you cannot set a client variable in the OnSessionEnd event (the event fails silently after the client.myvar= line if you do so), this would have been perfect because a simple check for a client var and then to a db lookup or not would have been easy. Obviously you cannot set a cookie var either. Should I not worry about an additional db lookup for every page request, or is there a better way to do this? Many thanks! Mischa. ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?falogin.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com ------------------------------------------------------------- -- <cf_payne /> Blog: http://cfpayne.wordpress.com/ Atlanta CFUG: http://www.acfug.org ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by FusionLink ------------------------------------------------------------- < Mischa Uppelschoten The Banker's Exchange, Inc. 2020 Hills Avenue NW Atlanta, GA 30318 Phone: (404) 605-0100 ext. 10 Fax: (404) 355-7930 Web: www.BankersX.com Follow this link for Instant Web Chat: http://www.bankersx.com/Contact/chat.cfm?Queue=MUPPELSCHOTEN ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?falogin.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com ------------------------------------------------------------- -- <cf_payne /> Blog: http://cfpayne.wordpress.com/ Atlanta CFUG: http://www.acfug.org ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by FusionLink ------------------------------------------------------------- < Mischa Uppelschoten The Banker's Exchange, Inc. 2020 Hills Avenue NW Atlanta, GA 30318 Phone: (404) 605-0100 ext. 10 Fax: (404) 355-7930 Web: www.BankersX.com Follow this link for Instant Web Chat: http://www.bankersx.com/Contact/chat.cfm?Queue=MUPPELSCHOTEN ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=gin.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com ------------------------------------------------------------- ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -------------------------------------------------------------