X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Minicart show on add product (https://forum.x-cart.com/showthread.php?t=67819)

websupport 09-24-2013 10:57 AM

Minicart show on add product
 
I am trying to have the minicart show and then fade after two seconds of showing itself when I add a product. I think I have to edit the ajax.minicart.js file but I just can't find out where. I need to find where the click function is for the div that holds the minicart. Any ideas?

websupport 09-24-2013 11:19 AM

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.


All times are GMT -8. The time now is 09:31 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.