Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Minicart show on add product

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-24-2013, 10:57 AM
  websupport's Avatar 
websupport websupport is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 32
 

Default 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?
__________________
Sizzle Factor @ www.sizzlefactor.com
Simply X-Cart @ www.simplyxcart.com
VitalBGS @ www.vitalbgs.com
For all of your X-Cart solutions!
X-Cart versions 4.4.0 to 5.0
Reply With Quote
  #2  
Old 09-24-2013, 11:19 AM
  websupport's Avatar 
websupport websupport is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 32
 

Default 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.
__________________
Sizzle Factor @ www.sizzlefactor.com
Simply X-Cart @ www.simplyxcart.com
VitalBGS @ www.vitalbgs.com
For all of your X-Cart solutions!
X-Cart versions 4.4.0 to 5.0
Reply With Quote

The following user thanks websupport for this useful post:
totaltec (09-24-2013)
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:00 PM.

   

 
X-Cart forums © 2001-2020