News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

$("#'.$prefix.'virtuemart_country_id").vm2front is not a function

Started by jorgepracticum, October 14, 2015, 18:02:59 PM

Previous topic - Next topic

jorgepracticum

Hi
I'm trying to display my shop in my frontend. But when i check the console i see this message:
Quote$("#'.$prefix.'virtuemart_country_id").vm2front
With this error my page doesn't load all the javascript code so i had to comment one line in this file:
Quoteadministrator/components/com_virtuemart/helpers/vmjsapi.php
and the line to comment was:
jQuery( function($) {
                               //The next line i had to comment
                       //$("#'.$prefix.'virtuemart_country_id").vm2front("list",{dest : "#'.$prefix.'virtuemart_state_id",ids : "'.$stateIds.'",prefiks : "'.$prefix.'"});
     });

This is not a real solution, so can anyone help me?
I'm using Joomla 3.4.4 and VM 3
Regards

Studio 42

This is a quote problem here. Or you need to escape or change quotes.
the code should something so to give the right result :
$js = 'jQuery( function($) {
       $("#'.$prefix.'virtuemart_country_id").vm2front("list",{dest : "#'.$prefix.'virtuemart_state_id",ids : "'.$stateIds.'",prefiks : "'.$prefix.'"});
});';

But i have not the full code to check your quote problem now. This can be in some VM release only.

jorgepracticum

Hi
This is more code lines:
VmJsApi::jSite();
                self::addJScript('vm.countryState'.$prefix,'
//<![CDATA[
                jQuery( function($) {
                        //$("#'.$prefix.'virtuemart_country_id").vm2front("list",{dest : "#'.$prefix.'virtuemart_state_id",ids : "'.$stateIds.'",prefiks : "'.$prefix.'"});
                });
//]]>
                ');

Studio 42

The full code is :
static function JcountryStateList($stateIds, $prefix='') {
static $JcountryStateList = array();
if (isset($JcountryStateList[$prefix]) or !VmConfig::get ('jsite', TRUE)) {
return;
}
VmJsApi::jSite();
self::addJScript('vm.countryState'.$prefix,'
//<![CDATA[
jQuery( function($) {
$("#'.$prefix.'virtuemart_country_id").vm2front("list",{dest : "#'.$prefix.'virtuemart_state_id",ids : "'.$stateIds.'",prefiks : "'.$prefix.'"});
});
//]]>
');
$JcountryStateList[$prefix] = TRUE;
return;
}

And is full valid.
Or you have a server setting/problem, or a bad VM release.
Try to update virtuemart or check with your provider.
You can remove CDATA if you use html4 or html5 , because this is only to be xhtml valid, perhaps this help.
But in all case the problem is not the code here.

Regards,
Patrick

jorgepracticum

I've removed CDATA but I still have the same problem
I think that the component or my web doesn't charge all the libraries
The real problem is the function vm2front, the web doesn't recognize it

Studio 42

CHeck your VM config in "template" tab.
if Using the Script ajax Countries / Regions is checked.
And perhaps the problem can come from your template. Try default protostar template.
If this not work, Send a link to your site, then someone can verify if some javascript files are not loaded.

jorgepracticum

Hi
I'm using the script ajax Countries / Regions
If is not checked that option, the website load properly
So if this is not necessary I think I'll disactivate
For verify if some javascript files are not loaded, do you need administration permissions?

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Studio 42

You need this script to get region for countries
Quote from: jorgepracticum on October 16, 2015, 11:33:51 AM
Hi
I'm using the script ajax Countries / Regions
If is not checked that option, the website load properly
So if this is not necessary I think I'll disactivate
For verify if some javascript files are not loaded, do you need administration permissions?