Paultim,
There must be some other factor that is different between my production environment and yours that is causing the check to not function correctly. Perhaps you are using a different version of ShopSite? (I am using Pro 11 sp2 r4). When I change the cart quantity in my installation and then immediately press the 'checkout' button the check will occur and the user will stay on the shopping cart page until they press the 'checkout' button again without changing any quantities.
I could take a guess and say that your version may not be running the check if the input box does not lose focus (user clicks out of the input field). If you wanted to try an alternative approach, you could change the javascript code to trigger an update whenever the contents of the input field changed by replacing the addEventListener / attachEvent functions with the code below:
- Code: Select all
if(typeof update_inputs[i] != 'undefined'){
if(update_inputs[i].addEventListener){
update_inputs[i].addEventListener('input', function(){triggerEvent(update_button, 'click');} );
}else if(update_inputs[i].attachEvent){
update_inputs[i].attachEvent('input', function(){triggerEvent(update_button, 'click');} );
}
}
Or you could try replacing 'input' above with 'keyup'. However, I cannot recommend either of these tactics, as this code will cause the check to occur every time a customer changes the text content of the input box. This might give you some very frustrated customers. For example, hitting the backspace key will cause a check to occur and reset the quantity. Because of that, the only way you can change quantities in the shopping cart page is to highlight the quantity number and then press the number you want. Also, quantities can't be set above 9, as a check will occur after the customer presses the '1' key if they are trying to set the quantity to '10'.
I can recommend installing Firebug in Firefox and taking a look at the 'console' tab while you are on your webpage. If something is breaking the javascript code, an error message will show up that will help you troubleshoot the issue as a javascript error or possibly a difference between ShopSite versions.
Hope that helps,
Glen