VirtueMart Forum

VirtueMart 2 + 3 + 4 => Frontend Modules => Topic started by: peizamo on August 29, 2012, 20:01:05 PM

Title: Add-to-cart pop-up auto-close
Post by: peizamo on August 29, 2012, 20:01:05 PM
Not sure if this is the correct area for this topic but here it is anyway.

Where should I modify the Add to cart -code to automatically close the add-to-cart pop-up after few seconds? I think it's just one more useless click for the customer to close the pop up.

Any help appreciated!

:)
Title: Re: Add-to-cart pop-up auto-close
Post by: scorp2000 on September 03, 2012, 23:35:18 PM
one way is to disable popup... from admin side..

if this way is not a way for then .. here is a cheap way  ;)

go to
components->com_virtuemart->assests->css
at line 3 change z-index to -100

#facebox {
  position: absolute;
  z-index: -100;
  text-align: left;
}
then goto line 70 change z-index to -100

#facebox_overlay {
  z-index: -100;
  position: fixed;
  top: 0px;
  left: 0px;
  height:100%;
  width:100%;
}

cheers


Title: Re: Add-to-cart pop-up auto-close
Post by: peizamo on September 09, 2012, 09:13:24 AM
Quote from: scorp2000 on September 03, 2012, 23:35:18 PM
one way is to disable popup... from admin side..

if this way is not a way for then .. here is a cheap way  ;)

go to
components->com_virtuemart->assests->css
at line 3 change z-index to -100

#facebox {
  position: absolute;
  z-index: -100;
  text-align: left;
}
then goto line 70 change z-index to -100

#facebox_overlay {
  z-index: -100;
  position: fixed;
  top: 0px;
  left: 0px;
  height:100%;
  width:100%;
}

cheers

Maybe I wasn't clear enought with my question. I _want_ the pop-up to be displayed but after being visible for few seconds, I want to hide it.

So my guess is to play with JavaScripts setTimeout()-function but I have no idea where should I put it.

Any answers appreciated!  :)
Title: Re: Add-to-cart pop-up auto-close
Post by: maria on September 27, 2012, 15:10:37 PM
Hi
To auto-close the popup after you click the add-to-cart button, I've done the following (VM 2.0.8)
Edit the file facebox.js in /components/com_virtuemart/assets/js/
after the line

   $.facebox.loading()

add:
setTimeout($.facebox.close, 3000);



Regards
Title: Re: Add-to-cart pop-up auto-close
Post by: sarguvlad on October 13, 2012, 11:04:04 AM
Quote from: maria on September 27, 2012, 15:10:37 PM
Hi
To auto-close the popup after you click the add-to-cart button, I've done the following (VM 2.0.8)
Edit the file facebox.js in /components/com_virtuemart/assets/js/
after the line

   $.facebox.loading()

add:
setTimeout($.facebox.close, 3000);



Regards

THANK YOU MAN!!!!!!!!!!! It solved my problem!!
Title: Re: Add-to-cart pop-up auto-close
Post by: cromcrom on March 12, 2013, 06:02:16 AM
Hello,

thank you for the great fix! It works very well.

Unfortunately my cart does not update quantity on the fly anymore - I have to refresh the page to see the new additions.
If you/anybody has any ideas for a solution I would appreciate the help!

Joomla 2.5
VM 2.0.8
Title: Re: Add-to-cart pop-up auto-close
Post by: Limonbay on March 29, 2013, 17:43:46 PM
It works flawlwssly for me. And it updates the cart with every use.

Thanks
Title: Re: Add-to-cart pop-up auto-close
Post by: Kans on June 16, 2013, 22:51:57 PM
It works, but it also makes other pop-up autoclose, such as the ask a question about this product-button and the conditions in the check out.
How can I make only the cart pop-up autoclose?
Title: Re: Add-to-cart pop-up auto-close
Post by: AH on October 25, 2013, 15:58:15 PM
If you are using the new fancybox and want the much loved "auto close"

Edit

components\com_virtuemart\assets\js\vmprices.js

At around line 75

replace

  if(usefancy){
                        $.fancybox({
                                "titlePosition" : "inside",
                                "transitionIn" : "elastic",
                                "transitionOut" : "elastic",
                                "type" : "html",
                                "autoCenter"    :   true,
                                "closeBtn"      :   false,
                                "closeClick"    :   false,
                                "content"       :   txt
                            }
                        );


with this

if(usefancy){
                        $.fancybox({
                                "titlePosition" : "inside",
                                "transitionIn" : "elastic",
                                "transitionOut" : "elastic",
                                "type" : "html",
                                "autoCenter"    :   true,
                                "closeBtn"      :   false,
                                "closeClick"    :   false,
                                "onComplete"    : function(){
                                    setTimeout( function() {$.fancybox.close(); },3500); // 3000 = 3 secs
                                },
                                "content"       :   txt
                            }
                        );


Adjust the timeout as required 3500 = 3.5 secs

This should not affect any other fancybox popups  8)
Title: Re: Add-to-cart pop-up auto-close
Post by: zakgr on March 25, 2017, 21:05:08 PM
I have joomla 3.65 and vm 3.018 and this is not working

here is my vmprice.js

##edit code removed as a base file in VM no need to repost if not changed from original
Title: Re: Add-to-cart pop-up auto-close
Post by: AH on March 28, 2017, 13:31:15 PM
For 3.xx

if(usefancy){
         jQuery.fancybox({

and edit so it looks like this:-

if(usefancy){
jQuery.fancybox({
                "titlePosition" : "inside",
                "transitionIn" : "fade",
                "transitionOut" : "fade",
                "changeFade"    :   "fast",
                "type"          : "html",
                "autoCenter"    : true,
                "closeBtn"      : false,
                "closeClick"    : false,
                "content"       : txt,
                "autoDimensions": false,
                "width"         : 320,
                "height"        : 'auto',
                "onComplete"    : function () {
                    setTimeout(function () {
                        jQuery.fancybox.close();
                    }, 400); // 300 = 3 secs
                }
            });