VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: StompJames on March 02, 2018, 18:16:23 PM

Title: pop up for add to cart not working, possible jquery conflict
Post by: StompJames on March 02, 2018, 18:16:23 PM
Hello,

I have an issue with fancybox being initialised more than once,  I believe this is a jquery conflict? I have tried to remove any other scripts but have had no luck.

When I look in Firefox developer I can see a script called:

https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.1.25/jquery.fancybox.min.js:11:450

I went to Cloudflare some time ago due to DDoS attack but it did not really help. I have deleted my website from the account and checked my DNS to ensure it no longer points to them. It does not. I still get this error though:

Error: fancyBox already initialized
jquery.min.js:2:1814
error
https://staging.mafiabike.com/media/jui/js/jquery.min.js:2:1814
<anonymous>
https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.1.25/jquery.fancybox.min.js:11:450
<anonymous>
https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.1.25/jquery.fancybox.min.js:11:2


How can I resolve this, it is stopping my add to cart pop up and I wan to use it. If I disable the pop up add to cart works. I have tried a plugin to block the script called jquery easy but that did not work.

My test site is:
staging.mafiabike.com

Excuse the certificate, I have not enabled it for this subdomain. I run SSL on mafiabike.com and this is a copy.

Joomla! 3.6.5   
VirtueMart 3.0.18

I really need to sort this and will gladly pay for support if needed and fast.

Title: Re: pop up for add to cart not working, possible jquery conflict
Post by: Studio 42 on March 04, 2018, 16:09:23 PM
You have other javascripts error :
QuoteUncaught ReferenceError: LoadParams is not defined
You have a javascript line
window.onload = LoadParams;
But LoadParams is not declared

QuoteReferenceError: priceStart is not defined
because this code
function start() {
        priceStart();
        SortPriceDisplay();
                      }
                     
window.onload = start;



</script>

This is certainly a template addon, so you should check with your template provider.
Note that i dont have any problem about fancybox on your stagin site.
Title: Re: pop up for add to cart not working, possible jquery conflict
Post by: StompJames on March 04, 2018, 17:37:09 PM
Hi,

Thanks for the response, I can fix those errors you mention- it's some old code that needs to be removed/corrected I think. Do you think they would cause my pop up issue?

So you don't see the cloudflare error that I do? I have removed the site from cloudflare so perhaps it's resolved itself. I will check. Also, do you not see the fancybox error?

Thanks,

James
Title: Re: pop up for add to cart not working, possible jquery conflict
Post by: Studio 42 on March 04, 2018, 20:12:49 PM
when you go to us website, you dont have any fancybox error
In stagin site
function prepareImageLightbox () {
jQuery("a[rel^='catproduct_images']").each(function() { jQuery(this).fancybox({
"titlePosition" : "inside",
"transitionIn" : "elastic",
"transitionOut" : "elastic"
});});
}



Should be
function prepareImageLightbox () {
jQuery("a[rel^='catproduct_images']").fancybox({
"titlePosition" : "inside",
"transitionIn" : "elastic",
"transitionOut" : "elastic"
});});
}


And after
      
jQuery(document).ready(function() {
         jQuery("a[rel=catproduct_images_0]").fancybox({
         "titlePosition"    : "inside",
         "transitionIn"   :   "elastic",
         "transitionOut"   :   "elastic"
         });});jQuery(document).ready(function() {
         jQuery("a[rel=catproduct_images_1]").fancybox({
         "titlePosition"    : "inside",
         "transitionIn"   :   "elastic",
         "transitionOut"   :   "elastic"
         });});jQuery(document).ready(function() {
         jQuery("a[rel=catproduct_images_2]").fancybox({
         "titlePosition"    : "inside",
         "transitionIn"   :   "elastic",
         "transitionOut"   :   "elastic"
         })
And each time script is added again and again 43 times !
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.1.25/jquery.fancybox.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.1.25/jquery.fancybox.min.js"></script>
I have send you a PM, if you need a developer. It's no t cloudflare problem, but bad plugin or template.