Dallas1906 Posted January 9, 2003 Share Posted January 9, 2003 This is my first time adding something but I know a lot of people from the states needed a dropdown list for the Create Account page ( i did too), so I added one in, its very simple so listen up step 1: go to the file catalog/includes/modules/account_details.php step 2: find the portion of code that is dealing with states you should see something like this if (ACCOUNT_STATE == 'true') { Thats the beginning of the portion of code. dont touch that though step 3: go to the last else of that php block and remove its contents I think it starts with echo tep_draw_input_field step 4: replace with: $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . $account['entry_country_id'] . "' 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) . ' ' . ENTRY_STATE_TEXT; step 5: save your code and it should bring up a drop down list (dont forget to check that all your code end with correct semi-colons and brackets are closed correctly) HAVE A NICE LIFE :lol: Quote --- There are two kinds of people in this world those who are taking care of Business and those who are not, which one are you? Link to comment Share on other sites More sharing options...
hobaugh Posted January 10, 2003 Share Posted January 10, 2003 Here is a correction for the pull down menu. echo tep_draw_pull_down_menu('state', zones_array,tep_get_zone_name($account['entry_country_id'], $account['entry_zone_id'], $account 'entry_state'])) . ' ' . ENTRY_STATE_TEXT; Quote Link to comment Share on other sites More sharing options...
Guest Posted January 10, 2003 Share Posted January 10, 2003 hobaugh, I tried this. I am getting parse error line 282 which is the new (correction) for the pulldown. I inserted the old pulldown code and it seems to work. I have a 01-06-2003 snapshot. What is the difference in the two? -Al Quote Link to comment Share on other sites More sharing options...
hobaugh Posted January 10, 2003 Share Posted January 10, 2003 This is the only difference. tep_get_zone_name($account['entry_country_id'], $account['entry_zone_id'], $account['entry_state']) The old code does not have the state selected if the user goes to edit the account. This code tells the fuction that this state should be selected. Doug [/url] Quote Link to comment Share on other sites More sharing options...
Guest Posted January 10, 2003 Share Posted January 10, 2003 Sorry I was not clear. I see that in the code but when I use it I get the parse error on line 282. When I do not use it everything seems fine. Any thoughts. -Al Quote Link to comment Share on other sites More sharing options...
hobaugh Posted January 10, 2003 Share Posted January 10, 2003 Here is all of the code. Maybe I missed something before. I don't get an error. I'm using the snapshot from around 2002/11/23. $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . $account['entry_country_id'] . "' 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,tep_get_zone_name($account['entry_country_id'], $account['entry_zone_id'], $account['entry_state'])) . ' ' . ENTRY_STATE_TEXT; Quote Link to comment Share on other sites More sharing options...
Guest Posted January 10, 2003 Share Posted January 10, 2003 Sorry I was not clear. I see that in the code but when I use it I get the parse error on line 282. When I do not use it everything seems fine. Any thoughts. -Al Quote Link to comment Share on other sites More sharing options...
Guest Posted January 10, 2003 Share Posted January 10, 2003 That did it. Do you have this in as a contribution? I could not find it. It should be. Nice and easy also. -Al Quote Link to comment Share on other sites More sharing options...
hobaugh Posted January 10, 2003 Share Posted January 10, 2003 No I didn't post this as a contribution. I think that would be Dallas1906 job since it's his code. Doug Quote Link to comment Share on other sites More sharing options...
Guest Posted January 10, 2003 Share Posted January 10, 2003 True: I am using it anyway. It works and I have had requests for it. I just put in my 01-06-2003 install also. -Al By the way. Thanks Quote Link to comment Share on other sites More sharing options...
badjuju Posted January 19, 2003 Share Posted January 19, 2003 Thanks for the code. You can also do the same for address_book details Quote Link to comment Share on other sites More sharing options...
badjuju Posted January 19, 2003 Share Posted January 19, 2003 For address_book_details.php, change $account to $entry. $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . $entry['entry_country_id'] . "' 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,tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state'])) . ' ' . ENTRY_STATE_TEXT; Quote Link to comment Share on other sites More sharing options...
Rumble Posted February 4, 2003 Share Posted February 4, 2003 thanks guys i was looking for this code; $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . $account['entry_country_id'] . "' 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,tep_get_zone_name($account['entry_country_id'], $account['entry_zone_id'], $account['entry_state'])) . ' ' . ENTRY_STATE_TEXT; Life savers! Quote Reddy to Rumble Thank you osCommerce and all who Contribute to her! Link to comment Share on other sites More sharing options...
dzhang Posted February 5, 2003 Share Posted February 5, 2003 The dropdown box is nice. But, it doesn't automatically refresh when the country is changed, and no input is allowed for the new country. I see the current demo at the oscommerce.com site. These problems are solved. States are autometically updated when the country is changed. And there is an input box for entering a state name when zone list is not available. Did I miss anything? or there is an update? where can I get the update? Thanks David Quote David We support osCommerce Link to comment Share on other sites More sharing options...
mcgyver7923 Posted March 26, 2003 Share Posted March 26, 2003 The State drop down works great for me...I have removed country. The only problem is when you click continue after putting in all the information it highlights that field as required. Also it doesn't matter what you then type in for state, it won't register, and continues to say required. Anyone have an idea for this?? Thanks!!! -Richard www.gobeyondwireless.com/catalog/create_account.php Quote -Richard --------------------------------------------------- Where would I be without the Forums?!?! Link to comment Share on other sites More sharing options...
mcgyver7923 Posted April 3, 2003 Share Posted April 3, 2003 I realized that I had to put "Country" back into the sign up page to get it to go through. Thanks!! -Richard Quote -Richard --------------------------------------------------- Where would I be without the Forums?!?! Link to comment Share on other sites More sharing options...
caconline Posted April 26, 2003 Share Posted April 26, 2003 How can this: $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . $account['entry_country_id'] . "' 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,tep_get_zone_name($account['entry_country_id'], $account['entry_zone_id'], $account['entry_state'])) . ' ' . ENTRY_STATE_TEXT; work in checkout_new_address.php? Quote Link to comment Share on other sites More sharing options...
boosterg Posted May 8, 2003 Share Posted May 8, 2003 has anyone found a work around for when you change the country? Quote Link to comment Share on other sites More sharing options...
Guest Posted May 11, 2003 Share Posted May 11, 2003 Having the same problem here.. Has anyone figured out how to automatically update the State/Province dropdown box when Country changes from United States to Canada? Thanks muchly! Quote Link to comment Share on other sites More sharing options...
Daemonj Posted May 11, 2003 Share Posted May 11, 2003 In order to update the state/province list based upon the country selected would require javascript. Since a good majority of users surfing the web have JS disabled, the solution would fail anyway. The only way around that would be a 2-step process - the user selects their country and clicks ok. Then on the next page the list of states/provinces is provided based upon the country entry made on the previous page. Needless to say, this would be a total pain in the arse. Unless you set your front page so that the user selects their country at the beginning but then you would have to create the session early and then carry that information. Not very feasible, especially for robots. Quote "Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein Link to comment Share on other sites More sharing options...
Guest Posted May 14, 2003 Share Posted May 14, 2003 Hey Jim, Thanks for the reply. I agree that enough people disable javascript and I didnt want to use JS for this. With that said, I have deleted all countries from the database except for both the US and Canada. I'd like to somehow combine the 2 countries to share the same 'zone_country_id'. Since the US uses 223 and Canada uses 38 I was wondering if I could simply edit all the Canada entries and change them to 223. This would allow people to select both the State/Province as well as the Country from a dropdown box. My question is.. Does anyone know if this change would screw anything else up? Many thanks! Quote Link to comment Share on other sites More sharing options...
Daemonj Posted May 14, 2003 Share Posted May 14, 2003 Incorporating Canada into the US would throw your shipping rate estimates out the window. :( Quote "Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein Link to comment Share on other sites More sharing options...
jonah Posted June 19, 2003 Share Posted June 19, 2003 For address_book_details.php, change $account to $entry. $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . $entry['entry_country_id'] . "' 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,tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state'])) . ' ' . ENTRY_STATE_TEXT; How can I use this for 'checkout_new_address.php'? I have tried changing $account to $entry and all I get is an empty drop down box. Is there a simple change? All the other code works great! Thanks. Quote Link to comment Share on other sites More sharing options...
Guest Posted July 10, 2003 Share Posted July 10, 2003 How can I use this for 'checkout_new_address.php'? I have tried changing $account to $entry and all I get is an empty drop down box. Is there a simple change? All the other code works great! Thanks. I'm having the same problem here. Does anyone have a fix for checkout_new_address.php? Thanks a lot! - Mike Quote Link to comment Share on other sites More sharing options...
DesertDogs Posted July 15, 2003 Share Posted July 15, 2003 How can I use this for 'checkout_new_address.php'? I have tried changing $account to $entry and all I get is an empty drop down box. Is there a simple change? All the other code works great! Thanks. I'm having the same problem here. Does anyone have a fix for checkout_new_address.php? Thanks a lot! - Mike I did this: <?php if ($process == true) { $state = tep_get_zone_name($country, $zone_id, $state); if ($entry_state_error == 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 = '" . tep_db_input($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) . ' ' . ENTRY_STATE_ERROR; } else { echo tep_draw_input_field('state') . ' ' . ENTRY_STATE_ERROR; } } else { echo $state . tep_draw_hidden_field('zone_id') . tep_draw_hidden_field('state'); } } else { $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . STORE_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) . ' ' . ENTRY_STATE_TEXT; // echo tep_draw_input_field('state') . ' ' . ENTRY_STATE_TEXT; } ?> A quick kludge, but we're only going to be selling domestic USA for now. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.