Closed (won't fix)
Project:
Addressfield Tokens
Version:
7.x-1.1
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
10 Jul 2012 at 22:47 UTC
Updated:
22 Oct 2012 at 19:53 UTC
Your module almost solves my problem by allowing me to display the full country name in a views query. However, when I sort by country views is still only allowing me to use the 2 letter abbreviation which means that United Kingdom appears between France and Germany (presumably because its 2 letter abbreviation is GB).
I'd like to sort on the full country name. If there's a way to do this please let me know.
Thanks,
Joe
Comments
Comment #1
amarcus commentedGood question, Joe.
But unfortunately I feel like that's going to be fairly difficult. Views first queries the database, then passes the sorted results off to the field formatters, such as addressfield_tokens, to actually render the display. However, the mapping from country abbreviations to country names is in code (within Drupal core's locale package) but not in the database.
The result is that the field formatters have access to this mapping, but the database query does not. In order to sort by country name, you could create a taxonomy for all the countries and link each of your nodes to it. You could also write some glue code to automatically relate a node to a taxonomy term based on the address field. We actually have a module that does this, but it's still somewhat tailored to our specific application and is not ready to be released. But I could send you the code for it so you could play around with it.
--
Andrew
Comment #2
amarcus commentedComment #3
pfeff commentedHey Andrew,
Thanks for getting back to me. The 2 letter country code has been a PITA in a few places :)
I ended up just adding a drop down filter at the top of the page with the countries in it. Thankfully, in that list they're full country names and are sorted correctly. As a consequence I'm no longer as concerned with the ordering on the rest of the page.
Thanks again though. Your module has saved me a lot of hassle :)
Joe
Comment #4
mxtThis module can be useful in this case: http://drupal.org/project/location_taxonomize