VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: shankar on December 28, 2012, 05:39:10 AM

Title: Virtuemart State / Province / Region not showing in dropdown
Post by: shankar on December 28, 2012, 05:39:10 AM
Hi,


I am using virtue mart 2.0.16
i have a problem in this when we are select county the country related State / Province / Region are not showing

see the attachment

Thank you

[attachment cleanup by admin]
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: jenkinhill on December 28, 2012, 12:15:55 PM
Check for JavaScript conflicts.  http://dev.virtuemart.net/projects/virtuemart/wiki/General_JS-Problems_with_templates_and_jQuery
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: shankar on December 28, 2012, 12:48:26 PM
Hi,

I am fallowing same but not showing, what is the problem

thank you
Title: confirm purchase button not working....JQuery? (Desperate)
Post by: inboxmarketing on April 11, 2013, 08:10:41 AM
Can anyone help me?

On checkout page "update qty" and "delete" and "confirm puchase" dont do anything...

they post to mootools  but nothing comes back

any combinations of "use google jquery" etc will not effect changes...

reqeust headers
POST /index.php/en/component/virtuemart/view/index.php?type=onepage&opc_task=set_checkout&hfdikqci HTTP/1.1
Host: danceeverythingwarehouse.com
Connection: keep-alive
Content-Length: 622
Accept: application/json
Origin: http://danceeverythingwarehouse.com
X-Requested-With: XMLHttpRequest
X-Request: JSON
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31
Content-type: application/x-www-form-urlencoded; charset=UTF-8
Referer: http://danceeverythingwarehouse.com/index.php/en/component/virtuemart/view/cart
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: jpanesliders_content-sliders-=0; jpanesliders_permissions-sliders-=0; manufacturer10=1; manufacturer8=1; manufacturer6=1; manufacturer11=1; jpanesliders_permissions-sliderscom_content=0; jpanesliders_plugin-sliders-10101=0; jpanesliders_module-sliders=0; jpanesliders_sliders=0; jpanesliders_permissions-sliders=0; configuration=site; jpanesliders_panel-sliders=0; jpanesliders_position-icon=0; aaab0bdac259ac8adc5bd6c4c2865e4c=58ec0e0b1a02d7d4148ec52d93d6e266; jpanesliders_menu-sliders-103=0; jpanesliders_menu-sliders-132=0; jpanesliders_menu-sliders-106=0; jpanesliders_menu-sliders-104=0; jpanesliders_menu-sliders-133=0; jpanesliders_menu-sliders-134=0; jpanesliders_menu-sliders-101=0; shipmentmethod2=1; uservm-user=0; paymentmethod1=1; ce2da5f0c5e1652068a9aa8ca9620854=ec271361898c05d783b137b2568e6696; accordeon=4; config=2; vmapply=2; 941bd606550af7f2998ceff5075ec6cd=en-GB


response headers
HTTP/1.0 200 OK
Date: Thu, 11 Apr 2013 05:59:57 GMT
Server: Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
X-Powered-By: PHP/5.3.18
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM", CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Cache-Control: no-cache, no-cache, no-cache
Pragma: no-cache, no-cache, no-cache
Content-Encoding: gzip
X-Content-Encoded-By: Joomla! 2.5
Set-Cookie: 941bd606550af7f2998ceff5075ec6cd=en-GB; expires=Fri, 11-Apr-2014 05:59:57 GMT; path=/
Content-Type: text/html; charset=utf-8
X-Cache: MISS from tx33vspep2db
Connection: close


Rest of the site works as expected.....

And of course ready to go live like now.....

http://www.danceeverythingwarehouse.com

yes tried .....Check for JavaScript conflicts.  http://dev.virtuemart.net/projects/virtuemart/wiki/General_JS-Problems_with_templates_and_jQuery
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: jenkinhill on April 11, 2013, 10:36:45 AM
Test using Beez template to rule out issues with your artisteer template, template overrides etc
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: inboxmarketing on April 11, 2013, 10:59:05 AM
ok so the default template works what does this mean to me now?

Or what have I done?

And more importantly what can I do to fix it? :)

many thanks in advance
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: jenkinhill on April 11, 2013, 23:11:55 PM
You have ruled out an issue with your VirtueMart installation or the server environment. Next step is to try your Artisteer template but without additional modules that may use JavaScript. If that is OK then add in your modules testing each one as you go to locate the problem one.

Unfortunately too many people have problems using Artisteer, either with JS or the css files the system creates, so that6 is the first thing to rule out - or not.
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: DaveOzric on May 21, 2013, 20:59:48 PM
I too am using Artisteer and the state is not showing. I may have to resort to using a default template but can't get it to stay on that template. I assign the menu item to beez but when I go to my cart it's back to the Artisteer template. I can't switch the whole site. Why is it going to the component in the URL.
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: DaveOzric on May 21, 2013, 22:19:10 PM
OK, it must be something else. I just install on a different Joomla 2.5 site and used the Atomic template and still no state dropdown. Do you have to setup a state list first?

Here's my specs if you need them.
PHP 5.3.24
Joomla 2.5.11
Site with Artisteer is 2.5.9 (compatibility issue with plugin can't update)
VM 2.0.20b
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: DaveOzric on May 21, 2013, 23:15:25 PM
That's definitely not it. I uninstalled everything and am using Atomic template and it still doesn't work.

Also, I am unable to add the state to the shop in the backend. I opened up the virtuemart_state_id and tried to add something but it didn't help either.

Any ideas?

Thanks
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: Stonedfury on May 21, 2013, 23:20:52 PM
Link?
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: DaveOzric on May 21, 2013, 23:28:39 PM
Here is the test site. http://cosmicperception.com/ (http://cosmicperception.com/)
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: Stonedfury on May 22, 2013, 17:40:03 PM
No country no state. //<![CDATA[
jQuery( function($) {
$("select.virtuemart_country_id").vm2front("list",{dest : "#virtuemart_state_id",ids : ""});
});
//]]>
being loaded to your site but you have no countries to select from so you have no states loaded. :( That's what I see as a problem.
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: DaveOzric on May 22, 2013, 18:08:51 PM
OK, not sure what happened but I was able to enter the state in the shop setup in the backend and then it fixed the frontend. I swear I tried that and it wouldn't let me, it was just blank.

Thanks for all your help and sending me in the right direction.

Cheers
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: SiberianTiger on November 21, 2013, 23:27:51 PM
Hello!

Can someone please help me to solve the same problem with my website: http://agenty-buduschego.ru/

It's single-language in Russian, but the problem is visible when you go by the user registration link:
https://agenty-buduschego.ru/index.php?option=com_virtuemart&view=user&lang=ru

Whichever country is chosen (even the USA), the state/province dropdown (one at the bottom) is empty.

I have all the required countries and states published and they are visible in the backend.

Tried different combos of ticks in "Activate Css Styles & Javascripts" section of the shop config, but neither worked.

The joomla template is derived from Atomic and has no attached custom jQuery library.

Joomla verison: 2.5.16
Virtuemart version: 2.0.22d
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: Maxim Pishnyak on November 22, 2013, 09:14:01 AM
Screen shot of your combos, also see http://forum.virtuemart.net/index.php?topic=119638.0
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: SiberianTiger on November 22, 2013, 10:35:19 AM
Quote from: Maxim Pishnyak on November 22, 2013, 09:14:01 AM
Screen shot of your combos, also see http://forum.virtuemart.net/index.php?topic=119638.0

Hi Maxim,

The current combos are as pictured:
(http://s5.hostingkartinok.com/uploads/images/2013/11/52986db834e0d719e122d627a1349f70.png)

This caused the effect:
(http://s3.hostingkartinok.com/uploads/images/2013/11/06160799d76831d775aaa83756a87429.png)

Installed the firebug, it shows the empty dropdown content for the combo and the following GET request sent and error code returned for it:

GET https://agenty-buduschego.ru/index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id=176&lang=ru

303 See other 472ms


Interesting that in the response header I can see http protocol, not https, can this be related to the issue? My website is running on SSL whole.

Response Headers
Connection keep-alive
Content-Length 0
Content-Type text/html; charset=utf-8
Date Fri, 22 Nov 2013 09:23:16 GMT
Location http://agenty-buduschego.ru/index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id=176&lang=ru
Server nginx/1.1.10

Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: Maxim Pishnyak on November 22, 2013, 10:42:30 AM
http://www.virtuemart.net.ua/en/payment/94-ssl-https
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: SiberianTiger on November 22, 2013, 12:02:24 PM
Quote from: Maxim Pishnyak on November 22, 2013, 10:42:30 AM
http://www.virtuemart.net.ua/en/payment/94-ssl-https

This setting "Enable SSL for sensitive areas (recommended)" is on for me.
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: Maxim Pishnyak on November 22, 2013, 14:45:12 PM
httpfox was mentioned there also. Give it a try.
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: SiberianTiger on December 03, 2013, 15:22:50 PM
When I directly use the GET request in my browser address line, I can see a correct JSON data containing Russia's regions and their codes is returned.

The example output is:
{"virtuemart_state_id":"749","virtuemart_vendor_id":"1","virtuemart_country_id":"176","virtuemart_worldzone_id":"0","state_name":"\u0427\u0435\u0447\u0435\u043d\u0441\u043a\u0430\u044f \u0420\u0435\u0441\u043f\u0443\u0431\u043b\u0438\u043a\u0430","state_3_code":"CE","state_2_code":"20","ordering":"0","shared":"0","published":"1","created_on":"0000-00-00 00:00:00","created_by":"0","modified_on":"0000-00-00 00:00:00","modified_by":"0","locked_on":"0000-00-00 00:00:00","locked_by":"0"},{"virtuemart_state_id":"750","virtuemart_vendor_id":"1","virtuemart_country_id":"176","virtuemart_worldzone_id":"0","state_name":"\u0427\u0443\u0432\u0430\u0448\u0441\u043a\u0430\u044f \u0420\u0435\u0441\u043f\u0443\u0431\u043b\u0438\u043a\u0430","state_3_code":"CU","state_2_code":"21","ordering":"0","shared":"0","published":"1","created_on":"0000-00-00 00:00:00","created_by":"0","modified_on":"0000-00-00 00:00:00","modified_by":"0","locked_on":"0000-00-00 00:00:00","locked_by":"0"},{"virtuemart_state_id":"811","virtuemart_vendor_id":"1","virtuemart_country_id":"176","virtuemart_worldzone_id":"0","state_name":"\u0427\u0443\u043a\u043e\u0442\u0441\u043a\u0438\u0439 \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u044b\u0439 \u043e\u043a\u0440\u0443\u0433","state_3_code":"CHU","state_2_code":"87","ordering":"0","shared":"0","published":"1","created_on":"0000-00-00 00:00:00","created_by":"0","modified_on":"0000-00-00 00:00:00","modified_by":"0","locked_on":"0000-00-00 00:00:00","locked_by":"0"},{"virtuemart_state_id":"812","virtuemart_vendor_id":"1","virtuemart_country_id":"176","virtuemart_worldzone_id":"0","state_name":"\u042f\u043c\u0430\u043b\u043e-\u041d\u0435\u043d\u0435\u0446\u043a\u0438\u0439 \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u044b\u0439 \u043e\u043a\u0440\u0443\u0433","state_3_code":"YAN","state_2_code":"89","ordering":"0","shared":"0","published":"1","created_on":"0000-00-00 00:00:00","created_by":"0","modified_on":"0000-00-00 00:00:00","modified_by":"0","locked_on":"0000-00-00 00:00:00","locked_by":"0"},


Still, the dropdown box is not populated.

So, the problem rounds down to the way how this dropdown is filled by entries.
I wonder, which piece of code is supposed to do that?

May it be
administrator/components/com_virtuemart/views/state/view.html.php
administrator/components/com_virtuemart/models/state.php
components/com_virtuemart/controllers/state.php
?

Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: SiberianTiger on December 13, 2013, 10:33:18 AM
Ok, so it appear the issue is in the following piece:

administrator/components/com_virtuemart/helpers/config.php

static function JcountryStateList($stateIds, $prefix='') {
static $JcountryStateList = array();
// If exist exit
if (isset($JcountryStateList[$prefix]) or !VmConfig::get ('jsite', TRUE)) {
return;
}
$document = JFactory::getDocument();
VmJsApi::jSite();
$document->addScriptDeclaration('
//<![CDATA[
jQuery( function($) {
$("#'.$prefix.'virtuemart_country_id").vm2front("list",{dest : "#'.$prefix.'virtuemart_state_id",ids : "'.$stateIds.'",prefiks : "'.$prefix.'"});
});
//]]>
');
$JcountryStateList[$prefix] = TRUE;
return;
}


This makes a jQuery API call to the $ function in components/com_virtuemart/assets/js/vmsite.js:

(function($){
var undefined,
methods = {
list: function(options) {
var dest = options.dest;
var ids = options.ids;
var prefix = options.prefiks;
            methods.update(this,dest,ids,prefix);
$(this).change( function() { methods.update(this,dest,ids,prefix)});

},
update: function(org,dest,ids,prefix) {
var opt = $(org),
optValues = opt.val() || [],
byAjax = [] ;
if (!$.isArray(optValues)) optValues = jQuery.makeArray(optValues);
if ( typeof  oldValues !== "undefined") {
//remove if not in optValues
$.each(oldValues, function(key, oldValue) {
if ( ($.inArray( oldValue, optValues )) < 0 ) $("#"+prefix+"group"+oldValue).remove();
});
}
//push in 'byAjax' values and do it in ajax
$.each(optValues, function(optkey, optValue) {
if( opt.data( 'd'+optValue) === undefined ) byAjax.push( optValue );
});

if (byAjax.length >0) {
$.getJSON('index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id=' + byAjax,
function(result){

// Max Bitte Testen
var virtuemart_state_id = $('#'+prefix+'virtuemart_state_id');
var status = virtuemart_state_id.attr('required');

if(status == 'required') {
if( result[byAjax].length > 0 ) {
virtuemart_state_id.attr('required','required');
} else {
virtuemart_state_id.removeAttr('required');
}
}

// ENDE

$.each(result, function(key, value) {
if (value.length >0) {
opt.data( 'd'+key, value );
} else {
opt.data( 'd'+key, 0 );
}
});
methods.addToList(opt,optValues,dest,prefix);
if ( typeof  ids !== "undefined") {
var states =  ids.length ? ids.split(',') : [] ;
$.each(states, function(k,id) {
$(dest).find('[value='+id+']').attr("selected","selected");
});
}
$(dest).trigger("liszt:updated");
}
);
} else {
methods.addToList(opt,optValues,dest,prefix)
$(dest).trigger("liszt:updated");
}
oldValues = optValues ;

},
addToList: function(opt,values,dest,prefix) {
$.each(values, function(dataKey, dataValue) {
var groupExist = $("#"+prefix+"group"+dataValue+"").size();
if ( ! groupExist ) {
var datas = opt.data( 'd'+dataValue );
if (datas.length >0) {
var label = opt.find("option[value='"+dataValue+"']").text();
var group ='<optgroup id="'+prefix+'group'+dataValue+'" label="'+label+'">';
$.each( datas  , function( key, value) {
if (value) group +='<option value="'+ value.virtuemart_state_id +'">'+ value.state_name +'</option>';
});
group += '</optgroup>';
$(dest).append(group);

}
}
});
}
};

$.fn.vm2front = function( method ) {

if ( methods[method] ) {
  return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
} else if ( typeof method === 'object' || ! method ) {
return methods.init.apply( this, arguments );
} else {
  $.error( 'Method ' +  method + ' does not exist on Vm2 front jQuery library' );
}   

};
})(jQuery)


As a result, I'm having a
Quote303 See other (206ms) at jquery.min.js (line 18)

Please find below the request and response headers I'm having:

Request:
Accept application/json, text/javascript, */*; q=0.01
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Cookie 4eb57c2cab77304872032c29b810ab83=ru-RU; 4eb57c2cab77304872032c29b810ab83=ru-RU; ce03aacdace0d694b35279c3e291619f=1D444611571757575C+3415E1460+D+0+010+8565765+F56511712144445+31715115C105647+31469+3+A+6445150525552434A; 192fa9b374f512ee8093cd079b0847d4=071054c64d78b443fc3e47e43ec5d9d8
Host agenty-buduschego.ru
Referer https://agenty-buduschego.ru/index.php?option=com_virtuemart&view=user&layout=edit&lang=ru
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
X-Requested-With XMLHttpRequest


Response:
Connection keep-alive
Content-Length 0
Content-Type text/html; charset=utf-8
Date Fri, 13 Dec 2013 09:29:10 GMT
Location http://agenty-buduschego.ru/index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id=176&lang=ru
Server nginx


Virtuemart dev, please help to resolve this, this issue is holding my business from opening. I don't want yet to trash the otherwise fine store extension in favor of some different one.
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: admiss on January 09, 2014, 11:16:24 AM
Virtuemart 2.0.22b
Joomla 2.5

States in back end are published, but not visible(chooseable) on the site.

Uncaught TypeError: Object [object Object] has no method 'chosen'        >>> user-account:78

$(".vm-chzn-select").chosen({enable_select_all: true,select_all_text : vm2string.select_all_text,select_some_options_text:vm2string.select_some_options_text});


view-source:http://www.foodhungary.co.uk/user-account


Appreciate any help .
Thanks

[attachment cleanup by admin]
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: jenkinhill on January 09, 2014, 12:52:54 PM
You have a JavaScript conflict as notified here:  http://forum.virtuemart.net/index.php?topic=117697.msg414268#msg414268
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: greenkey on July 30, 2015, 19:46:43 PM
Well, if somebody has problem with virtuemart region select (regions not showing), be careful:

If you are using nginx, and set sef url, such as:
try_files $uri $uri/ /index.php?q=$request_uri;

you must create a little fix here:
/components/com_virtuemart/assets/js/vmsite.js

find a string:
$.getJSON('index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id=' + byAjax,

and replace with:
$.getJSON('/index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id=' + byAjax,

it solve problem with region seelction.

This problem is actual for Virtuemart 3.0.9
Title: can you look at my page
Post by: Jason dsg on November 30, 2015, 08:09:11 AM
I just have removed my joomla site loaded a fresh site with a rocket them templet it has gantry 5 i checked the bees templet i have no states on there as well I'm also going to need to pay someone to do some edits or have someone help me i don't want to give out my passwords for help thanks www.dsgcentral.com
Title: Re: Virtuemart State / Province / Region not showing in dropdown
Post by: GJC Web Design on November 30, 2015, 08:50:05 AM
you have 2 js errors

SyntaxError: expected expression, got keyword 'var'
http://www.dsgcentral.com/components/com_virtuemart/assets/js/vmsite.js?vmver=9058
Line 52

TypeError: $(...).vm2front is not a function
http://www.dsgcentral.com/user/editaddresscartBT
Line 715

I don't see any menus.. have u a menu to the VM frontpage and one to the cart?