Jump to content
stevel

Country-State Selector

Recommended Posts

Ok everything seems ok ecept Order_info which I think is part of PWA, um using Version 0.910 which I beleive is the most stable correct? is there a fix or something for this?

Share this post


Link to post
Share on other sites

Solution to STS conflict.

For those who use STS will face the problem that the state not being refreshed when a new country is selected.

See if the admin side of your shop works with the contrib. if it does work on admin side, congratulations, you have installed the contrib successfully.

 

Now, open up your includes/sts_templates/test/sts_template.html file or whatever you named your template to be.

 

at the header of the file, you should be calling some javascript files.

open any of them, and insert this code at the end.

I inserted mine in the prototype.js file

 

function refresh_form(form_name) {
  form_name.action.value = 'refresh';
  form_name.submit();
  return true;
  }

 

now it will work like a charm.

 

The problem was that STS template wasn't calling the js file included in the contrib.

So a simply trick is to manually insert the refresh code to the js file that template file is calling!

 

Thanks for great contrib.

 

-Dan-

Edited by miniwangja

Share this post


Link to post
Share on other sites
New version 1.4.0 posted with bug fixes, minor new features.

 

Steve I used your version and on the state drop down i get a () after every state. ex. California ()

Share this post


Link to post
Share on other sites

Yep, that was it. The error was only in the instructions in the readme - the pre-edited files were fine. It was only the edit for line 418 of create_account.php that was missing the zone_code from the query. Thanks for pointing it out.

Share this post


Link to post
Share on other sites

well i'm stumped. for some reason my zone drop down is not dropping down... It just shows up as a default input field. is there any known bugs or issues?

 

I tried a little debuging but i'm not to familur with php yet. I concluded that its not getting past either of the following 2 if statements that are around 580.

 

if ($HTTP_POST_VARS['action'] == 'process') {

if ($entry_state_has_zones == true) {

 

 

 

I use create_account3.php

with:

show_account_box =1

create_password =0

show_login=1

 

thanks for your help :)

Share this post


Link to post
Share on other sites

STS Template Contribution Fix

 

I have figured out how to get the contrib to work with the STS Contrib (and I'm assuming in any other template system).

 

You will need to edit your index.php.html AND your sts_template.html files (or the primary template files for your system).

 

Just above the </HEAD> in your template file, add:

 

<script language="javascript">
function refresh_form(form_name) {
  form_name.action.value = 'refresh';
  form_name.submit();
  return true;
  }
</script>

 

That's it.

Share this post


Link to post
Share on other sites

Hi there,

 

I see that someone else has had a similar problem to myself a few pages back, but i couldn't figure the solution.

 

I'm trying to incorporate this with fast easy checkout, which uses javascript to copy across the billing address as the shipping address.

 

I've pretty much got it working (i'm a bit of a hacker rather than a programmer ;) )but the script fails when i try and copy across the billing address.

 

Any help would be much appreciated.

 

The page i'm working on is....

 

here

 

Thanks for any help/ suggestions

 

Regards

 

Dave

Share this post


Link to post
Share on other sites

Just wonder anyone encountered this error?

 

Parse error: syntax error, unexpected T_ECHO in /myweb/catalog/admin/customers.php on line 614

 

I copy exactly from the readme.html as well as customer.php file. Anything that I missed out?

 

Thanks in advance

Share this post


Link to post
Share on other sites

Hi everyone,

 

I am having an issue with the final step of the process. Everything works great up to that point in the install process.

 

When modifying the catalog/admin/includes/functions/html_output.php I am getting errors after saving the code.

 

The step says to add this before the closing ?>:

 

// +Country-State Selector

// Adapted from functions in catalog/includes/general.php and html_output.php for Country-State Selector

// Returns an array with countries

// TABLES: countries

function css_get_countries($countries_id = '', $with_iso_codes = false) {

$countries_array = array();

if (tep_not_null($countries_id)) {

if ($with_iso_codes == true) {

$countries = tep_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "' order by countries_name");

$countries_values = tep_db_fetch_array($countries);

$countries_array = array('countries_name' => $countries_values['countries_name'],

'countries_iso_code_2' => $countries_values['countries_iso_code_2'],

'countries_iso_code_3' => $countries_values['countries_iso_code_3']);

} else {

$countries = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "'");

$countries_values = tep_db_fetch_array($countries);

$countries_array = array('countries_name' => $countries_values['countries_name']);

}

} else {

$countries = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " order by countries_name");

while ($countries_values = tep_db_fetch_array($countries)) {

$countries_array[] = array('countries_id' => $countries_values['countries_id'],

'countries_name' => $countries_values['countries_name']);

}

}

 

return $countries_array;

}

 

////

// Creates a pull-down list of countries

function css_get_country_list($name, $selected = '', $parameters = '') {

$countries_array = array();

 

$countries = css_get_countries();

 

for ($i=0, $n=sizeof($countries); $i<$n; $i++) {

$countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);

}

 

return tep_draw_pull_down_menu($name, $countries_array, $selected, $parameters);

}

// -Country-State Selector

 

 

But when I do this and save it I get:

 

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/oscommerce/catalog/admin/includes/functions/html_output.php:386) in /var/www/oscommerce/catalog/admin/includes/functions/sessions.php on line 97

 

And then I can't do anything else. Has anyone else come across this?

 

Thanks in advance!

Share this post


Link to post
Share on other sites

I know others (including Dennisra) have had this same problem, but I can't find if anyone posted the solution.

 

Since I implemented the Country-State Selector, the customer's state does not get written to the database field.

 

I'm not sure, but I think this may be why my Change Address button is giving me an error now. I know it worked before.

 

Can anyone tell me how to get the state (and what I REALLY want is the zones table zone_code, e.g., NY, PA, NJ, etc.) to write to the address_book state field? Thanks.

 

DiAnn Ohama

Share this post


Link to post
Share on other sites

For some reason I stopped getting notification of replies...

 

amanfashion - you made an error in your typing. I suggest you look closer.

 

jgarniss - the usual cause for this error is adding some text outside of the PHP brackets in english.php, or perhaps in html_output.php though I don't think that file would trigger the error.

 

DiAnn, all I can suggest is the usual which is to compare (using a file comparison tool such as Beyond Compare) your files against the pre-edited versions supplied in the ZIP file. This may help you discover the problem.

Share this post


Link to post
Share on other sites
well i'm stumped. for some reason my zone drop down is not dropping down... It just shows up as a default input field. is there any known bugs or issues?

 

I tried a little debuging but i'm not to familur with php yet. I concluded that its not getting past either of the following 2 if statements that are around 580.

 

if ($HTTP_POST_VARS['action'] == 'process') {

if ($entry_state_has_zones == true) {

 

You were supposed to remove that code - with the contribution properly installed, the test on $entry_state_has_zones should not appear.

Share this post


Link to post
Share on other sites
STS Template Contribution Fix

 

I have figured out how to get the contrib to work with the STS Contrib (and I'm assuming in any other template system).

 

I gather you skipped over the "Debugging Tips" in the ReadMe - in particular the first tip? :rolleyes:

Share this post


Link to post
Share on other sites
I know others (including Dennisra) have had this same problem, but I can't find if anyone posted the solution.

 

Since I implemented the Country-State Selector, the customer's state does not get written to the database field.

 

I'm not sure, but I think this may be why my Change Address button is giving me an error now. I know it worked before.

 

Can anyone tell me how to get the state (and what I REALLY want is the zones table zone_code, e.g., NY, PA, NJ, etc.) to write to the address_book state field? Thanks.

 

DiAnn Ohama

 

I didn't have quite the same problem you are having. I was trying to get the state name in my copy of the new user's registration email message. The state information was written to the database okay. I just didn't know how to access it.

If I where you I would compare the files as suggested with something like http://www.prestosoft.com/ps.asp?page=edp_examdiffpro

Share this post


Link to post
Share on other sites

OHAMA:

I found the post that you referred to in Dec 2005:

"Interesting. That line is one of those that I changed as a result of the osCommerce 051113 update. $country is correct, not $country_id. Note that there are two occurrences of that line in address_book_process.php."

 

In the file address_book_process.php I changed $country_id to $country (Twice) and that soloved my proble.

Share this post


Link to post
Share on other sites
OHAMA:

I found the post that you referred to in Dec 2005:

"Interesting. That line is one of those that I changed as a result of the osCommerce 051113 update. $country is correct, not $country_id. Note that there are two occurrences of that line in address_book_process.php."

 

In the file address_book_process.php I changed $country_id to $country (Twice) and that soloved my proble.

 

Thanks for the quick responses, Dennis and Steve!

 

I compared the files, and I had rearranged some parts, so it's highly likely I deleted something or messed a piece up. I'm redoing it. If that isn't the solution, I'll look at address_book_process.php.

 

Thank again!

 

DiAnn

Share this post


Link to post
Share on other sites

v1.5 Release with AJAX functionality.. (No page refresh, behind the scenes updating)

 

Upgrade instructions are not given.. you can compare the files using something like Beyond Compare or take a look at the installation document..

 

Edits to original code are fewer than previous versions, main dropdown code has been abstracted to a function, ajax submission is done to the same page with the dropdowns so no extra ajax files other than the javascript file and the function file..

 

Cheers :thumbsup:

 

J

Share this post


Link to post
Share on other sites
v1.5 Release with AJAX functionality.. (No page refresh, behind the scenes updating)

 

Upgrade instructions are not given.. you can compare the files using something like Beyond Compare or take a look at the installation document..

 

Edits to original code are fewer than previous versions, main dropdown code has been abstracted to a function, ajax submission is done to the same page with the dropdowns so no extra ajax files other than the javascript file and the function file..

 

Cheers :thumbsup:

 

J

 

Thanks very much for your contribution. I just want to know if i have make it work thouroughly, why only few of contry, for example USA, Australia...have the state for select, the others country no, I would like to know how can i make all the country can be selected. Thanks very much!

Share this post


Link to post
Share on other sites
Thanks very much for your contribution. I just want to know if i have make it work thouroughly, why only few of contry, for example USA, Australia...have the state for select, the others country no, I would like to know how can i make all the country can be selected. Thanks very much!

 

 

I think i should read all the contribution before as this stupid question. It is decided by the zoon in admin, then use contribution such as world zoon(http://addons.oscommerce.com/info/1792) to get more contry state, thanks for the great contribution.

Share this post


Link to post
Share on other sites
Thanks very much for your contribution. I just want to know if i have make it work thouroughly, why only few of contry, for example USA, Australia...have the state for select, the others country no, I would like to know how can i make all the country can be selected. Thanks very much!

world_zones_v2_7a addon


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

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

×