Re: Minicart show on add product
Actually I figured it out.
find these lines in ajax.add2cart.js:
// Widget :: ajax callback
ajax.widgets.add2cart.obj.prototype.callback = function(state, a, b, c, d) {
if (!this.isReady())
return false;
var s = false;
if (state && c.messages) {
for (var i = 0; i < c.messages.length; i++) {
if (c.messages[i].name == 'cartChanged' && c.messages[i].params.status == 1 && c.messages[i].params.changes) {
for (var p in c.messages[i].params.changes) {
if (hasOwnProperty(c.messages[i].params.changes, p) && c.messages[i].params.changes[p].productid == this.productid && c.messages[i].params.changes[p].changed != 0)
s = true;
}
}
}
}
this.changeState(s ? 3 : 4);
return true;
}
Then edit them to:
// Widget :: ajax callback
ajax.widgets.add2cart.obj.prototype.callback = function(state, a, b, c, d) {
if (!this.isReady())
return false;
var s = false;
if (state && c.messages) {
for (var i = 0; i < c.messages.length; i++) {
if (c.messages[i].name == 'cartChanged' && c.messages[i].params.status == 1 && c.messages[i].params.changes) {
for (var p in c.messages[i].params.changes) {
if (hasOwnProperty(c.messages[i].params.changes, p) && c.messages[i].params.changes[p].productid == this.productid && c.messages[i].params.changes[p].changed != 0)
s = true;
}
}
}
}
$('.ajax-minicart-icon').trigger('click'); // CUSTOM ADD TO CART
setTimeout(function() {
$(".minicart-box").fadeOut("slow");
}, 5000);
this.changeState(s ? 3 : 4);
return true;
}
That will allow the cart to appear and fade out after 5 seconds.
|