Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Create Account State as a Dropdown


spoma

Recommended Posts

I have looked around and I see a number of add-ons to make the State (with a country of United States) a dropdown.  However, I have not gone this path because it appears to me that the code is already in oscommerce 2.3 that I am using.  

 

I am looking in the create_account.php file and there is a series of if and else that should make it a dropdown however I am ending up at the else which is to draw an input field. 

    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');
    }

I have been tracing my way through this file trying to figure out what is occurring.  From what I can tell I have two problems.  The first problem is that $process != true and so it skips most of this and goes to the else at the bottom.  However, for testing purposes I changed the if statement to be if ($process == true || $process == false) and it gets past this line and then I find that the next if statement fails.  So $entry_state_has_zones != true.  If I go about the same process and force this to true I then end up with the dropdown that I am selecting.

 

Can anyone help me out with what might make $process = false and $entry_state_has_zones = false?   The only country that is available for my website is United States which is ID 223 and $country always appears to be set to 223.

 

Any help would be greatly appreciated.  Thanks.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...