Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with State/County field in checkout.


Recommended Posts

Posted

If I make the display of "State" true in admin/customer details, I get this error:

 

Please select a state from the States pull down menu.

 

After trawling the forum for days, it seems that this is some failure of validation, but I don't need any checks on the validity of state/country names, as I'm in the UK.

 

So how can I remove whatever check is stopping my customers from entering a state/county? I know very little about coding, but I can follow instructions. I have Fast Easy Checkout installed, and a mod that autoupdates the shopping cart.

 

All I want is a box where customers can compulsorily enter their state/county information and to have that information passed to me when a customer buys something. I don't need any validation of what they enter.

 

If anyone can help me on this, I'd be very grateful.

 

My site is here, if that helps.

Posted

Dave

 

I had this problem. Very annoying, especially as 'County' in the UK has no real status and certainly shouldn't be forced. What would customers in London or Manchester put? Using County is not a Royal Mail requirement.

 

I just hacked the code - esp in address_book_details and made the use of the State field the same as, for instance, street_address.

 

I used notepad++ to search all files for occurrences of "ENTRY_STATE" and changed all the code - mostly just deletions.

 

Alan

Posted
Dave

 

I had this problem. Very annoying, especially as 'County' in the UK has no real status and certainly shouldn't be forced. What would customers in London or Manchester put? Using County is not a Royal Mail requirement.

 

I just hacked the code - esp in address_book_details and made the use of the State field the same as, for instance, street_address.

 

I used notepad++ to search all files for occurrences of "ENTRY_STATE" and changed all the code - mostly just deletions.

 

Alan

Thanks for that Alan, you talked me into hacking my shop without me following someone else's instructions! As I have FEC installed, the file that seemed most obvious to try hacking was create_account1.php (which is the FEC option that I use).

 

And it seems to have worked.

 

For others with FEC installed, and the "Please select a state from the States pull down menu" problem, here's what I did. I don't know if it does any other harm (I've only just tried it),or if it will work for you, but it certainly stops the "Please select a state from the States pull down menu" error for me, and I get a plain text box for the state/county, and the state/county info is shown on the next page of checkout.

 

I commented out this section of create_account1.php (lines 229-252, for me):

	if (ACCOUNT_STATE == 'true') {
	$zone_id = 0;
	$check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
	$check = tep_db_fetch_array($check_query);
	$entry_state_has_zones = ($check['total'] > 0);
	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('create_account', ENTRY_STATE_ERROR_SELECT);
		}
		} else {
		if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
			$error = true;
			$messageStack->add('create_account', ENTRY_STATE_ERROR);
		}
	}
}

 

like this:

 

	/*if (ACCOUNT_STATE == 'true') {
	$zone_id = 0;
	$check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
	$check = tep_db_fetch_array($check_query);
	$entry_state_has_zones = ($check['total'] > 0);
	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('create_account', ENTRY_STATE_ERROR_SELECT);
		}
		} else {
		if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
			$error = true;
			$messageStack->add('create_account', ENTRY_STATE_ERROR);
		}
	}
}*/

 

Thanks again for your help Alan.

Archived

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

×
×
  • Create New...