location country-name instead of country-code in views argument
no longer active 7 - April 1, 2009 - 04:47
| Project: | Location |
| Version: | 6.x-3.0 |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
| Issue tags: | location country name vs country code, location useful code, location view arguments |
Jump to:
Description
I am having issue with location country-name in views argument.
I am having my view with path destination/in. It is giving me listing of all the nodes of india and working fine. Here i am using views argument of location country. But it is working with country-code only, not with country-name. I want to create view using destination/india i.e country-name.
Anyone please having any idea ??
Thanks,
Anjan.

#1
I have found solution. I have used php code in views argument for country-name.
#2
what exactly did you use for the php code?
related to #286066: asking for help outputting country name instead of country code ?
#3
hi i have written php code in validator of location country arguments. Here i need to replace all spacing into '-' so i have done code accordingly.
$country_names = array_flip(location_get_iso3166_list());
$country_name =$argument;
$country_code = $country_names[$country_name];
if($country_code) {
$handler->argument = $country_code;
return true;
}
You need to do changes according to your requirements.
#4
tagging
#5
Subscribing,
Do you may be know code how to deal with this, with location-names which are not english?
greetings. Martijn
#6
Hey there,
I hope you could help me. I am french so sorry for my language. When I put in a view the "location: Province" as arguments, the view show me nothing because in the data base, this is note the french location name but a code ("B64 instead" of "Pyrenees-Atlantiques - Aquitaine" for example). Does someone know how to read the table to display informations?
Here is the request
SELECT node.nid AS nid,
node.title AS node_title,
location.province AS location_province,
location.country AS location_country
FROM node node
LEFT JOIN location_instance location_instance ON node.vid = location_instance.vid
LEFT JOIN location location ON location_instance.lid = location.lid
WHERE (node.type in ('evenements')) AND (location.province = 'Pyrenees-Atlantiques - Aquitaine')
When I try the code given by anjandoshi, views preview tells me 'No query was run'
Thanks a lot
#7
Yoda, do you want to use an argument or do you want to use a filter? It sounds like you need to set province as a filter instead of an argument.
Arguments come in from the url www.mysite.com/usa where 'usa' is the argument coming in.
#8
hi JaredAM,
thanks for your answer. I would like to use province as an argument automatically have page like www.mysite.com/provinceName for all provinces.
For now, I have found an other solution, I make a view and I group results by province but I have all the provinces and results on the same page.
Thanks again for your help.
Have a nice day !