I don’t understand what is happening here so please put me right if possible.
The smarter cart solution is given on page 113 to overcome the doubling up of the same product in a listing by incorporating the quantity attribute. In doing so we come across an issue with sessions and then this is solved; but i also come across another issue that is not addressed in the book:
Using browser refresh in the add_to_cart page, which lists the items already in the cart, asks me if i want to resend the information. If i do resend, then the count is incremented. In a real application we would not want this action: i am not sure how it is possible to stop it. So, how is this done? Here are two things i have tried.
1/ I tried stopping the increment in the add_to_cart method in the store controller, on the basis of the PATH_INFO request header but it seems that the PATH_INFO header is overwritten after the response from the client, so by grabbing it after the request from the store page, the value for the store page is already lost and now, while stopping the problem on refresh of thee ad_to_cart page, the store page does not update the cart.
2/ On the other hand by grabbing it (or any other identifying header) into a parameter in the store index view and passing this to add_to_cart means that when refreshing the add_to_cart view in the browser, this information is sent and the original problem has remained.
I hope i have explained this ok. Whats going on?