Hi all
We found a pretty major bug in that the incorrect product gets added to the cart when you use the browser back button.
I have my product type setup as follows:
Colour as a taxonomy reference with "Enable this field to function as an attribute field on Add to Cart forms" checked (In manage fields)
Size as a cck list with "Enable this field to function as an attribute field on Add to Cart forms" checked (In manage fields)
I have a pretty standard product display with a product reference field.
I have setup a basic demo site the illustrate the problem at: http://commerce.communica.co.nz/node/1 . This site has only the essential modules installed to make commerce function with admin_menu and module_filter being the exceptions.
Steps to produce the bug:
1. http://commerce.communica.co.nz/node/1
2. Select Red M shirt
3. Add to cart
4. Click browser back button
5. Select S
6. Add to cart
You will notice a Large Blue got added to the Cart as apposed to the red small shirt.
This bug happens in Safari, Chrome and Firefox. I have been told it works correctly in IE but I can not confirm.
I believe it's because the ajax is not fired to bring the correct colour / size variation when the back button is pressed but instead a browser cached page is loaded. I have noticed the incorrect product that gets added to the cart so happens to be the first product that is reference on the display.
I have tried to make sure the page is expired by add meta tags but it makes no difference. I have also tried this http://drupal.org/node/1621210
Any ideas how we can over come this issue?
Comments
Comment #1
mrpeanut commentedI think this is a duplicate of #1905218: Keep attributes selected on form refresh.. It's reverting back to the "default" attributes.
Comment #2
rszrama commentedYeah, there's nothing we can do about the way browsers work. However, you can follow along this issue: #1621210: Add to cart form submit + redirect + user presses back button = broken ajax on cart form
Comment #2.0
rszrama commentedUsed the incorrect demo link
Comment #3
dubs commentedFor anyone else stumbling across this you can always use jQuery to repopulate the values on page load. A pretty crappy workaround but it does the trick. The this.value property remembers and you can loop through your form elements and repopulate.