cookies for shopping cartsgreenspun.com : LUSENET : S-Mart Shopping Cart : One Thread
Has anyone converted the script to use a cookie-based cart system instead of HOST or ADDR? I am having big problems with corporate customers that add an item to their cart, and see everything anyone else has added to the cart also. Most companies have some kind of shared hi-speed access, meaning that everyone shares the same IP address. As we know this means they share the same shopping basket too.
I really need a fix for this. Hope someone can help.
-- Todd Miller (firstname.lastname@example.org), July 12, 1999
-- James L. Farmer (email@example.com), July 15, 1999.
Jim - I liked your response and idea how to solve this problem. The only thing that I wonder about however is this: you said that it would require a lot of programming to send the users ip from page to page in the site. However, I found that my problems with AOL users loosing carts did not happen from page to page, but instead only happened when the user went to check out since the ip changed.
So, I put a hidden field in the form that says "check out". This form is called something like oldip. It is simply the $refer string that the user is currently using.
In the next section (the buy1) section, I have it read this hidden field and replace this current ip with the oldip that the user had when in non-secure mode. That way, the script reads their non- secure, pre-ip change shopping basket.
Lastly, I had the buy1 section add a hidden field with this same oldip number which is passed to the buy2 section of the script. That way the script processes the order with the old ip address prior to being in secure mode.
Using this logic, the users "initial" ip is passed through the two different secure server phases, and the s-mart is told to read the old cart with the original ip rather than the new "AOL secure" ip which was assigned and of course is empty.
One question though, using the REMOTE_ADDR, do you know if this ip number stays constant for users as they are browsing the web, or does it change over time?
Jim - You had a great idea and what appears to be a very simple fix to this issue. Good job!
-- BP (firstname.lastname@example.org), August 03, 1999.
I have implemented cookies with my cart. If you are interested to know more, email me at email@example.com.
-- Patrick Chan (firstname.lastname@example.org), March 20, 2000.