mmosel Posted March 6, 2006 Share Posted March 6, 2006 I'm refining my shopping cart right now. I have been using GET variable when adding an item to the cart. (as opposed to POST variables)One reason I don't like POST for this purpose is that if the user refreshes the page, they get the annoying WARNING regarding POST data.However, with the GET method, after an item has been added to the cart (?additem=1234), if the user refreshes the page, the item gets added again (if the item can be sold multiple times).Some sites don't let items increment in a cart unless the user changes the item quantity in the cart and then updates the cart. Other sites let you click the add cart item again and the item increments by 1. I've figured out a solution for this using a session switch. It's not hard to do, but I'm just curious as to what other's preferred method is for carts - if you have a cart on your site.Anyone? Quote Link to comment Share on other sites More sharing options...
mmosel Posted March 7, 2006 Author Share Posted March 7, 2006 Well, I think I came up with an easy and elegant solution. I think this would work with POST as well as GET.I'm going to continue using GET for the cart. However, when I'm done with my add item script, I will simply reload the page without the additem in the url. This way the page can be refreshed without adding another item. The back button will take you back to the item you were looking at. You can add the item again and it will increment. It works, I love it! Quote Link to comment Share on other sites More sharing options...
wickning1 Posted March 7, 2006 Share Posted March 7, 2006 Yeah, that's a pretty typical strategy for avoiding data reloads in general. Even if their browser pops up and warns them they're about to reload POST data, half your users will click OK anyway. Plus the message is annoying, best you keep them from getting it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.