ArtcoInc Posted December 11, 2017 Share Posted December 11, 2017 @helenium7 9 minutes ago, helenium7 said: Might be of use to someone else, I could not get the v2.4.4 to configure and got a database error when I tried to install but 2.3.3. seems to function OK. It was the lines starting tep_db_query("insert into cconfiguration . . . which gave the problem whereas the previous was tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title . . . Not sure if its that double "cc" or is that a php 7 issue? - I am running 5.6 currently Yes, it's the double 'c' that is causing the problem. The current coding style is getting away from having the TABLE_ declaration, and actually using the table name. Here, it's supposed to be "configuration". So, just delete the extra 'c'. Malcolm helenium7 1 Quote Link to comment Share on other sites More sharing options...
brian_cee Posted January 30, 2018 Share Posted January 30, 2018 Great addon (contribution) I installed it on a 2.3.4.1 store, and in admin, I ticked that it should show up on account_pwa.php, but it isn't. It looks fine on checkout_shipping_address.php (state drop down and shop country is default) but not on account_pwa.php. Does anyone know if there is a known issue with PWA for 2.3.4 and this contribution? Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted January 30, 2018 Author Share Posted January 30, 2018 Hello, Did you apply the modifications for create_account.php as described in the installation also to account_pwa.php ? regards Rainer brian_cee 1 Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
brian_cee Posted January 30, 2018 Share Posted January 30, 2018 9 hours ago, raiwa said: Hello, Did you apply the modifications for create_account.php as described in the installation also to account_pwa.php ? regards Rainer No, I must have misunderstood your post on page 1 of this thread, I thought you were saying something different. Thanks for your time and work on this addon. Quote Link to comment Share on other sites More sharing options...
brian_cee Posted January 30, 2018 Share Posted January 30, 2018 On 5/28/2015 at 2:48 AM, raiwa said: If you wish you can move the country part below the state selector, it will work. But then I would recommend to add some text like "The "State" drop-down list will be updated when you change the Country". regards Rainer Can you clarify this a little? In the US, I need it to be, in order, city, state, post code, country, not city, post code, country, state. I haven't tried re-arranging it myself, can I do it without messing up the drop down menus, or am I misunderstanding something again? Usually when I try to just rearrange the code, I get errors, and since I am now building 2.3.4.1 BS, I don't want to mess with the code like I used to with 2.2, can you point out what to rearrange without causing errors, please? Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted January 30, 2018 Author Share Posted January 30, 2018 just keep the integrity of these 2 blocks and move the complete country block, below the state block. Country block: <div class="form-group has-feedback"> <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?></label> <div class="col-sm-9"> <?php if ( !isset($country) && MODULE_HEADER_TAGS_GET_STATES_DEFAULT_COUNTRY == 'True' ) { $country = STORE_COUNTRY; } echo tep_get_country_list('country', $country, 'onChange="getState(this.value)" required aria-required="true" id="inputCountry"'); echo FORM_REQUIRED_INPUT; if (tep_not_null(ENTRY_COUNTRY_TEXT)) echo '<span class="help-block">' . ENTRY_COUNTRY_TEXT . '</span>'; ?> </div> </div> State block: <?php if (ACCOUNT_STATE == 'true') { ?> <div class="form-group has-feedback"> <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label> <div id="results" class="col-sm-9"> <?php $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) { $zones_array = array(); $zones_array[0] = array('id' => '', 'text' => PULL_DOWN_DEFAULT); $zones_query = tep_db_query("select zone_name from 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, '', 'required aria-required="true" id="inputState"'); echo FORM_REQUIRED_INPUT; } else { echo tep_draw_input_field('state', NULL, 'id="inputState" class="form-control" required aria-required="true" placeholder="' . ENTRY_STATE . '"'); echo FORM_REQUIRED_INPUT; } if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span class="help-block">' . ENTRY_STATE_TEXT . '</span>'; ?> </div> </div> <?php } ?> </div> brian_cee 1 Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
ArtcoInc Posted January 30, 2018 Share Posted January 30, 2018 @brian_cee 1 hour ago, brian_cee said: Can you clarify this a little? In the US, I need it to be, in order, city, state, post code, country, not city, post code, country, state. What I think @raiwa was saying is ... if your customer starts to fill out the form, the State drop-down will list only the States for the default Country. If your customer is in another Country, they will not be able to select the correct State *UNTIL* they select their Country. *THEN*, the State field will refresh (and I *think* it will defaulting to the first State available for that country). Your customer will then have to go back and select the correct State. So, @raiwa suggested that you add a bit of text telling your customer that they will have to re-select their State if they change their Country. Make sense? Now, I recognize that you want the fields on a specific order. Have you ever been on a web site where the Country is the first field in the form? There are some benefits to this, as you can not only have the correct States available in that drop-down field, but you can also format the rest of the form according to the addressing requirements of the customer's Country. HTH Malcolm Tsimi and raiwa 2 Quote Link to comment Share on other sites More sharing options...
brian_cee Posted January 31, 2018 Share Posted January 31, 2018 4 hours ago, ArtcoInc said: @brian_cee What I think @raiwa was saying is ... if your customer starts to fill out the form, the State drop-down will list only the States for the default Country. If your customer is in another Country, they will not be able to select the correct State *UNTIL* they select their Country. *THEN*, the State field will refresh (and I *think* it will defaulting to the first State available for that country). Your customer will then have to go back and select the correct State. So, @raiwa suggested that you add a bit of text telling your customer that they will have to re-select their State if they change their Country. Oh, I see, I didn't think of that since I only ship within the USA, so I'll either remove the country field altogether, or leave it as the default and remove all other countries in the db as raiwa suggested years ago in this thread....... Quote Link to comment Share on other sites More sharing options...
brian_cee Posted January 31, 2018 Share Posted January 31, 2018 5 hours ago, raiwa said: just keep the integrity of these 2 blocks and move the complete country block, below the state block. <div class="form-group has-feedback"> <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?></label> <div class="col-sm-9"> <?php if ( !isset($country) && MODULE_HEADER_TAGS_GET_STATES_DEFAULT_COUNTRY == 'True' ) { $country = STORE_COUNTRY; } echo tep_get_country_list('country', $country, 'onChange="getState(this.value)" required aria-required="true" id="inputCountry"'); echo FORM_REQUIRED_INPUT; if (tep_not_null(ENTRY_COUNTRY_TEXT)) echo '<span class="help-block">' . ENTRY_COUNTRY_TEXT . '</span>'; ?> </div> </div> <?php if (ACCOUNT_STATE == 'true') { ?> <div class="form-group has-feedback"> <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label> <div id="results" class="col-sm-9"> <?php $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) { $zones_array = array(); $zones_array[0] = array('id' => '', 'text' => PULL_DOWN_DEFAULT); $zones_query = tep_db_query("select zone_name from 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, '', 'required aria-required="true" id="inputState"'); echo FORM_REQUIRED_INPUT; } else { echo tep_draw_input_field('state', NULL, 'id="inputState" class="form-control" required aria-required="true" placeholder="' . ENTRY_STATE . '"'); echo FORM_REQUIRED_INPUT; } if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span class="help-block">' . ENTRY_STATE_TEXT . '</span>'; ?> </div> </div> <?php } ?> </div> Thanks for taking the time to do that, that's exactly what I was looking for......... Quote Link to comment Share on other sites More sharing options...
brian_cee Posted January 31, 2018 Share Posted January 31, 2018 Unfortunately, every time I move the state block above the country block, the state field loses the drop down menu and becomes just another entry field again. It's not just a matter of adding an explanation to customers......And I tried just deleting the country block since I only ship within the USA, but it's required, so I can't proceed in the checkout unless I selectt a country that isn't there....... Quote Link to comment Share on other sites More sharing options...
♥Tsimi Posted January 31, 2018 Share Posted January 31, 2018 @brian_cee Just hide the country input field if you only ship domestic. You can hide it by using the hidden class. See link below. class="hidden" brian_cee 1 Quote Link to comment Share on other sites More sharing options...
brian_cee Posted January 31, 2018 Share Posted January 31, 2018 @Tsimi Thanks, I was trying to comment out the country field with // and couldn't figure out why it wouldn't work........Everything on those pages works and looks perfect now........ Quote Link to comment Share on other sites More sharing options...
brian_cee Posted February 1, 2018 Share Posted February 1, 2018 Not a big deal, but has anyone noticed that if you let Chrome auto-fill your data (name, address, etc) the state drop down reverts back to a field that you have to type into? Quote Link to comment Share on other sites More sharing options...
brian_cee Posted February 8, 2018 Share Posted February 8, 2018 On 1/30/2018 at 2:18 AM, raiwa said: Hello, Did you apply the modifications for create_account.php as described in the installation also to account_pwa.php ? regards Rainer Hey, I had done that and everything went smoothly, but afterwards I uninstalled that version of PWA and installed the newer one with the reviews function (PWA for BS 2.5R1).....then when I tried to ad the state selector changes to that version of account_pwa, it stripped away the left and right columns and put the best seller box underneath the address fields and stuff, on shop/account_pwa.php........... I tried comparing differences between the older version of account_pwa.php and the newer one, to see how I could make the install fit, but I can't figure it out. It's something in these instructions that breaks that page up when uploaded: 3. catalog/create_account.php (or account_pwa.php) FIND: <?php if (ACCOUNT_STATE == 'true') { ?> <div class="form-group has-feedback"> <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label> <div class="col-sm-9"> <?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, 0, 'id="inputState" aria-describedby="atState"'); echo FORM_REQUIRED_INPUT; if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span id="atState" class="help-block">' . ENTRY_STATE_TEXT . '</span>'; } else { echo tep_draw_input_field('state', NULL, 'id="inputState" placeholder="' . ENTRY_STATE_TEXT . '"'); echo FORM_REQUIRED_INPUT; } } else { echo tep_draw_input_field('state', NULL, 'id="inputState" placeholder="' . ENTRY_STATE_TEXT . '"'); echo FORM_REQUIRED_INPUT; } ?> </div> </div> <?php } ?> <div class="form-group has-feedback"> <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?></label> <div class="col-sm-9"> <?php echo tep_get_country_list('country', NULL, 'required aria-required="true" aria-describedby="atCountry" id="inputCountry"'); echo FORM_REQUIRED_INPUT; if (tep_not_null(ENTRY_COUNTRY_TEXT)) echo '<span id="atCountry" class="help-block">' . ENTRY_COUNTRY_TEXT . '</span>'; ?> </div> </div> </div> REPLACE WITH: <div class="form-group has-feedback"> <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?></label> <div class="col-sm-9"> <?php if ( !isset($country) && MODULE_HEADER_TAGS_GET_STATES_DEFAULT_COUNTRY == 'True' ) { $country = STORE_COUNTRY; } echo tep_get_country_list('country', $country, 'onChange="getState(this.value)" required aria-required="true" id="inputCountry"'); echo FORM_REQUIRED_INPUT; if (tep_not_null(ENTRY_COUNTRY_TEXT)) echo '<span class="help-block">' . ENTRY_COUNTRY_TEXT . '</span>'; ?> </div> </div> <?php if (ACCOUNT_STATE == 'true') { ?> <div class="form-group has-feedback"> <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label> <div class="col-sm-9"> <?php $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) { $zones_array = array(); $zones_array[0] = array('id' => '0', 'text' => PULL_DOWN_DEFAULT); $zones_query = tep_db_query("select zone_name from 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 '<span id="results">'; echo tep_draw_pull_down_menu('state', $zones_array, '', 'id="inputState"'); echo '</span>'; echo FORM_REQUIRED_INPUT; } else { echo '<span id="results">'; echo tep_draw_input_field('state', NULL, 'id="inputState" placeholder="' . ENTRY_STATE . '"'); echo '</span>'; echo FORM_REQUIRED_INPUT; } if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span class="help-block">' . ENTRY_STATE_TEXT . '</span>'; ?> </div> </div> <?php } ?> </div> Is my issue related to this code, do you think, or did I go wrong elsewhere? Quote Link to comment Share on other sites More sharing options...
brian_cee Posted February 8, 2018 Share Posted February 8, 2018 (edited) Followup: Since those files aren't identical, I replace this in my version of PWA's account_pwa.php: <?php if (ACCOUNT_STATE == 'true') { ?> <div class="form-group has-feedback"> <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label> <div class="col-sm-9"> <?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, 0, 'id="inputState" aria-describedby="atState"'); echo FORM_REQUIRED_INPUT; if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span id="atState" class="help-block">' . ENTRY_STATE_TEXT . '</span>'; } else { echo tep_draw_input_field('state', NULL, 'id="inputState" placeholder="' . ENTRY_STATE_TEXT . '"'); echo FORM_REQUIRED_INPUT; } } else { echo tep_draw_input_field('state', NULL, 'id="inputState" placeholder="' . ENTRY_STATE_TEXT . '"'); echo FORM_REQUIRED_INPUT; } ?> </div> </div> <?php } ?> <div class="form-group has-feedback"> <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?></label> <div class="col-sm-9"> <?php echo tep_get_country_list('country', NULL, 'required aria-required="true" aria-describedby="atCountry" id="inputCountry"'); echo FORM_REQUIRED_INPUT; if (tep_not_null(ENTRY_COUNTRY_TEXT)) echo '<span id="atCountry" class="help-block">' . ENTRY_COUNTRY_TEXT . '</span>'; ?> </div> </div> I REPLACE THIS WITH: <div class="form-group has-feedback"> <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?></label> <div class="col-sm-9"> <?php if ( !isset($country) && MODULE_HEADER_TAGS_GET_STATES_DEFAULT_COUNTRY == 'True' ) { $country = STORE_COUNTRY; } echo tep_get_country_list('country', $country, 'onChange="getState(this.value)" required aria-required="true" id="inputCountry"'); if (tep_not_null(ENTRY_COUNTRY_TEXT)) echo '<span class="help-block">' . ENTRY_COUNTRY_TEXT . '</span>'; ?> </div> </div> <?php if (ACCOUNT_STATE == 'true') { ?> <div class="form-group has-feedback"> <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label> <div id="results" class="col-sm-9"> <?php $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) { $zones_array = array(); $zones_array[0] = array('id' => '', 'text' => PULL_DOWN_DEFAULT); $zones_query = tep_db_query("select zone_name from 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, '', 'id="inputState"'); } else { echo tep_draw_input_field('state', NULL, 'id="inputState" class="form-control" placeholder="' . ENTRY_STATE . '"'); } if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span class="help-block">' . ENTRY_STATE_TEXT . '</span>'; ?> </div> </div> <?php } ?> </div> Edited February 8, 2018 by brian_cee add info Quote Link to comment Share on other sites More sharing options...
brian_cee Posted February 8, 2018 Share Posted February 8, 2018 And here are before and after screenshots, after replacing that code: Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted February 8, 2018 Author Share Posted February 8, 2018 Hello Brian, If this happens your <div> ... </div> tags are unbalanced. This means there is one missing or one left over. Try to remove the last one in the code snippet you posted: .... echo tep_draw_input_field('state', NULL, 'id="inputState" class="form-control" placeholder="' . ENTRY_STATE . '"'); } if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span class="help-block">' . ENTRY_STATE_TEXT . '</span>'; ?> </div> </div> <?php } ?> </div> Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
brian_cee Posted February 8, 2018 Share Posted February 8, 2018 9 hours ago, raiwa said: Try to remove the last one in the code snippet you posted: Perfection, thanks. Quote Link to comment Share on other sites More sharing options...
brian_cee Posted February 17, 2018 Share Posted February 17, 2018 Hey, I recently started a fresh install of the store and ran the update scripts on the old OS2.2 database so it works with 2.3.4bs.....Now I'm re-adding the addons I've tested, and everything is going good except this state selector......I followed all of the install directions, and there are no errors, and the default country is auto-selected and everything, but there is no state dropdown, it's still just a field that has to be typed in, which I don't understand. I uninstalled and reverted back to backed up files, did it all again, same result....I have a zone table in the db and it is populated with states, is there something obvious I might have messed up that would cause the dropdown function to not work? Quote Link to comment Share on other sites More sharing options...
brian_cee Posted February 17, 2018 Share Posted February 17, 2018 And on page one of this thread, @raiwa told someone else if they only ship to the store country, this addon can be uninstalled and just code on one page (create_account or, in my case, account_pwa) can be changed. When I do that, the state field has what looks like a drop down arrow, as if you might be able to see states drop down, but the arrow produces no results when clicked. Any ideas appreciated. Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted February 19, 2018 Author Share Posted February 19, 2018 Hello Brian @brian_cee, There are several ways to do this. You can find info and hints in the following thread: https://www.oscommerce.com/forums/topic/412513-set-default-country-for-customers One easy way would be to set your store country as default for the zone query, simplify the zone block to show always the menu. Then set the store country as default selected in the countries menu and disable the countries menu: <?php if (ACCOUNT_STATE == 'true') { ?> <div class="form-group has-feedback"> <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label> <div class="col-sm-9"> <?php $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, 0, 'id="inputState" aria-describedby="atState"'); echo FORM_REQUIRED_INPUT; if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span id="atState" class="help-block">' . ENTRY_STATE_TEXT . '</span>'; ?> </div> </div> <?php } ?> <div class="form-group has-feedback"> <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?></label> <div class="col-sm-9"> <?php echo tep_get_country_list('country', STORE_COUNTRY, 'required disabled aria-required="true" aria-describedby="atCountry" id="inputCountry"'); echo FORM_REQUIRED_INPUT; if (tep_not_null(ENTRY_COUNTRY_TEXT)) echo '<span id="atCountry" class="help-block">' . ENTRY_COUNTRY_TEXT . '</span>'; ?> </div> </div> </div> brian_cee 1 Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
Bobber Posted April 24, 2018 Share Posted April 24, 2018 On 11/29/2017 at 7:38 PM, Bobber said: This Worked Perfectly For Me @raiwa! I only had to replace the old code with this below: <?php if (ACCOUNT_STATE == 'true') { ?> <div class="form-group has-feedback"> <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label> <div class="col-sm-9"> <?php $zones_array = array(); $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . STORE_COUNTRY . "' order by zone_name desc"); 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, 0, 'id="inputState"'); echo FORM_REQUIRED_INPUT; if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span class="help-block">' . ENTRY_STATE_TEXT . '</span>'; ?> </div> </div> Thank you for your contribution with this code! I have since update the code and found this to be the best solution for my application: <?php if (ACCOUNT_STATE == 'true') { ?> <tr> <td class="fieldKey"><?php echo ENTRY_STATE; ?></td> <td class="fieldValue"> <?php $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, 1, 'id="inputState"'); if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT . '</span>'; ?> </td> </tr> I hope this helps others looking for a solution! Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted April 24, 2018 Author Share Posted April 24, 2018 1 hour ago, Bobber said: I have since update the code and found this to be the best solution for my application: <?php if (ACCOUNT_STATE == 'true') { ?> <tr> <td class="fieldKey"><?php echo ENTRY_STATE; ?></td> <td class="fieldValue"> <?php $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, 1, 'id="inputState"'); if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT . '</span>'; ?> </td> </tr> I hope this helps others looking for a solution! @Bobber, your application seems to be for 2.3.4 standard. You should explain this to avoid confusion. This state selector version is for BS responsive. there are older add-ons available for 2.3.4 standard. Bobber 1 Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
Bobber Posted April 26, 2018 Share Posted April 26, 2018 Thank you for your work on this contribution @raiwa Quote Link to comment Share on other sites More sharing options...
vmn Posted October 11, 2018 Share Posted October 11, 2018 (edited) Hi, thanks for this great contribution. Has anybody tried to translate the standard browser error message 'Please fill out this field'? The language of the message seems be the same as the browser language. This is what I did. in includes/functions/html_output.php and in the function tep_draw_input_field check if the 'required' is in the parameters: .. if (tep_not_null($parameters)) { if (strpos($parameters, 'required') !== false) { $parameters .= ' oninvalid="this.setCustomValidity(\'' . FORM_INPUT_VALUE_MISSING. '!\')" onchange="this.setCustomValidity(\'\')"'; } $field .= ' ' . $parameters; } .. in includes/languages/english.php add //customized form input error message define('FORM_INPUT_VALUE_MISSING','This field is required'); in includes/languages/finnish.php //customizedform input error messages define('FORM_INPUT_VALUE_MISSING','Tämä on pakollinen tieto'); This seems to work both in latest Firefox and Chromium. Any comments? Edited October 11, 2018 by vmn raiwa 1 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.