how to override JavaScript function
REAL FUNCTION
compare = {
add: function(t) {
$.ajax({
url: "index.php?route=product/compare/add",
type: "post",
data: "product_id=" + t,
dataType: "json",
success: function(t) {
$(".alert").remove(), t.success && ($.colorbox({
html: '<div class="cart_notification"><div class="product"><img src="' + t.image + '"/><span>' + t.success + '</span></div><div class="bottom"><a class="btn btn-primary" href="' + t.link_compare + '">' + t.text_compare + "</a></div></div>",
className: "login",
initialHeight: 50,
initialWidth: 50,
width: "90%",
maxWidth: 400,
height: "90%",
maxHeight: 200
}), $("#compare-total").html(t.total), $("#header_compare").html(t.compare_total))
}
})
},
remove: function() {}
};
---------------------------------------------------------------
----------------------------------------------------------------
OVERIDE FUNCTION
compare.add = function(t) {
$.ajax({
url: "index.php?route=product/compare/add",
type: "post",
data: "product_id=" + t,
dataType: "json",
success: function(t) {
$(".alert").remove(), t.success && ($.colorbox({
html: '<div class="cart_notification"><div class="product"><img src="' + t.image + '"/><span>' + t.success + '</span></div><div class="bottom"><a class="btn btn-primary" href="' + t.link_compare + '">' + t.text_compare + "</a> <a class='btn btn-primary' onclick='removebox();'>Add another product</a></div></div>",
className: "login",
initialHeight: 50,
initialWidth: 50,
width: "90%",
maxWidth: 400,
height: "90%",
maxHeight: 200
}), $("#compare-total").html(t.total), $("#header_compare").html(t.compare_total))
}
})
}
FOR more information how to override follow this link:-