States dropdown box are not shown

  • Posts: 112
  • Thank you received: 0
12 years 9 months ago #18515

Hi Support!

I came across an weird behavior of hikashop registration form. I use the same form on two pages: Checkout and Registration Form.
On the Checkout page the States are not showing up, but on the Registration Form page they are. Please see a screenshot for details.

Any idea as to why this can be happening?

Thank you in advance.

File Attachment:

File Name: States.doc
File Size:774 KB

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
12 years 9 months ago #18537

Could you give a link to your shop ?
I'm guessing it must be related to a javascript error...

Please Log in or Create an account to join the conversation.

  • Posts: 112
  • Thank you received: 0
12 years 9 months ago #18547

My website in not hosted and not published yet - it's all on my laptop. I'm not sure how to give you access to my private network. Do you have any suggestion?

Please Log in or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
12 years 9 months ago #18548

So, look at the javascript error console of your browser while displaying the checkout page.
There is a good chance that there is a javascript error stopping the javascript process of the page and thus the state dropdown display. If you can copy/paste it here...
Also, if you can copy/paste the headers of the page, that would help as well.

Please Log in or Create an account to join the conversation.

  • Posts: 112
  • Thank you received: 0
12 years 9 months ago #18549

I've tried in IE9 and Firefox and can't see any java-script errors while displaying the pages... unless I need to configure my browsers for it?

Here are the headers:

Page where states work:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<html xmlns=" www.w3.org/1999/xhtml " xml:lang="en-gb" lang="en-gb">

<head>
<script type="text/javascript">
var siteurl='/j16events2/';
var tmplurl='/j16events2/templates/ja_events/';
var isRTL = false;
</script>

<base href="http://localhost/j16events2/index.php/sign-up" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, follow" />
<meta name="keywords" content="" />

<meta name="rights" content="" />
<meta name="language" content="en-GB" />
<meta name="generator" content="Joomla! 1.6 - Open Source Content Management" />
<title>Sign Up or Sign In</title>
<link rel="stylesheet" href="/j16events2/t3-assets/css06fdc.css?v=47" type="text/css" />
<script type="text/javascript" src="/j16events2/t3-assets/js11fbe.js"></script>
<script type="text/javascript">
<!--
var hikashop=Array();
hikashop=Array();
hikashop=Array();
//-->
<!--

hikashop = Array('name','username','email','password','password2');
hikashop = Array('Please enter a value for the field name','Please enter a value for the field username','Please enter a value for the field email','Please enter a value for the field password','Please enter a value for the field password2');
hikashop = 'Passwords do not match';
hikashop = 'Please enter a valid e-mail address';
hikashop = Array('address_firstname','address_lastname','address_street','address_city','address_post_code','address_telephone','gender','yearofbirth');
hikashop = Array('Please enter a value for the field First name','Please enter a value for the field Last name','Please enter a value for the field Street','Please enter a value for the field City','Please enter a value for the field Post code','Please enter a value for the field Telephone','Please enter a value for the field Gender','Please enter a value for the field Year of Birth');
hikashop = 'Please enter a valid phone number';
//-->
<!--

function optionValueIndexOf(options,value) {
for (var i=0;i<options.length;i++) {
if (options.value == value) {
return i;
}
}
return -1;
}
function changeState(newvalue){
var defaultValInput = document.getElementById('state_default_value');
var defaultVal = '';
var namekey = false;
if(defaultValInput){
defaultVal = defaultValInput.value;
namekey = document.getElementById('state_namekey').value;
}
if(namekey){
try{
new Ajax('/j16events2/index.php/sign-up/checkout/state/tmpl-component?field_type=address&field_namekey=address_state&namekey='+newvalue, { method: 'get', onComplete: function(result) { old = window.document.getElementById('state_dropdown'); if(old){ old.innerHTML = result;if(namekey) {var stateSelect = document.getElementById(namekey); if(stateSelect && optionValueIndexOf(stateSelect.options, defaultVal) >= 0) stateSelect.value=defaultVal;}}}}).request();
}catch(err){
new Request({url:'/j16events2/index.php/sign-up/checkout/state/tmpl-component?field_type=address&field_namekey=address_state&namekey='+newvalue, method: 'get', onComplete: function(result) { old = window.document.getElementById('state_dropdown'); if(old){ old.innerHTML = result;if(namekey) {var stateSelect = document.getElementById(namekey); if(stateSelect && optionValueIndexOf(stateSelect.options, defaultVal) >= 0) stateSelect.value=defaultVal;}}}}).send();
}
}
}
do_nothing( function(){ changeState(document.getElementById('address_country').value); });

//-->
function keepAlive() { var myAjax = new Request({method: "get", url: "index.php"}).send();} do_nothing( function(){ keepAlive.periodical(840000); });
</script>




<link href="/j16events2/plugins/system/jat3/jat3/base-themes/default/images/favicon.ico" rel="shortcut icon" type="image/x-icon" />


<!--[if IE 7.0]>
<style>
.clearfix { display: inline-block; } /* IE7xhtml*/
</style>
<![endif]-->
<style type="text/css">
#ja-mainnav .main-inner2 {width: 74%;}
</style>

<!-- width for left, right banner -->
<script type="text/javascript">
window.addEvent ('load', function () {
var w = $('ja-wrapper').offsetWidth;
if ($('ja-container') && $('ja-container').getElement('.main')) w -= $('ja-container').getElement('.main').offsetWidth;
w /= 2;
if ($('ja-left-banner')) $('ja-left-banner').setStyle ('width', w);
if ($('ja-right-banner')) $('ja-right-banner').setStyle ('width', w);
//height for top-banner
if ($('ja-header') && $('ja-top-banner')) $('ja-top-banner').setStyle ('height', $('ja-header').offsetHeight);
});
</script>
<style type="text/css">


/*dynamic css*/
body.bd .main {width: 960px;}
body.bd #ja-wrapper {min-width: 960px;}
</style></head>

Page where states don't work:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<html xmlns=" www.w3.org/1999/xhtml " xml:lang="en-gb" lang="en-gb">

<head>
<script type="text/javascript">
var siteurl='/j16events2/';
var tmplurl='/j16events2/templates/ja_events/';
var isRTL = false;
</script>

<base href="http://localhost/j16events2/index.php/hikashop" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, follow" />
<meta name="keywords" content="" />

<meta name="rights" content="" />
<meta name="language" content="en-GB" />
<meta name="generator" content="Joomla! 1.6 - Open Source Content Management" />
<title>Hikashop</title>
<link rel="stylesheet" href="/j16events2/t3-assets/css06fdc.css?v=47" type="text/css" />
<style type="text/css">

#hikashop_category_information_menu_602 div.hikashop_subcontainer {
background:#FFFFFF;
}
#hikashop_category_information_menu_602 .hikashop_rtop *,#hikashop_category_information_menu_602 .hikashop_rbottom *{
background:#FFFFFF;
}

#hikashop_category_information_menu_602 div.hikashop_subcontainer {
text-align:center;
}
#hikashop_category_information_menu_602 div.hikashop_container {
text-align:center;
}

#hikashop_category_information_menu_602 div.hikashop_container {
margin:10px 10px;
}
#hikashop_category_information_menu_602 div.hikashop_category,#hikashop_category_information_menu_602 div.hikashop_product{
float:left;
width:100%;
}

#hikashop_category_information_menu_602 .hikashop_subcontainer {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
border-radius: 5px;
}

</style>
<script type="text/javascript" src="/j16events2/t3-assets/js11fbe.js"></script>

<script type="text/javascript">
<!--

function hikashopModifyQuantity(id,obj,add,form){
if(add){
add='&add=1';
}else{
add='';
}
if(obj){
qty=parseInt(obj.value);
}else{
qty=1;
}
if(form){
var varform = eval('document.'+form);
if(varform){
varform.submit();
}
}else{
try{
new Ajax('/j16events2/index.php/hikashop/product/updatecart/tmpl-component?product_id='+id+'&quantity='+qty+add+'&Itemid=602&return_url=aHR0cDovL2xvY2FsaG9zdC9qMTZldmVudHMyL2luZGV4LnBocC9oaWthc2hvcA%3D%3D', { method: 'get', onComplete: function(result) { var hikaModule = window.document.getElementById('hikashop_cart_module'); if(hikaModule) hikaModule.innerHTML = result;window.location = 'http://localhost/j16events2/index.php/hikashop';}}).request();
}catch(err){
new Request({url:'/j16events2/index.php/hikashop/product/updatecart/tmpl-component?product_id='+id+'&quantity='+qty+add+'&Itemid=602&return_url=aHR0cDovL2xvY2FsaG9zdC9qMTZldmVudHMyL2luZGV4LnBocC9oaWthc2hvcA%3D%3D', method: 'get', onComplete: function(result) { var hikaModule = window.document.getElementById('hikashop_cart_module'); if(hikaModule) hikaModule.innerHTML = result;window.location = 'http://localhost/j16events2/index.php/hikashop';}}).send();
}
}
return false;
}

//-->
<!--
function hikashopCheckCoupon(id){
var el = document.getElementById(id);
if(el){
if(el.value==''){
el.className = 'hikashop_red_border';
return false;
}
el.form.submit();
}
return false;
}
//-->
<!--
var hikashop=Array();
hikashop=Array();
hikashop=Array();
//-->
<!--

hikashop = Array('name','username','email','password','password2');
hikashop = Array('Please enter a value for the field name','Please enter a value for the field username','Please enter a value for the field email','Please enter a value for the field password','Please enter a value for the field password2');
hikashop = 'Passwords do not match';
hikashop = 'Please enter a valid e-mail address';
hikashop = Array('address_firstname','address_lastname','address_street','address_city','address_post_code','address_telephone','gender','yearofbirth');
hikashop = Array('Please enter a value for the field First name','Please enter a value for the field Last name','Please enter a value for the field Street','Please enter a value for the field City','Please enter a value for the field Post code','Please enter a value for the field Telephone','Please enter a value for the field Gender','Please enter a value for the field Year of Birth');
hikashop = 'Please enter a valid phone number';
//-->
<!--

function moveOnMax(field,nextFieldID){
if(field.value.length >= field.maxLength){
document.getElementById(nextFieldID).focus();
}
}
do_nothing( function(){var mySlide_paypal_2 = new Fx.Slide('hikashop_credit_card_paypal_2');
var hikashop_last_opened_slide = mySlide_paypal_2;
$('radio_paypal_2').addEvent('click', function(e){
hikashop_last_opened_slide.toggle();
mySlide_paypal_2.toggle();
hikashop_last_opened_slide = mySlide_paypal_2;
}); });
var ccHikaErrors = new Array ()
ccHikaErrors [3] = 'Credit card number is invalid';
ccHikaErrors [5] = 'Credit card expired';

//-->
do_nothing( function() {
$$('.hasTip').each(function(el) {
var title = el.get('title');
if (title) {
var parts = title.split('::', 2);
el.store('tip:title', parts[0]);
el.store('tip:text', parts[1]);
}
});
var JTooltips = new Tips($$('.hasTip'), { maxTitleChars: 50, fixed: false});
});
<!--

hikashop = Array('name','username','email','password','password2');
hikashop = Array('Please enter a value for the field name','Please enter a value for the field username','Please enter a value for the field email','Please enter a value for the field password','Please enter a value for the field password2');
hikashop = 'Passwords do not match';
hikashop = 'Please enter a valid e-mail address';
hikashop = 'Please enter a valid phone number';
//-->
<!--

function optionValueIndexOf(options,value) {
for (var i=0;i<options.length;i++) {
if (options.value == value) {
return i;
}
}
return -1;
}
function changeState(newvalue){
var defaultValInput = document.getElementById('state_default_value');
var defaultVal = '';
var namekey = false;
if(defaultValInput){
defaultVal = defaultValInput.value;
namekey = document.getElementById('state_namekey').value;
}
if(namekey){
try{
new Ajax('/j16events2/index.php/hikashop/checkout/state/tmpl-component?field_type=address&field_namekey=address_state&namekey='+newvalue, { method: 'get', onComplete: function(result) { old = window.document.getElementById('state_dropdown'); if(old){ old.innerHTML = result;if(namekey) {var stateSelect = document.getElementById(namekey); if(stateSelect && optionValueIndexOf(stateSelect.options, defaultVal) >= 0) stateSelect.value=defaultVal;}}}}).request();
}catch(err){
new Request({url:'/j16events2/index.php/hikashop/checkout/state/tmpl-component?field_type=address&field_namekey=address_state&namekey='+newvalue, method: 'get', onComplete: function(result) { old = window.document.getElementById('state_dropdown'); if(old){ old.innerHTML = result;if(namekey) {var stateSelect = document.getElementById(namekey); if(stateSelect && optionValueIndexOf(stateSelect.options, defaultVal) >= 0) stateSelect.value=defaultVal;}}}}).send();
}
}
}
do_nothing( function(){ changeState(document.getElementById('address_country').value); });

//-->

</script>




<link href="/j16events2/plugins/system/jat3/jat3/base-themes/default/images/favicon.ico" rel="shortcut icon" type="image/x-icon" />


<!--[if IE 7.0]>
<style>
.clearfix { display: inline-block; } /* IE7xhtml*/
</style>
<![endif]-->
<style type="text/css">
#ja-mainnav .main-inner2 {width: 74%;}
</style>

<!-- width for left, right banner -->
<script type="text/javascript">
window.addEvent ('load', function () {
var w = $('ja-wrapper').offsetWidth;
if ($('ja-container') && $('ja-container').getElement('.main')) w -= $('ja-container').getElement('.main').offsetWidth;
w /= 2;
if ($('ja-left-banner')) $('ja-left-banner').setStyle ('width', w);
if ($('ja-right-banner')) $('ja-right-banner').setStyle ('width', w);
//height for top-banner
if ($('ja-header') && $('ja-top-banner')) $('ja-top-banner').setStyle ('height', $('ja-header').offsetHeight);
});

</script>
<style type="text/css">


/*dynamic css*/
body.bd .main {width: 960px;}
body.bd #ja-wrapper {min-width: 960px;}
</style></head>

Last edit: 12 years 9 months ago by lrazov.

Please Log in or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
12 years 9 months ago #18550

It seems that you have a problem with the joomla 1.6 js cache like in that thread: www.hikashop.com/fr/support/forum/5-supp...de-ventes.html#18151
Please try to deactivate the joomla cache (in the configuration and in the cache plugin) and try again.

Please Log in or Create an account to join the conversation.

  • Posts: 112
  • Thank you received: 0
12 years 9 months ago #18553

Both Joomla cache and the plugin cache were off.

Please Log in or Create an account to join the conversation.

  • Posts: 112
  • Thank you received: 0
12 years 9 months ago #18554

I have modified the changeState js function to alert 2 messages out. When I open the Sign Up page, the 2 alerts are being called. When I go onto Checkout page, no alerts are called at all. This tells me that the changeState js function is being called at all.

Please Log in or Create an account to join the conversation.

  • Posts: 112
  • Thank you received: 0
12 years 9 months ago #18555

Did more testing - when one country is enabled hence one country in the Country dropdpwn box, the States dropdown box doesn't show up, when I enabled one more country and changed the value in the country dropdown, the States dropdown box appeared. As soon as I disable the second country so that there is only one country in the box, the States disappear. AS I said before this only happens on checkout page.

Please Log in or Create an account to join the conversation.

  • Posts: 10
  • Thank you received: 0
12 years 9 months ago #18556

I have this exact same problem, we ONLY want to allow shipping to one country, I have disabled all other countries except Australia, I have checked that the states for Australia are published, but no drop down box appears on checkout when you wish to add a billing address etc.

Please Log in or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
12 years 9 months ago #18560

Did you change the default country and the default state in the custom fields address_country and address_state ? Because if that's not the same country as the one you have published, it might create such problem...

Please Log in or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
12 years 9 months ago #18561

By the way, custom fields are to be found in the menu Display->Custom fields.

Please Log in or Create an account to join the conversation.

  • Posts: 112
  • Thank you received: 0
12 years 9 months ago #18581

Yes, the default country is set to Australia (that's the only country I have enabled) and the state is set to Victoria.

Please remember the States box works on one page and doesn't work on another.

Please Log in or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
12 years 9 months ago #18592

Please try to switch to the default template and see if that works. If so that it must be related to the template, else, it comes from something else. Probably a system plugin.

Please Log in or Create an account to join the conversation.

  • Posts: 112
  • Thank you received: 0
12 years 9 months ago #18602

I tried in default template - the issue persists.

Is there a way to modify the code so that the states box is populated statically, I mean not using javascript?

Please Log in or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
12 years 9 months ago #18609

You can try to change the code:
echo $this->fieldsClass->display($oneExtraField,$this->$type->$fieldName,'data');
by:
echo $this->fieldsClass->display($oneExtraField,$this->$type->$fieldName,'data',false,'',true);
in the file custom_fields of the view user via the menu Display->Views.
That should deactivate the state field javascript and display it statically.

Please Log in or Create an account to join the conversation.

  • Posts: 112
  • Thank you received: 0
12 years 9 months ago #18699

Thank you for the code.

I've tried changing it as per your suggestion. Now, I can see the drop down box, but it's empty, on both pages.

Please Log in or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
12 years 9 months ago #18718

What do you mean by "it's empty" ?

Please Log in or Create an account to join the conversation.

  • Posts: 112
  • Thank you received: 0
12 years 9 months ago #18721

Sorry, the states drop down box is empty - no values in the drop down box, pls see the screenshot attached.

File Attachment:

File Name: States2.doc
File Size:282 KB

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
12 years 9 months ago #18736

Mmm. I'm running out of ideas there. Would you be able to put your website online and give us an access to your back end so that we can look at your settings and see the problem directly ?

Please Log in or Create an account to join the conversation.

Time to create page: 0.114 seconds
Powered by Kunena Forum