Reputation: 13620
I'm using Magento 1.6.2, with quite a bit of customization - including a heavily modified shopping cart template.
I'm having issues when a user clicks the browser's 'back' button, after adding an item to the shopping cart. I'm only able to reproduce this issue using Firefox. Chrome and IE work fine.
Steps to reproduce.
I have no idea where to begin. Anyone have any ideas?
Production/live site: http://myerstownsheds.com/ 'Request Quote' is actually the 'add to cart' button, we're not selling anything yet.
Upvotes: 0
Views: 2267
Reputation: 2493
The problem is that when the button is clicked, it becomes disabled.
This is only an issue in Firefox because firefox doesn't reset the page state when the back button is used, you tend to be returned to the page in the exact state you left it, in this case with the button disabled.
Replicate the same issue in any browser by clicking the add to cart button and then pressing stop. You can't click the button again.
On your page, you have a javascript tag that includes this:
var productAddToCartForm = new VarienForm('product_addtocart_form');
productAddToCartForm.submit = function(button, url) {
if (this.validator.validate()) {
var form = this.form;
var oldUrl = form.action;
if (url) {
form.action = url;
}
var e = null;
try {
this.form.submit();
} catch (e) {
}
this.form.action = oldUrl;
if (e) {
throw e;
}
if (button && button != 'undefined') {
button.disabled = true;
}
}
}.bind(productAddToCartForm);
By setting the button to "disabled" when clicked, Magento prevents a user from clicking the button multiple times if the page load is slow. If you want to fix this issue you'll need to remove the lines that say:
if (button && button != 'undefined') {
button.disabled = true;
}
But you'll also have to live with the other problem.
Upvotes: 1