eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Development resources
 ::   WebWare 2.1 (Perl)
 ::   WebWare 2.0 (Java)
 ::   Cool hacks
radical hacks
WebBBS File Attachment Enhancements  
sent in the following excellent hack for Web Store that documents how to maintain the cart_id variable in a cookie instead of as a hidden form variable. His comments are as follows:

"I read the cool hack available here: http://www.extropia.com/hacks/ridenour_cart_id_cookie_ws.html on how to use cookies to remember the cart_id in case the shopper wanders off and comes back.

After four hours of pulling my hair I couldn't get it to work right (I'm sure it was me and not the hack, as nobody has mentioned any problems).

Well, I started back at it again today and came up with my own way of doing it (I did borrow from the above mentioned hack, as well as from Matt Wright http://www.worldwidemart.com/scripts/). I also added a bit to make it clear the cookie if the person click on the checkout stand button, so if they place an order and come back to the store they will get a new cart_id. Here are the details...

PS: The cookie gets cleared when you click on the "checkout stand" button, if you modify my hack to make it clear the cookie when you click on the "submit order" button instead you will have problems if, at this point, you have the form being processed by a secure server that is different from your domain. If this is the case you will be setting two cookies, both being "order_id" but belonging to different domains.