Forums / Bug Reports / [Done v1.3.9] Drop-down states only show selected state for default country

[Done v1.3.9] Drop-down states only show selected state for default country

Locked

Views: 2,823

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
22 Nov 2009, 7:52 PM
#1
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

[Done v1.3.9] Drop-down states only show selected state for default country

Running 1.38a+FEC+security.

If a customer creates an address-book entry for a country OTHER THAN the store's default country and then goes to update that entry, the drop-down for State/Province shows "Please select" instead of the previously-stored selection.

The selection is in the database (checked via phpMyAdmin). The problem appears to surface within \includes\modules\pages\address_book_process\header_php.php at line 304:

  $selected_country = (isset($_POST['zone_country_id']) && $_POST['zone_country_id'] != '') ? $country : SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY;

This statement, on entry from a 'edit' request, always goes down the 'false' path because at that point, nothing from the form has been posted.

I'm not sure what the 'proper' fix is ... please help.

23 Nov 2009, 12:46 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: [Done v1.3.9] Drop-down states only show selected state for default country

FWIW (if anyone else has this problem), I solved it by changing the line referenced in my first post to:

  if ($process == false) {
    $selected_country = $entry->fields['entry_country_id'];
  } else {
    $selected_country = (isset($_POST['zone_country_id']) && $_POST['zone_country_id'] != '') ? $country : SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY;
  }
29 Nov 2009, 4:35 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: [Done v1.3.9] Drop-down states only show selected state for default country

I found the cool demo site referenced by this post:

http://www.zen-cart.com/forum/showthread.php?p=269379#post269379

The base country for the demo store I ran was US.

I went into admin and changed the State Pulldown's selection to 'true'.

I created a US-based account (you have to press 'refresh' after the e-mail boo-boo message) and went to My Account. I added another address based in Canada, chose Alberta as the province and saved the address.

I then went to update the Canada-based address. The state pulldown showed 'Please select...' instead of 'Alberta'.