Germany States/Province cck_address_extensions Support (and now Lebanon too!)
yoyoman - February 8, 2008 - 00:57
| Project: | CCK Address Extensions |
| Version: | 5.x-1.6 |
| Component: | Other |
| Category: | feature request |
| Priority: | normal |
| Assigned: | rdsmith@drupal.org |
| Status: | needs review |
Description
The location module has include files for 248 countries that includes the names of the provinces along with some abbreviation of each. If I was to find a way to parse all those files and save the data to the "cck_address_states" and "cck_address_countries" tables, is there a way to generically have the form just show the available countries, activeselect the provinces in the selected country and not check anything else?

#1
Because the plugins are so easy to write, you could create a plugin module that does nothing, but accepts responsibility for all of the countries you mention. I'm trying to recall whether that's even possible, but it seems like it should be. I developed a hook that is called, and I think the first thing it is supposed to do is check whether it is responsible for the country being looked at, and if not exit immediately. You could simply not exit, but return a positive result, all without checking anything or even using an if statement at all if I am thinking correctly. If I'm right, it would be a trivial matter.
I was not aware that the location module had that information built-in. Is it accurate and up-to-date?
#2
The location module is in active development with a version 3 in the works. So, I'm guessing it's up to date. However, I don't know if anyone actively checks all the include files, especially for the more obscure countries.
I think the generic plugin idea would work well. I don't want to sit there and check off 248 boxes saying that I want to use that country. For my own interests, I'd just remove those lines from the database insert.
#3
I'm not sure how you'd get around selecting the 248 countries for use by the dropdowns other than to add a 'select all' checkbox and use javascript (jquery?) to select all boxes. That actually might not be too hard, and if there were actually a lot more submitted extensions to this project, I'd probably do it myself. Good luck. If you have questions while you develop, let me know in this thread.
#4
I guess I don't mind the 248 checkboxes, although on my Mac, both Camino and Firefox don't show the 2nd half of the list properly. I think I have jquery issues due to the collapsible nature of the list. However, on Safari on the mac, the list shows perfectly.
The thing I didn't want to do was have 200+ extra modules show up in the admin/modules section. I now have 253 countries and 3948 states in my database, and everything seems to work properly so far with selecting a country and having the states come up in the select menu. I haven't tested the saving aspect, but I imagine it should work fine.
#5
Oh, I see. Yes, one add-on module should be able to handle all of the states, as you said. I thought you were talking about the setup of the cck field. Thanks for clearing that up.
Hmm. That suggests to me that in the future, if there are enough add-on modules, that they could be combined by region with multiple countries in each. Once you're done adding to the two address tables, I'd be interested in a sql dump if you could manage that for me. I'm not sure yet what I'd do with it, but it interests me.
#6
Here's a zip file of my SQL insert statements.
#7
Hi Everyone,
I am new to Drupal. I've just installed Drupal 5.7 with cck_address.
I notice yoyoman has a patch with the complete county and provinces list.
I want to know what is the best module and/option for me to us that can list all the countries in the world with the drop down menu for user to select when registering on a site ?
Is CCK_Address the choice ? If yes, can you tell me how and where to apply yoyoman's patch ?
I notice it's a SQL dump, where do I dump this ?
Thanks for the good work in creating this module for everyone to enjoy.
Hanly
#8
Subscribing, interested in country/provence listing in my website. Greetings, Martijn
#9
#10
Good Evening:
I and a Fellow Programmer at our Organization worked with the cck_address_extensions module and she used Excel to de-dupe the SQL file ( country_provinces.sql_.zip ) that dumped all the SQL for the foreign country extensions.
She had to do some extensive work to get the .sql de-duped!
Here are the steps we took to get the "country_provinces.sql_.zip" shaped up to import into our database..
0. Backed Up the tables 'cck_address_states' and 'cck_address_countries' from 'our_drupal' database
1. Dropped INDEX and recreated INDEX for the tables cck_address_states and cck_address_countries
DROP INDEX state_name ON cck_address_states; # MySQL returned an empty result set (i.e. zero rows).
ALTER TABLE cck_address_states ADD UNIQUE INDEX ( state_name, country_code ) ; # MySQL returned an empty result set (i.e. zero rows).
2. Re-inserted the old tables (backed_up_cck_address_countries_states.sql) to create default country listings and restructured data with new index
2.5. Dropped INDEX and recreated INDEX for the tables cck_address_states and cck_address_countries
DROP INDEX state_name ON cck_address_states; # MySQL returned an empty result set (i.e. zero rows).
ALTER TABLE cck_address_states ADD UNIQUE INDEX ( state_name, country_code ) ; # MySQL returned an empty result set (i.e. zero rows).
2.75 Dropped all foreign country entries in 'our_drupal' database that would be also entered by running the newly de-duped 'country_provinces_de-duped.sql'
3. Ran de-duped SQL queries (http://drupal.org/node/219114) {country_provinces_de-duped.sql } to create rest of foreign country and state listings
4. Now one can now create new Field Types and The rest of the Countries will Show in Drop Down for field type
#11
Greetings:
There are three countries (Germany, Lebanon, Tonga) missing from the original 'country_provinces.sql_.zip' and therefore from 'country_provinces_de-duped.sql_.gz'. Below is the .sql for inserting the countries into the 'cck_address_countries' table. I'll later enclose the .sql for the compelete inserting of the countries cities and states (or) enclose a new cck_address_extensions module with all the countries as full modules in it.
Cheers,
Robert D. Smith
#12
Greetings:
In order for the country 'Lebanon' to show up in the Country Drop Down, Please go into the table 'cck_address_countries' in your Drupal database and then search for the country code 'lb' and delete the entry in the database that has ( '$id' for the Country Name and 'lb' for the Country Code).
Attached below is a *.zip of the folder that should be added into the 'cck_address_extensions' folder
to add the German Language Support to the 'cck_address_extensions' module.
Cheers,
Robert D. Smith
#13
Greetings:
Attached below is a *.tar.gz and a *.zip of the latest of the 'germany' and 'lebanon' states/provinces add-ons folder(s) that should be added into the 'cck_address_extensions' folder
to add the latest German and Lebanese Address support to the 'cck_address_extensions' module.
Cheers,
Robert D. Smith