Page 1 of 1

Javascript alert "Error" on cart page

Posted: Mon Dec 30, 2013 10:23 pm
by Mihir2808
Here's my site url: Its still under construction. Whenever I go to the checkout/cart page and if i click on any links or buttons before the page is fully loaded, a javascript alert box shows up saying "Error". I'm also attaching a picture of the same. Can someone please help me with it? Thank you. :)

Re: Javascript alert "Error" on cart page

Posted: Tue Mar 18, 2014 3:05 am
by jmperea

I have the same error, Have you a solution??


Re: Javascript alert "Error" on cart page

Posted: Thu Aug 27, 2015 11:53 am
by nitinfrnd5
I know it's a very old question, found it when I was looking for the solution of this same issue. I have now fixed it on my store and posting solution here so that other people can be benefited with it.

To block this irritating alert coming on your store, just include below script in your website header.

(function() {
var new_alert = window.alert;
window.alert = function(str) { //str variable return content which is passed to be shown in alert
str1 = str.replace(/(\r\n|\n|\r)/gm,""); //Removing line break from string
if (str1 !="error"){ //show alert only if content is not equal to 'error'
// do nothing

If you are wondering what it does:
It replaces default alert function of javascript and don't show alert when its content is 'error'.

Re: Javascript alert "Error" on cart page

Posted: Wed Dec 04, 2019 1:19 pm
by Sadhik Hussain
its really great solution for the problem. I appreciate your effort
But i am wondering how does that error occur when it is not there in default opencart installation.

asking for information.