Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New Account


CyberMaster

Recommended Posts

When someone signs up to my site, it asks for a state if your choose United Kingdom as a country.

 

When London is chosen frm the drop down menu, the form does not get sent.

 

It works with all other areas.

 

Any ideas why or how to fix?

 

 

Thanks

 

CyberMaster

Link to comment
Share on other sites

  • 2 weeks later...

I just found this problem this morning and was surprised that I couldn't really find a fix for it on the forums. Anyway, the problem is caused because 'London' is very similar to 'Londonderry', which causes the address validation to get confused. Change the code around line 104 in address_book_process.php from this:

if ($entry_state_has_zones == true) {
	$zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");
	if (tep_db_num_rows($zone_query) == 1) {
	  $zone = tep_db_fetch_array($zone_query);
	  $zone_id = $zone['zone_id'];
	} else {
	  $error = true;

	  $messageStack->add('addressbook', ENTRY_STATE_ERROR_SELECT);
	}

 

to this:

if ($entry_state_has_zones == true) {	
	$zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name = '" . tep_db_input($state) . "' or zone_code = '" . tep_db_input($state) . "')");
	if (tep_db_num_rows($zone_query) == 1) {
	  $zone = tep_db_fetch_array($zone_query);
	  $zone_id = $zone['zone_id'];
	} else {
		$zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");
		if (tep_db_num_rows($zone_query) == 1) {
		  $zone = tep_db_fetch_array($zone_query);
		  $zone_id = $zone['zone_id'];
		} else {   
		  $error = true;
		  $messageStack->add('addressbook', ENTRY_STATE_ERROR_SELECT);
		}
	}

 

that seemed to fix it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...