I previously implemented the CCK Address International patch shown here: http://drupal.org/node/175444#comment-731876. This allows users to pick from a list of all countries in a CCK address field without any dependencies.

I'm not sure of all your plans for Location 3, but I'd really recommend including the cck_address_countries table from the patch in your INSTALL file. You can just perform a check to see if the table already exists in a user's database, and if so skip the installation of it.

Once the table is in place, the _location_get_iso3166_list() function located in the location.inc file can be greatly simplified:

<?php
// The following is an array of all countrycode => country-name pairs as layed out in
// ISO 3166-1 alpha-2
function _location_get_iso3166_list() {
   $iso3166 = array();
   $result = db_query('SELECT * FROM {cck_address_countries} ORDER BY printable_name ASC');
   while ($results = db_fetch_object($result)) { 
   	 $iso3166[strtolower($results->country_code)] = $results->printable_name;
   }
   return $iso3166;
}
?>

Comments

sgdev’s picture

Version: 5.x-2.7 » 5.x-1.x-dev

I just realized, 5.x-1.x actually has a post date later than 2.7.

yesct’s picture

Issue tags: +location geo-coding, +location ISO codes
yesct’s picture

If someone is interested in this, please create a patch against the latest version.

I'll try and collect together the ISO code related issues with tags. Tagging.

summit’s picture

Subscribing, also for D6 :) Greetings, Martijn

ankur’s picture

Status: Active » Closed (works as designed)

Not sure if this still applies. Re-open this issue for 7.x-4.x only if it still applies in D7