Re: [WebDNA] cart stored as a session cookie
This WebDNA talk-list message is from 2008
It keeps the original formatting.
numero = 100532
interpreted = N
texte = I do a similar thing with cookies, but when I pass into the SSL pages for collecting credit card info, I need to send the cart variable with the forms because my SSL pages have a different domain name. I think this would be true even if within the same domain name. If your entire system is in SSL pages, then there's no issue but it is something you might have to work around. Like Brian says, get rid of the cookie once they're done.Using cookies for the cart gives you the ability to show a View Cart link on the regular pages and lets them come back later and continue, so yeah, it's a good thing.Terry>well, how I do it is...>>all pages on the site are built with an included header file, so >adding code in one place and having it run on every page is >effortless.>in my header.inc file i have another cart.inc file included. (keeps >things tidy that way)>>it has in it..>>[!] Attempt to give new visitors a cookie. (new visitor = one >without a current cookie) [/!]>[showif [getcookie Mycart]=]>[setcookie name=Mycart&value=[cart]&path=/&domain=[getmimeheader >Host]&expires=[format days_to_date %A, >%d-%b-%Y][math]{[date]}+3[/math][/format] [math >time]{[time]}+{05:00:00}[/math] GMT]>[/showif]>>[!] Give the nice people who just placed an order a new cookie [/!]>[!] I reset the cart value from the previous page elsewhere as part >of the checkout process [/!]>[showif [referrer]^checkoutfinished.tpl]>[setcookie name=Mycart&value=[cart]&path=/&domain=[getmimeheader >Host]&expires=[format days_to_date %A, >%d-%b-%Y][math]{[date]}+3[/math][/format] [math >time]{[time]}+{05:00:00}[/math] GMT]>[/showif]>>[!] and we set the cart value to the value stored in the cart cookie [/!]>[hideif [getcookie Mycart]=]>[text]cart=[getcookie Mycart][/text]>[/hideif]>>>TA-DA!>>>> Brian B. Burton> 256-457-6232> Department of Redundancy Department>---------------------------------------------------------------> Specializing in website design and development to make your >customers exclaim:> "Out of all the websites I visit, yours is the easiest to use!">>>>>>>On Aug 13, 2008, at 1:26 PM, Gary Krockover wrote:>>> Hey gang,>>>> After placing a gazillion ?cart=[cart] on every link I could find, >>I realize that there must be a better solution and that would seem >>to be storing the cart as a session cookie. The site will already >>require cookies to log into a member account, so the option of the >>user not storing cookies is not an issue.>>>> So, how does this work - do you set it on every page or just the >>home page? What if they have a bookmark that bypasses the home >>page? Does anybody have some sample code that they wouldn't mind >>sharing?>>>> Thanks!>> GJK>>>> --------------------------------------------------------->> This message is sent to you because you are subscribed to>> the mailing list
.>> To unsubscribe, E-mail to: >>>>>>>--------------------------------------------------------->This message is sent to you because you are subscribed to>the mailing list .>To unsubscribe, E-mail to: -- Terry Wilson | terry@terryfic.com | http://terryfic.comhttp://WhosComing.com - a simplified, affordable online reservation systemhttp://TightJacket.com -- stylish protection for your laptop--------------------------------------------------------------------------Attitude is the only difference between ordeal and adventure.
Associated Messages, from the most recent to the oldest:
I do a similar thing with cookies, but when I pass into the SSL pages for collecting credit card info, I need to send the cart variable with the forms because my SSL pages have a different domain name. I think this would be true even if within the same domain name. If your entire system is in SSL pages, then there's no issue but it is something you might have to work around. Like Brian says, get rid of the cookie once they're done.Using cookies for the cart gives you the ability to show a View Cart link on the regular pages and lets them come back later and continue, so yeah, it's a good thing.Terry>well, how I do it is...>>all pages on the site are built with an included header file, so >adding code in one place and having it run on every page is >effortless.>in my header.inc file i have another cart.inc file included. (keeps >things tidy that way)>>it has in it..>>[!] Attempt to give new visitors a cookie. (new visitor = one >without a current cookie) [/!]>[showif [getcookie Mycart]=]>[setcookie name=Mycart&value=[cart]&path=/&domain=[getmimeheader >Host]&expires=[format days_to_date %A, >%d-%b-%Y][math]{[date]}+3[/math][/format] [math >time]{[time]}+{05:00:00}[/math] GMT]>[/showif]>>[!] Give the nice people who just placed an order a new cookie [/!]>[!] I reset the cart value from the previous page elsewhere as part >of the checkout process [/!]>[showif [referrer]^checkoutfinished.tpl]>[setcookie name=Mycart&value=[cart]&path=/&domain=[getmimeheader >Host]&expires=[format days_to_date %A, >%d-%b-%Y][math]{[date]}+3[/math][/format] [math >time]{[time]}+{05:00:00}[/math] GMT]>[/showif]>>[!] and we set the cart value to the value stored in the cart cookie [/!]>[hideif [getcookie Mycart]=]>[text]cart=[getcookie Mycart][/text]>[/hideif]>>>TA-DA!>>>> Brian B. Burton> 256-457-6232> Department of Redundancy Department>---------------------------------------------------------------> Specializing in website design and development to make your >customers exclaim:> "Out of all the websites I visit, yours is the easiest to use!">>>>>>>On Aug 13, 2008, at 1:26 PM, Gary Krockover wrote:>>> Hey gang,>>>> After placing a gazillion ?cart=[cart] on every link I could find, >>I realize that there must be a better solution and that would seem >>to be storing the cart as a session cookie. The site will already >>require cookies to log into a member account, so the option of the >>user not storing cookies is not an issue.>>>> So, how does this work - do you set it on every page or just the >>home page? What if they have a bookmark that bypasses the home >>page? Does anybody have some sample code that they wouldn't mind >>sharing?>>>> Thanks!>> GJK>>>> --------------------------------------------------------->> This message is sent to you because you are subscribed to>> the mailing list .>> To unsubscribe, E-mail to: >>>>>>>--------------------------------------------------------->This message is sent to you because you are subscribed to>the mailing list .>To unsubscribe, E-mail to: -- Terry Wilson | terry@terryfic.com | http://terryfic.comhttp://WhosComing.com - a simplified, affordable online reservation systemhttp://TightJacket.com -- stylish protection for your laptop--------------------------------------------------------------------------Attitude is the only difference between ordeal and adventure.
Terry Wilson
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
math on date? (1997)
ReadDateFormat (1998)
Smith Micro - no competition (2000)
Re:What file? (1997)
transferring values (1998)
date pref (1999)
Re1000001: Setting up shop (1997)
Custom Shipping Charges (1997)
Possible Bug in 2.0b15.acgi (1997)
Summing fields (1997)
[search] in formulas.db (1997)
I'm new be kind (1997)
shipcost (1997)
wo search help (1999)
GrandTotal not right (1997)
.. more on sliding discounts... (1997)
Summary search -- speed (1997)
New index for docs (1997)
Help! Strange happenings... (1997)
Purchased cart being overwritten (1997)