Skip to content

Commit

Permalink
States pull down menu error when creating account (#5711)
Browse files Browse the repository at this point in the history
Fixes issue #5707
When submitting create account form, message 'Please select a state from the States pull down menu.' appears although state field (input text) has been properly filled.
Only when 'Configuration>Customers Details>State field - Display as pulldown when possible?' is set to false and has zones defined.
  • Loading branch information
piloujp committed Jul 14, 2023
1 parent e7abe19 commit e3c022f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion includes/modules/checkout_new_address.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
$check_query = $db->bindVars($check_query, ':zoneCountryID', $country, 'integer');
$check = $db->Execute($check_query);
$entry_state_has_zones = ($check->fields['total'] > 0);
if ($entry_state_has_zones == true) {
if ($entry_state_has_zones == true && ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN === 'true') {
$zone_query = "SELECT distinct zone_id, zone_name, zone_code
FROM " . TABLE_ZONES . "
WHERE zone_country_id = :zoneCountryID
Expand Down
2 changes: 1 addition & 1 deletion includes/modules/create_account.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
$check_query = $db->bindVars($check_query, ':zoneCountryID', $country, 'integer');
$check = $db->Execute($check_query);
$entry_state_has_zones = ($check->fields['total'] > 0);
if ($entry_state_has_zones == true) {
if ($entry_state_has_zones == true && ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN === 'true') {
$zone_query = "SELECT distinct zone_id, zone_name, zone_code
FROM " . TABLE_ZONES . "
WHERE zone_country_id = :zoneCountryID
Expand Down

1 comment on commit e3c022f

@piloujp
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked that and found another way fix both original and new bug.
Precedent commit adding -- && ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN === 'true'-- should be removed and line (87 for Checkout_new_address.php and 206 for create_account.php) should be changed from
((trim($state) != '' && $zone_id == 0) ? "(upper(zone_name) like ':zoneState%' OR upper(zone_code) like '%:zoneState%') OR " : "") .
to
((trim($state) != '' && $zone_id == false) ? "(upper(zone_name) like ':zoneState%' OR upper(zone_code) like '%:zoneState%') OR " : "") .
Please have a look at it.

Please sign in to comment.