cherubrock74 Posted October 30, 2009 Posted October 30, 2009 When creating a new account, the US states drop down menu does not appear, showing a text input field instead. If I try to create an account with an email address that is already registered, then the existing email error message correctly appears on top and the form reloads this time showing the drop down menu for the US states! How do I fix this so that the US states drop down menu will show the first time I am filling the account form?
kuai Posted November 2, 2009 Posted November 2, 2009 When creating a new account, the US states drop down menu does not appear, showing a text input field instead. If I try to create an account with an email address that is already registered, then the existing email error message correctly appears on top and the form reloads this time showing the drop down menu for the US states! How do I fix this so that the US states drop down menu will show the first time I am filling the account form? I don't know if this is what you're trying to do, but this will automatically display the U.S. in your forms: Move Country to Top of DropBox You may want to move your country to the top of the country drop down list to make it easier for most of your clients to find their country. We will use United States for an example. To move "United States" to the top of the drop down box do one of the following. 1. This removes the "Please Select" bit of the drop down but United States appears at the top in the create_account.php. It also changes the checkout_payment_address.php, checkout_shipping_address.php and address_book_process.php pages. Open catalog/includes/functions/html_output.php and find the following line about line 289: $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT)) ; Change To: $countries_array = array(array('id' => '223', 'text' => 'United States')) ; 2. This leaves "Please Select" and highlightes the United States in the drop down box leaving the United States in the same order but only works for this one page, create_account.php. It does not affect the checkout_payment_address.php, checkout_shipping_address.php and address_book_process.php pages. In catalog/create_account.php about line 442 Find: echo tep_get_country_list('country') Change To: echo tep_get_country_list('country', '223') Good Luck
cherubrock74 Posted November 2, 2009 Author Posted November 2, 2009 Hi Kuai and Bryce Jr and thanks for your replies. I forgot to mention that I used a "force country" script that I downloaded from the OScommerce contributions page... Is it what is causing the issue?
cherubrock74 Posted November 2, 2009 Author Posted November 2, 2009 Hi Kuai and Bryce and thanks for your replies I forgot to mention I used a "force Country" script that I downloaded from the oscommerce contributions page. Is it what is causing the issue? I will look at the code that is listed in the post and try to figure something out... If anyone has a quicker solution please consider my issue still unsolved :) Look forward to receiving your replies based on the new information posted
cherubrock74 Posted November 2, 2009 Author Posted November 2, 2009 sorry for the double post I am still trying to figure out why the state list is displayed as text and not as drop down menu. When I get an error in the form and I have to go back to correct, then the state list DOES shows up as drop down list... Can someone help? So far this is what I found in the create_account file that relates to the state list: 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 = '" . 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 { $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); and this one: <?php if ($process == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } echo tep_draw_pull_down_menu('state', $zones_array); } else { echo tep_draw_input_field('state'); } } else { echo tep_draw_input_field('state'); } if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT; ?>
sandwd Posted April 9, 2010 Posted April 9, 2010 Hi, I was having the same problem, here is how i solved it change this: <?php if ($process == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } echo tep_draw_pull_down_menu('state', $zones_array); } else { echo tep_draw_input_field('state'); } } else { echo tep_draw_input_field('state'); } if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT; ?> for this: <?php $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } echo tep_draw_pull_down_menu('state', $zones_array); if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT; ?> -Excuse my poor English-
spooks Posted April 9, 2010 Posted April 9, 2010 Hi, I was having the same problem, here is how i solved it change this: <?php if ($process == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } echo tep_draw_pull_down_menu('state', $zones_array); } else { echo tep_draw_input_field('state'); } } else { echo tep_draw_input_field('state'); } if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT; ?> for this: <?php $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name"); while ($zones_values = tep_db_fetch_array($zones_query)) { $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } echo tep_draw_pull_down_menu('state', $zones_array); if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT; ?> nice effort, but you forgot to allow for countries that you have no zones for in the dbase!! Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.