Closed (outdated)
Project:
Location
Version:
6.x-3.0
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
1 Apr 2009 at 04:47 UTC
Updated:
19 Jul 2016 at 11:58 UTC
Jump to comment: Most recent
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.
Comments
Comment #1
no longer active 7 commentedI have found solution. I have used php code in views argument for country-name.
Comment #2
yesct commentedwhat exactly did you use for the php code?
related to #286066: asking for help outputting country name instead of country code ?
Comment #3
no longer active 7 commentedhi 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.
Comment #4
yesct commentedtagging
Comment #5
summit commentedSubscribing,
Do you may be know code how to deal with this, with location-names which are not english?
greetings. Martijn
Comment #6
yoda-fr commentedHey 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
Comment #7
JaredAM commentedYoda, 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.
Comment #8
yoda-fr commentedhi 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 !
Comment #9
ErikU commentedI am also having this issue, but it it for all location arguments. I am using URL-Alias to use "location-country_name_0/location-province_name_0/location-city_0/[title-raw]"... but the arguments only work if I use "location-country_0/location-province_0/location-city_0/[title-raw]"
Comment #10
Anonymous (not verified) commentedI implemented the code to make it non-case-sensitive (sort of).
It is simple but maybe it helps
Comment #11
legolasboClosing old D6 issues as D6 is end of life