remmeer Posted June 22, 2004 Posted June 22, 2004 I only plan to ship within the US. So, I have the United States listed as the only country. As a result, the "United States" appears in the drop down country box on the create_account.php page. The "state" field appears as a text box. However, if a customer enters a state abreviation, it is treated as an error and then a "state" drop down box appears. How do I get the state drop down box to appear when the page is initially displayed? OR How do I get the create an account form to accept state abreviations without an error?
808smokey Posted June 28, 2004 Posted June 28, 2004 I found the code for you When you type in the wrong state abbreviation in the state box you get an error and the pull down box. So I then went to "View Source" in notepad and found the code. I went into the "About Us" page on my site and cut and paste the code and it puts the drop down box like you want. As for getting it to work in the create_account.php, that's beyond me. I have no Idea. But at least you have the code now :D <tr>? ? ? ? ? ? <td class="main">State</td> ? ? ? ? ? ? <td class="main"> <select name="state"><option value="Alabama">Alabama</option><option value="Alaska">Alaska</option><option value="American Samoa">American Samoa</option><option value="Arizona">Arizona</option><option value="Arkansas">Arkansas</option><option value="Armed Forces Africa">Armed Forces Africa</option><option value="Armed Forces Americas">Armed Forces Americas</option><option value="Armed Forces Canada">Armed Forces Canada</option><option value="Armed Forces Europe">Armed Forces Europe</option><option value="Armed Forces Middle East">Armed Forces Middle East</option><option value="Armed Forces Pacific">Armed Forces Pacific</option><option value="California">California</option><option value="Colorado">Colorado</option><option value="Connecticut">Connecticut</option><option value="Delaware">Delaware</option><option value="District of Columbia">District of Columbia</option><option value="Federated States Of Micronesia">Federated States Of Micronesia</option><option value="Florida">Florida</option><option value="Georgia">Georgia</option><option value="Guam">Guam</option><option value="Hawaii">Hawaii</option><option value="Idaho">Idaho</option><option value="Illinois">Illinois</option><option value="Indiana">Indiana</option><option value="Iowa">Iowa</option><option value="Kansas">Kansas</option><option value="Kentucky">Kentucky</option><option value="Louisiana">Louisiana</option><option value="Maine">Maine</option><option value="Marshall Islands">Marshall Islands</option><option value="Maryland">Maryland</option><option value="Massachusetts">Massachusetts</option><option value="Michigan">Michigan</option><option value="Minnesota">Minnesota</option><option value="Mississippi">Mississippi</option><option value="Missouri">Missouri</option><option value="Montana">Montana</option><option value="Nebraska">Nebraska</option><option value="Nevada">Nevada</option><option value="New Hampshire">New Hampshire</option><option value="New Jersey">New Jersey</option><option value="New Mexico">New Mexico</option><option value="New York">New York</option><option value="North Carolina">North Carolina</option><option value="North Dakota">North Dakota</option><option value="Northern Mariana Islands">Northern Mariana Islands</option><option value="Ohio">Ohio</option><option value="Oklahoma">Oklahoma</option><option value="Oregon">Oregon</option><option value="Palau">Palau</option><option value="Pennsylvania">Pennsylvania</option><option value="Puerto Rico">Puerto Rico</option><option value="Rhode Island">Rhode Island</option><option value="South Carolina">South Carolina</option><option value="South Dakota">South Dakota</option><option value="Tennessee">Tennessee</option><option value="Texas">Texas</option><option value="Utah">Utah</option><option value="Vermont">Vermont</option><option value="Virgin Islands">Virgin Islands</option><option value="Virginia">Virginia</option><option value="Washington">Washington</option><option value="West Virginia">West Virginia</option><option value="Wisconsin">Wisconsin</option><option value="Wyoming">Wyoming</option></select> <span class="inputRequirement">*</td> ? ? ? ? ? </tr>
Guest Posted June 28, 2004 Posted June 28, 2004 there is a contribution for doing just this thing. you can also look in the knowledge base, there are some things in there relevant too.
808smokey Posted June 28, 2004 Posted June 28, 2004 there is a contribution for doing just this thing. you can also look in the knowledge base, there are some things in there relevant too. I have looked everywhere for days searched for: state, drop down, box, create account, account_create NOTHING. If you have any links I would really appreciate it :) Also I went to the page where the error box will show. Changed it to read EXACTLY the way the country box does and it still doesn't work.
remmeer Posted June 28, 2004 Author Posted June 28, 2004 Mibble, I found the Country-State Selector contribution. It seemed what I was looking for. However, I have installed it and I still have the same problem. If I go to establish an new customer account, the state field is a text box, not a drop down box. The "United States" is already selected as the country by default. If I simply enter a two-letter state abreviation (as I believe most people will do), an error is generated stating that I should select a state for the drop down box (that wasn't there before). Is there a way to have the state drop down box appear when the page is initially loaded if the United States is the only country and the default country?
blucollarguy Posted June 29, 2004 Posted June 29, 2004 I have so many contribs installed that I am not sure if this was it or not but here is what I did: BACK UP BACK UP BACK UP BACK UP FIRST FIRST (just in case you weren't sure, you should backup first). And good luck. Craig ;) find the following on or about line 411(unchanged create_account.php file) ****************************************************************** <?php if (ACCOUNT_STATE == 'true') { ?> <tr> <td class="main"><?php echo ENTRY_STATE; ?></td> <td class="main"> <?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; ?> ******************************************************************** replace it with this: <?php if (ACCOUNT_STATE == 'true') { ?> <tr> <td class="main"> <?php echo ENTRY_STATE; ?></td> <td class="main"> <?php $zones_array[] = array('id' => '', 'text' => 'Please Select'); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '223' 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; ?> ********************************************************************* Good Luck and make sure you back up your files first. Happy Coding! Craig Garrison Sr Anything worth having, is worth working for. Multi Vendor Shipping V1.1 Demo Catalog 3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout. Multi Vendor Shipping V1.1 Demo Admin login: [email protected] pass: mvs_demo MVS Thread: Multi-Vendor Shipping My contribs: Download Multi Vendor Shipping V1.1 Vendor Email Vendor Info in easypopulate EZ Price Updater And more to come!
blucollarguy Posted June 29, 2004 Posted June 29, 2004 I was reading through the forums and found another person haveing these same issues, there is another contrib. to try though I have not used it yet. Search for: country-state-selector_1_2_3_4_5.zip in the contribs section and givit a try. Craig Happy Coding! Craig Garrison Sr Anything worth having, is worth working for. Multi Vendor Shipping V1.1 Demo Catalog 3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout. Multi Vendor Shipping V1.1 Demo Admin login: [email protected] pass: mvs_demo MVS Thread: Multi-Vendor Shipping My contribs: Download Multi Vendor Shipping V1.1 Vendor Email Vendor Info in easypopulate EZ Price Updater And more to come!
remmeer Posted June 29, 2004 Author Posted June 29, 2004 blucollarguy, I couldn't find a contribution for country-state-selector_1_2_3_4_5.zip, just country-state-selector. As I mention earlier, I installed the country-state-selector. However, it does not display the drop down box for the state field until AFTER the error message. So, bascially, I don't see what difference the country-state-selector contribution made.
808smokey Posted July 1, 2004 Posted July 1, 2004 blucollarguy, I couldn't find a contribution for country-state-selector_1_2_3_4_5.zip, just country-state-selector. As I mention earlier, I installed the country-state-selector. However, it does not display the drop down box for the state field until AFTER the error message. So, bascially, I don't see what difference the country-state-selector contribution made. Did you ever figure this out??
blucollarguy Posted July 1, 2004 Posted July 1, 2004 If you tried the code I posted earlier and still have no luck, or if you want to keep working on the issue here is a link to another contrib, I have not used it so I cannot say if it works. Good luck all http://www.oscommerce.com/community/contributions,2148 Happy Coding! Craig Garrison Sr Anything worth having, is worth working for. Multi Vendor Shipping V1.1 Demo Catalog 3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout. Multi Vendor Shipping V1.1 Demo Admin login: [email protected] pass: mvs_demo MVS Thread: Multi-Vendor Shipping My contribs: Download Multi Vendor Shipping V1.1 Vendor Email Vendor Info in easypopulate EZ Price Updater And more to come!
808smokey Posted July 1, 2004 Posted July 1, 2004 If you tried the code I posted earlier and still have no luck, or if you want to keep working on the issue here is a link to another contrib, I have not used it so I cannot say if it works. Good luck all http://www.oscommerce.com/community/contributions,2148 Man do I feel dumb I didn't even see your post. Your code works perfectly!!! Thanks for posting it :) *EDIT* I only changed one thing to fit my site: I delete the red text below, it makes a double space before the word "State" and throws it out of alignment with the rest of the text. <?phpif (ACCOUNT_STATE == 'true') { ?> <tr> <td class="main"> <?php echo ENTRY_STATE; ?></td> <td class="main"> <?php $zones_array[] = array('id' => '', 'text' => 'Please Select'); $zones_query = tep_db_query Other than that it works great!!
blucollarguy Posted July 1, 2004 Posted July 1, 2004 That's great, I have been trying to figure out what was causing that extra spacing for 2 weeks! What an idiot I am! Glad it worked worked for you. Craig Happy Coding! Craig Garrison Sr Anything worth having, is worth working for. Multi Vendor Shipping V1.1 Demo Catalog 3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout. Multi Vendor Shipping V1.1 Demo Admin login: [email protected] pass: mvs_demo MVS Thread: Multi-Vendor Shipping My contribs: Download Multi Vendor Shipping V1.1 Vendor Email Vendor Info in easypopulate EZ Price Updater And more to come!
kingbono Posted July 19, 2004 Posted July 19, 2004 What about adding in a break in between different countries states/provinces? Either a line or the country's name? I am afraid of confusing my customers.
808smokey Posted July 20, 2004 Posted July 20, 2004 What about adding in a break in between different countries states/provinces? Either a line or the country's name? I am afraid of confusing my customers. What do you mean? Something like this: United kingdom ------------------ United States ------------------
johnnymke Posted July 26, 2004 Posted July 26, 2004 Trying to apply this to address_book_process.php: if (ACCOUNT_STATE == 'true') { $country = 223; $entry_state_has_zones = 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 ($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']); 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); } } } it doesnt work...any help from php kung-fu artists?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.