Welcome, Guest
Username: Password: Remember me
Use this Category for your support questions about Virtuemart Fancy Product Slider (SKU# FLEX-00004)

TOPIC: Virtuemart is undefined error

Virtuemart is undefined error 8 years 5 months ago #13114

The slider module shows, but I get the following error:

Uncaught ReferenceError: Virtuemart is not defined

in this function

jQuery(function() {
if (!Virtuemart) {
jQuery('form.flexibleFancySlider').each(function() {
jQuery('<input>').attr({
type: 'hidden',
name: 'task',
value: 'add'
}).appendTo(jQuery(this));
});
//console.log('This is a non-virtuemart page');
}
});

Any suggestions?
The administrator has disabled public write access.

Virtuemart is undefined error 8 years 5 months ago #13170

hmmm.

It checks if the Virtuemart Object has been defined or not (to check if you are on a VM related page or not). It shouldn't have generated any error message just because the Object is undefined, this is what we are checking ;). Weird....

Actually:
if (!Virtuemart) {
in the 2nd line of your code; should have been
if (!Virtuemart['addtocart_popup']) {

double weird... :)

Anyway, open this PHP file:
/modules/mod_vm_flexible_fancy_slider/mod_vm_flexible_fancy_slider.php

Find these lines (line#147)
jQuery(function() {
	if (!Virtuemart['addtocart_popup']) {
		jQuery('form.flexibleFancySlider').each(function() { 
			jQuery('<input>').attr({
				type: 'hidden',
				name: 'task',
				value: 'add'
			}).appendTo(jQuery(this));
		});
		//console.log('This is a non-virtuemart page');
	}
});

and replace them to this:
jQuery(function() {
	if (Virtuemart['addtocart_popup'] === undefined) {
		jQuery('form.flexibleFancySlider').each(function() { 
			jQuery('<input>').attr({
				type: 'hidden',
				name: 'task',
				value: 'add'
			}).appendTo(jQuery(this));
		});
		//console.log('This is a non-virtuemart page');
	}
});

then see if you are still getting the Console error.

Regards
Last Edit: 8 years 5 months ago by Support.
The administrator has disabled public write access.
Time to create page: 0.189 seconds

MaterialMart

for Virtuemart 3

Google's Material Design has finally arrived to Virtuemart

Virtumart Template - MaterialMart Virtumart Template - CleanMart Virtumart Template - CleanMart Virtumart Template - CleanMart

Fully responsive!

Buy Now   |   Live Demo