Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Country-State Selector


stevel

Recommended Posts

If no JavaScript was being loaded, or you had JavaScript disabled in your browser, then yes. But just look at the page source in your browser - it should be obvious whether or not the JS is there.

Link to comment
Share on other sites

yeh, js is enabled i mean i have another store running locally with this contrib installed. and it works fine, it wouldnt let me view the source of the page either i think that might be to do with the fact that the js says error on page,

 

the exact thing it says is

 

line: 257

char 1

error object expected

code:0

url:localhost:85/righthereit/create_account.php?

 

but then again i signed into an account i had already made and went to edit the address etc and it doesnt show up there either.

 

its really weird. i can see no reason why it should stuff up. I am trying not to have to install the store all over again.

 

I have STS 3Beta2 installed, admin access, anti-robot registration, ultrapics. but non of these should have cause the problem. the are all there in the store that does work,

 

any other hints?

Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Link to comment
Share on other sites

yeh sorry i dont have a link to the store. but I think that the problem might be my template for sts. so I dont think its related. I tried a different template and it all worked, so ill have to adjust my template.

 

thanks for the help anyway

Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Link to comment
Share on other sites

hello,

 

i'm new to this thread and this contribution.

 

i have installed it correctly but when the country is selected the second dropbox with the counties doesn't appear - no matter wich country is selected

 

i added the counties.sql file too but still no good!

 

can someone help me on this please

 

thanks

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

What is this "counties.sql" file? Does it add to the "zones" table? With this contribution properly installed, you will see the "state" field become a dropdown box listing all the zones for the selected country, if there are any, otherwise it is just a textbox.

Link to comment
Share on other sites

What is this "counties.sql" file?  Does it add to the "zones" table?  With this contribution properly installed, you will see the "state" field become a dropdown box listing all the zones for the selected country, if there are any, otherwise it is just a textbox.

here what is has:

 

INSERT INTO zones (zone_country_id,zone_code,zone_name) VALUES("222","ABER","Aberdeenshire");

 

and the same for all the other areas... even before i put this in there was no text dropbox becoming a counties dropbox - it stays a text field.

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

here what is has:

 

INSERT INTO zones (zone_country_id,zone_code,zone_name) VALUES("222","ABER","Aberdeenshire");

 

and the same for all the other areas... even before i put this in there was no text  dropbox becoming a counties dropbox - it stays a text field.

alas my friend, this is country/state selector not county/state selector...although i would really really love to see that one...

 

customer adds ny as state...a dropdown county box opens up, and they must enter thier county, then the tax table could grab the county code for taxing purposes...ny taxes by delivery county (not zip code, not store location, delivery drop off county is the taxable rate...AND shipping is taxable [unless the customer arranges the shipping on thier own])

Link to comment
Share on other sites

alas my friend, this is country/state selector not county/state selector...although i would really really love to see that one...

 

customer adds ny as state...a dropdown county box opens up, and they must enter thier county, then the tax table could grab the county code for taxing purposes...ny taxes by delivery county (not zip code, not store location, delivery drop off county is the taxable rate...AND shipping is taxable [unless the customer arranges the shipping on thier own])

well the thing is country/state becomes country/provence or country/county, i guess.

 

i installed a new oscommerce store and added the contribution from stevebut it just dont generate a second dropbox when i select USA, or UK or anything!

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

but it just dont generate a second dropbox when i select USA, or UK or anything!

it never creates a second dropdown box. the only thing this contribution does is make the state box not a text box by default, but rather a dropdown box- according to the selected country. (edit- some remain a text box if there are no states associated with that country, right?.)

 

add this contribution. load up the create account page and set country to USA.

see the page refresh with the USA states plugged in as a dropdown box.

 

try this now: change the country to Gremany. see the page refresh to show the state box as a dropdown box filled with the greman states.

 

my solution for county, was to add 80+ NY staes, one for each county in NY. then create a separate zone for each sales tax bracket that NY has. add whatever counties are in whatever tax bracket for proper tax coding. sloppy, but so far never has a customer complained they had to scroll through 80 entries for NY-- and every NY customer gets taxed the legal tax rate I am bound by law to charge. its tax free week for clothes by state tax, and maybe county tax, if they choose. what a nightmare.

 

thanks steve for this wonderful work, and for the pwa code fix I so dearly needed in order to prep my store for the paypal pro legal mumbojumbo.

Edited by ArtRat
Link to comment
Share on other sites

it never creates a second dropdown box. the only thing this contribution does is make the state box not a text box by default, but rather a dropdown box- according to the selected country. (edit- some remain a text box if there are no states associated with that country, right?.)

 

add this contribution. load up the create account page and set country to USA.

see the page refresh with the USA states plugged in as a dropdown box.

 

try this now: change the country to Gremany. see the page refresh to show the state box as a dropdown box filled with the greman states.

 

my solution for county, was to add 80+ NY staes, one for each county in NY. then create a separate zone for each sales tax bracket that NY has. add whatever counties are in whatever tax bracket for proper tax coding. sloppy, but so far never has a customer complained they had to scroll through 80 entries for NY-- and every NY customer gets taxed the legal tax rate I am bound by law to charge. its tax free week for clothes by state tax, and maybe county tax, if they choose. what a nightmare.

 

thanks steve for this wonderful work, and for the pwa code fix I so dearly needed in order to prep my store for the paypal pro legal mumbojumbo.

 

problem is thjt the pages refresh when country is selected but the text field stays there and the dropbox with the option doesnt appear

Edited by chooch

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

problem is thjt the pages refresh when country is selected but the text field stays there and the dropbox with the option doesnt appear

its out of my league. i would revert to a pre country/state addon, and try again going slowly methodically over the changes one by one and checking them off as you do them.

seems like you are missing some code for refreshing the state part. or the js file isnt complete. make sense?

Link to comment
Share on other sites

There are a couple of poissibilities. One is that you missed one of the edits. This is the crucial piece of code:

// +Country-State Selector
       $zones_array = array();
        $zones_query = tep_db_query("select zone_id, 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_id'], 'text' => $zones_values['zone_name']);
       }
 if (count($zones_array) > 0) {
         echo tep_draw_pull_down_menu('zone_id', $zones_array);
 } else {
   echo tep_draw_input_field('state');
 }
// -Country-State Selector

 

It's also possible that the country code is not being set properly when you use the country list.

Link to comment
Share on other sites

There are a couple of poissibilities.  One is that you missed one of the edits. This is the crucial piece of code:

// +Country-State Selector
? ? ? ?$zones_array = array();
? ? ? ? $zones_query = tep_db_query("select zone_id, 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_id'], 'text' => $zones_values['zone_name']);
? ? ? ?}
?if (count($zones_array) > 0) {
? ? ? ? ?echo tep_draw_pull_down_menu('zone_id', $zones_array);
?} else {
? ?echo tep_draw_input_field('state');
?}
// -Country-State Selector

 

It's also possible that the country code is not being set properly when you use the country list.

 

i used the file from the download without editing it..

 

this is wierd

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

Thanks, Chris - this fixed my problem. As a non-initiada I would never have figuered this out. Pretty obscure - maybe a little caveat in the instructions? Otherwise great contrib - thanks Stevel!

 

 

When I change the country the webpage does not refresh? Why?

 

Chris....

 

 

 

I found the problem. I set Telephon minimum numbers to blank which caused an error and didn't load the file with the refresh function. Problem solved.

 

Does anybody know how to make Date of Birth or Gender not-required, but still show it as an optional entry for the customer to fill in?

 

Chris.....

Link to comment
Share on other sites

Can you give me a pointer to your site?

PM'd you with the url - thanks for looking

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

Can you give me a pointer to your site?

 

after getting that going i noticed that when i select united kingdom, i get an error on the bottom left of the screen (footer of the browser)

 

this doesn't happen when the oter countries with states/counties are selected, it happens just for the uk

 

i checked a site that has this mod and it doesn't happen when uk is seected from their dropbox

 

any tips please?

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

And the error says... ? I don't see an error when I try it at your site.

 

For the benefit of others, Aleem had disabled the "state" field in admin.

Link to comment
Share on other sites

And the error says... ?  I don't see an error when I try it at your site.

 

For the benefit of others, Aleem had disabled the "state" field in admin.

 

there is a yellow triangle in the ie browser, bottom left - it don't say anything

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

Doesn't show for me in IE. But I think that usually means it found a script error. But it doesn't for me. You may want to change the IE Advanced option to display every script error.

Link to comment
Share on other sites

Stevel - debugging tips would be great, and a fine time-saver for us "hunters-and-peckers"...

My create_account was insisting on state and tel entry after I'd applied Chris's fix - it was driving me nuts! (If no state/province avail. for drop-down, I certainly don't want to require it. Also, I want tel.no. to be voluntary.) Went back to continue my search for answers after my own feeble attempts failed royally. Read Chris's second portion of the posting and your reply to it - hmm, looked promising (I'd been fiddling with the form_check file to no avail). I took out

 

check_input("telephone", <?php echo ENTRY_TELEPHONE_MIN_LENGTH; ?>, "<?php echo ENTRY_TELEPHONE_NUMBER_ERROR; ?>");

and

<?php if (ACCOUNT_STATE == 'true') echo ' check_input("state", ' . ENTRY_STATE_MIN_LENGTH . ', "' . ENTRY_STATE_ERROR . '");' . "\n"; ?>

 

from the form_check, and set state min. value AND tel.no. min. value to "empty" in the admin - and VOIL?! Some more testing, maybe, but all seems to have the functionality I was after, now.

Thanks again for your great contrib.

 

 

Remove the following lines (they aren't adjacent) from includes/form_check.js.php:

<?php if (ACCOUNT_GENDER == 'true') echo ' ?check_radio("gender", "' . ENTRY_GENDER_ERROR . '");' . "\n"; ?>
<?php if (ACCOUNT_DOB == 'true') echo ' ?check_input("dob", ' . ENTRY_DOB_MIN_LENGTH . ', "' . ENTRY_DATE_OF_BIRTH_ERROR . '");' . "\n"; ?>

 

In create_account.php, remove

 ? ?if (ACCOUNT_GENDER == 'true') {
? ? ?if ( ($gender != 'm') && ($gender != 'f') ) {
? ? ? ?$error = true;

? ? ? ?$messageStack->add('create_account', ENTRY_GENDER_ERROR);
? ? ?}
? ?}

and:

 ? ?if (ACCOUNT_DOB == 'true') {
? ? ?if (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4)) == false) {
? ? ? ?$error = true;

? ? ? ?$messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);
? ? ?}
? ?}

Lastly, in includes/languages/english.php, change the values for ENTRY_GENDER_TEXT and ENTRY_DATE_OF_BIRTH_TEXT to an empty string.

Link to comment
Share on other sites

Doesn't show for me in IE.  But I think that usually means it found a script error. But it doesn't for me.  You may want to change the IE Advanced option to display every script error.

it was de-activated and the tiny triangle showed, so i decided to activate the error control in IE just to see the error code:

 

line 134

 

char1

 

error: document create_account state is null or not an object

 

code 0

 

any idea how to correct this error, please?

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...