I used this ISO 3166 list ( http://en.wikipedia.org/wiki/List_of_countries_by_continent_(data_file) )
of countries / continents to generate the mysql table attached. It lists a two letter continent code for each two letter country code. I used this table to add a continent filter and argument to location_views. I thought it might be helpful for someone else to have the table already made like this. If anyone is interested I can post the code I added to location_views as well.

Comments

bdragon’s picture

Component: Code » Data update

Changing component to Data update.

swortis’s picture

Any way of using this with version 5? Would be great to create Views by continent without having to duplicate info with Taxonomy.

frdesign’s picture

This is exactly what I was looking for. I'm working on my first Drupal site which is travel related so filtering location enabled nodes by continent would be awesome! I'd love to get the code you created for "location_views" as well.

If you can spare a moment could you give me a quick overview of how to make this update work with the location default setup on D6?

Thank you very much!

yesct’s picture

Category: task » feature
Status: Active » Postponed
Issue tags: +location ISO codes

Tagging. Also, I'll change this to a feature request. This sounds really cool. If someone wants to create a patch to implement this, please do. I'll mark it postponed for now, because this might be an idea worth investigating in the future.

miloyz’s picture

Great, this is what i am looking for.
It will be really helpful if you could also share the code of add filter on the views.

lucascaro’s picture

Hi all, is this still an issue? I'm creating a small module similar to location_phone and location_fax but for location_continent that imports the data and allows to use the field in views. I can post it somewhere if anyone is interested.
cheers.

konrad_m’s picture

Hi Lucascaro,

Yes, I'm interested in your module.

kind regards,

konrad

lucascaro’s picture

StatusFileSize
new6.11 KB

This is what I've made.
Creates a table with countries x continents
Creates a table with continents

Adds a continent field for locations so users can select the continent, having "Auto" as an option so the continent is deduced from the country.

Adds a views field and filter for location continent (either code or name).

this is not heavily tested yet, so please if you find bugs let me know.

yesct’s picture

Status: Postponed » Active
Issue tags: +location useful code

what would the attached code look like as a patch to location?
Please make a patch.

lucascaro’s picture

you would need to uncompress the .tar.gz inside location/contib directory, so it's like modules/location/contrib/location_continent
and then enable the module in admin/build/modules

emarchak’s picture

I'm using that along with the i18n for multilanguage support, and I've started receiving the following errors:

user warning: Unknown column 'n.tnid' in 'on clause' query: SELECT c.continent,n.name FROM location_continent c INNER JOIN location_continent_name n ON (c.continent = n.code) LEFT JOIN node i18n ON n.tnid > 0 AND n.tnid = i18n.tnid AND i18n.language = 'el' WHERE (n.language ='el' OR n.language ='' OR n.language IS NULL OR n.language = 'en' AND i18n.nid IS NULL) AND ( lid = 59) in /public_html/sites/all/modules/location/contrib/location_continent/location_continent.module on line 63.

I've tried manually creating language columns in the tables, but it doesn't appear to be working. Do you have any suggestions?

saranyamohan’s picture

Thank u so much........itz very helpful to me...

lucascaro’s picture

StatusFileSize
new8.55 KB

Hi there, I'm sorry it took me so long to answer this. Here is an updated version of the module, in case you still need it working.

pippal’s picture

This is great, thanks for sharing your code, will be using it on http://worldeventyoungartists.com

Is it difficult to create an argument handler for the continent? I'd like to create a block that lists other nodes from the same continent as the current node using a combo of arguments and viewsattach.

I had a look at locations argument handler for country and thought I'd give it a go, did some cut and paste, swapping country for continent and adding references in views.inc but I'm not a developer so surprisingly it didn't work - no error messages, just didn't filter the results.

I'll go back and look at the views docs but any help getting this running would be much appreciated

lucascaro’s picture

StatusFileSize
new21.33 KB

well, you might want to try the module I put together when using this data. I'm attaching it here, but it's very alpha and made to solve my use case.
It should work though, since is mainly the country module changed, but I've never tested it outside my environment.
Also, this module installs the above data on hook_install.
There is no documentation but maybe you can use the code.

Goold luck

Donatoo’s picture

Great idea! Any plans to port it on drupal 7?

lucascaro’s picture

sadly, not for now.

Donatoo’s picture

Sorry to hear that. Thanks anyway!

pippal’s picture

yeah thanks again.

I have the code from #13 working here http://worldeventyoungartists.com/partners (click on the continents in the map) - and found a suitable navigation menu without an argument handler. All seems to be working fine. I had to remove the install code in #13 as it tried to run every time I ran update.php for other modules but I guess that might not be the case in 0.2, just an FYI for any one else finding this thread.

Any one able to get this into the location module itself?

llorberb’s picture

A few issues/questions

I have tried the module in post #13 and #15.

1. I have added an exposed filter to a view. When I search oceana continent for example, posts associated with South America show up. And when I search South America posts from South America and Asia come up. Any idea whats wrong here? (I have checked the underlying nodes and the association are correct such as Peru --> South America, US --> North America)

2. What does "update continents" do? When I press leaves me with a blank screen, does that mean the cache is refreshed.

3. When a user creates/edits a node with a location, is there a way to hide the continents field from the view of the user and always set to Auto?

Thank so much. Assuming I can get this working right, this is a huge help to me and many others.

Lauren

pippal’s picture

I can only help you with 3. If it were me I would just use CSS to hide the continent field.

legolasbo’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closing old D6 issues as D6 is end of life