Jump to content
Latest News: (loading..)

Recommended Posts

@@Gergely,

 

I had to add "required aria-required="true""  to the input field to get the validation to work if no state is in the DB for the selected country:

     	 echo tep_draw_input_field('state', NULL, 'id="inputState" class="form-control" required aria-required="true" placeholder="' . ENTRY_STATE    . '"');

Share this post


Link to post
Share on other sites

 

@@Gergely,

 

I had to add "required aria-required="true""  to the input field to get the validation to work if no state is in the DB for the selected country:

     	 echo tep_draw_input_field('state', NULL, 'id="inputState" class="form-control" required aria-required="true" placeholder="' . ENTRY_STATE    . '"');

 

and could you step forward in registration?


:blink:

Share this post


Link to post
Share on other sites

@@Gergely,

 

Found another issue:

The selected country was reset to store country if the form passed the BS validations , but didn't pass the validation of existing e-mail.

I modified this:

        if ( $country == '' && MODULE_HEADER_TAGS_GET_STATES_DEFAULT_COUNTRY == 'True') {

and it keeps now the selected country other than store country.

Edited by raiwa

Share this post


Link to post
Share on other sites

@@Gergely,

 

and could you step forward in registration?

OK in includes/modules/checkout_new_address.php it can't be applied. Then changing to another existing address works if the country in the form isn't changed, and there is no reason to change it in that case.

Edited by raiwa

Share this post


Link to post
Share on other sites

"onchange function" is not needed here. The script in ht_get_states.php is coded in a way that it works without. (Do not ask me why, that's de docta's secret :-))

 

Sorry, here I missed something too.

It is needed in the country selection only (modifications in create_account.php etc):

        echo tep_get_country_list('country', $country, 'onChange="getState(this.value)" required aria-required="true" id="inputCountry"');

Share this post


Link to post
Share on other sites

 

Sorry, here I missed something too.

It is needed in the country selection only (modifications in create_account.php etc):

        echo tep_get_country_list('country', $country, 'onChange="getState(this.value)" required aria-required="true" id="inputCountry"');

hi

 

is the latest version of addon fully working when entering states?

and is everything working when in checkout user may want to change or enter a new address?

thanks

Share this post


Link to post
Share on other sites

@@vampirehunter,

 

Sorry for the late reply.

Yes it should work for all conditions. For countries which have no states introduced the standard text input field is used.

The state selector will show everywhere where state is used if you apply all modifications in the Public store side.

It is not implemented in Admin, but can be done too.

Share this post


Link to post
Share on other sites

switch error reporting on or check your error log. Then see what produces the error. Maybe you need to change to hardcoded filenames/paths in the ht module, it's a bit outdated and maybe need to be updated.

Edited by raiwa

Share this post


Link to post
Share on other sites

hi thanks

ive tried everything.

 

whenever i click save in admin, just goes to a 403 blank page

 

i even installed this newer plugin, country states bs 2.4.2 and even that gives the same problem.

 

all other plugins i have work fine. seems like a javascript issue although im not sure what.

 

why in admin its not saving the updates to the module?

 

it doesn't make sense

Share this post


Link to post
Share on other sites
Hi raiwa,

 

I was wondering if it was possible to include an automatic country allocation according to the country of the customer (via its IP)?

 

Best regards

Share this post


Link to post
Share on other sites

Raiwa,

I am running into a problem here.  Just installed the addon and it is exactly what I am looking for with one exception.  Next to all of the fields, it now shows " FORM_REQUIRED_INPUT* "  (see attached image).  I am not much of a programmer so I am not really sure where to look or what to do in order to correct this.  You can see it at http://bettysbargainbin.com/adult/create_account.php

Thank you in advance to anyone with some help on this.

forms.png


T. Patterson

Share this post


Link to post
Share on other sites

Hello Todd @TruckloadSales,

This add-on is for 2.3.4 BS (Bootstrap community version) and your store is 2.3.4 standard.

You can try to adapt it to your version, use the modification instructions to modify your file instead to upload and replace with the included file.

Then remove the line with "FORM_REQUIRED_INPUT" constant.

Otherwise you should use an add-on for your store version like:

https://apps.oscommerce.com/xRZzM&country-state-selector

there are more out there.

Always check to use the right version for your store. If there is "BS" or "Bootstrap" or "Responsive" or "Community version" in the add-on name or description it is not for your store.

 

rgds

Rainer

Share this post


Link to post
Share on other sites

Ok, I just installed this on a fresh install of Bootstrap.  When I go to create a new account, I am receiving the following:

Warning: require(DIR_WS_LANGUAGESenglish/FILENAME_CREATE_ACCOUNT): failed to open stream: No such file or directory in /home3/upacynsc/public_html/erotic/create_account.php on line 18

Warning: require(DIR_WS_LANGUAGESenglish/FILENAME_CREATE_ACCOUNT): failed to open stream: No such file or directory in /home3/upacynsc/public_html/erotic/create_account.php on line 18

Fatal error: require(): Failed opening required 'DIR_WS_LANGUAGESenglish/FILENAME_CREATE_ACCOUNT' (include_path='.:/opt/php56/lib/php') in /home3/upacynsc/public_html/erotic/create_account.php on line 18

I am not a programmer at all, so can someone point me in the right direction here please?  This can be seen at http://bettysbargainbin.com/erotic


T. Patterson

Share this post


Link to post
Share on other sites

@TruckloadSales

You need to install this addon https://apps.oscommerce.com/RNywS&add-on-compatibility-for-2-3-4-edge       to make some of the older addons work.


Let's make things easier for new osCommerce users http://forums.oscommerce.com/topic/402638-discussion-about-hard-coded-database-tables/?p=1718900  Getting there with osCommerce 2.4! :thumbsup:

Share this post


Link to post
Share on other sites

Hello @TruckloadSales,

 

I just uploaded an updated version for latest 2.3.4 BS EDGE.

State Selector BS 1.3

If you wish you can update your version, it should then work without the compatibility add-on @frankl has recommended.

 

rgds

Rainer

Share this post


Link to post
Share on other sites
15 hours ago, raiwa said:

Hello @TruckloadSales,

 

I just uploaded an updated version for latest 2.3.4 BS EDGE.

State Selector BS 1.3

If you wish you can update your version, it should then work without the compatibility add-on @frankl has recommended.

 

rgds

Rainer

Rainer,

 

Thanks a million, works perfectly!  At least on a fresh install of 2.3.4 BS.  On behalf of what I am sure are going to be several users, I appreciate your taking the time and the effort to keep this package updated!

 

Todd


T. Patterson

Share this post


Link to post
Share on other sites
On 5/29/2015 at 3:54 AM, raiwa said:

Hello Deb @@sheepiedog,

 

Yes you are right. It was my fault. Forgot that the country definition needs to be above the state section.

So it should be:


      <div class="form-group has-feedback">
        <label for="inputCity" class="control-label col-sm-3"><?php echo ENTRY_CITY; ?></label>
        <div class="col-sm-9">
          <?php
          echo tep_draw_input_field('city', (isset($entry['entry_city']) ? $entry['entry_city'] : ''), 'required aria-required="true" id="inputCity" placeholder="' . ENTRY_CITY. '"');
          echo FORM_REQUIRED_INPUT;
          if (tep_not_null(ENTRY_CITY_TEXT)) echo '<span class="help-block">' . ENTRY_CITY_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
          $country = 0;
          if ( isset($entry['entry_country_id']) ) {
          	$country = $entry['entry_country_id'];
          } elseif (MODULE_HEADER_TAGS_GET_STATES_DEFAULT_COUNTRY == 'True') {
          	$country = STORE_COUNTRY;
          }
      			$zone_id = 0;
      			$check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . $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 " . TABLE_ZONES . " where zone_country_id = '" . $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, (isset($entry['entry_country_id']) ? tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']) : ''), '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>
      <div class="form-group has-feedback">
        <label for="inputZip" class="control-label col-sm-3"><?php echo ENTRY_POST_CODE; ?></label>
        <div class="col-sm-9">
          <?php
          echo tep_draw_input_field('postcode', (isset($entry['entry_postcode']) ? $entry['entry_postcode'] : ''), 'required aria-required="true" id="inputZip" placeholder="' . ENTRY_POST_CODE . '"');
          echo FORM_REQUIRED_INPUT;
          if (tep_not_null(ENTRY_POST_CODE_TEXT)) echo '<span class="help-block">' . ENTRY_POST_CODE_TEXT . '</span>';
          ?>
       </div>
      </div>

      <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', $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
  }
?>  

But, if you only use the store country, you do not need the state selector at all!! :-

You can revert all state selector installation and just modify the original code like this:


    <div class="form-group has-feedback">
      <label for="inputCity" class="control-label col-sm-3"><?php echo ENTRY_CITY; ?></label>
      <div class="col-sm-9">
        <?php
        echo tep_draw_input_field('city', NULL, 'required aria-required="true" id="inputCity" placeholder="' . ENTRY_CITY. '"');
        echo FORM_REQUIRED_INPUT;
        if (tep_not_null(ENTRY_CITY_TEXT)) echo '<span class="help-block">' . ENTRY_CITY_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
            $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>
<?php
  }
?>
    <div class="form-group has-feedback">
      <label for="inputZip" class="control-label col-sm-3"><?php echo ENTRY_POST_CODE; ?></label>
      <div class="col-sm-9">
        <?php
        echo tep_draw_input_field('postcode', NULL, 'required aria-required="true" id="inputZip" placeholder="' . ENTRY_POST_CODE . '"');
        echo FORM_REQUIRED_INPUT;
        if (tep_not_null(ENTRY_POST_CODE_TEXT)) echo '<span class="help-block">' . ENTRY_POST_CODE_TEXT . '</span>';
        ?>
     </div>
    </div>
    <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 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>
  </div>

Just remove all countries except your store country from the database (you did this already I guess) :)

 

regards

Rainer

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!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×