Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Country-State Selector


stevel

Recommended Posts

  • 2 weeks later...

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
Link to comment
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.

Link to comment
Share on other sites

  • 2 weeks later...

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 :)

Link to comment
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.

Link to comment
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

Link to comment
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

Link to comment
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!

Link to comment
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

Link to comment
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.

Link to comment
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.

Link to comment
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:

Link to comment
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

Link to comment
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.

Link to comment
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

Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
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!

Link to comment
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.

Link to comment
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

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...