I have an addressfield that uses the locality (city), administrative area (state), and country.
I am using Address Field 1.0-beta3.
I have configured my addressfield to be taxonomized by location taxonomy and to "Use full name" for both country and province.
I can add the following two values without trouble:
Country: United States (dropdown)
Admin area: Alabama (dropdown)
City: Montogomery
Country: Italy (dropdown)
Admin area: Alessandria
These values are stored and taxonomized correctly upon initial save.
However, after saving nodes containing these values, when I go to /admin/config/content/location_taxonomize and click "Empty Location Vocab" and then "Bulk Taxonomize Locations", Italy's "Alessandria" becomes "Alabama" in the taxonomy. I am guessing this has something to do with the fact that the Address Field formatter (in addressfield/plugins/format/address.inc) uses 'AL' as the code for both of these administrative areas.
Comments
Comment #1
ptmkenny commentedI uncovered the following with some additional testing:
My website uses a custom addressfield formatter (/addressfield/plugins/format/mycustomformatter.inc) which contains a selector for all of the prefectures (provinces) in Japan:
This allows users to select the prefectures from a drop-down list. If I have "Synchronize the Location Taxonomy with location data as soon as it's submitted." checked, the name of the prefecture will be added to the taxonomy properly. However, if this box is checked, or if I empty the taxonomy and then run bulk taxonomize again, only the abbreviation will be given for the administrative area.
Comment #2
leo82 commentedI have the same problem,
Italy
Milan
will be insert as
Italy
Michigan
i don't know if it works with Synchronize the Location Taxonomy with location data as soon as it's submitted
because automatic synchronization doesn't work for me
I don't know how to solve it because location for all over the world could be chosen
Comment #3
goron commentedThis happens because there is no way to get a province name from a province code. When taxonomizing in real time, the full name is available in the address form and can be added to to the taxonomy. But when bulk taxonomizing that's not available. I included US states in the module so those are possible, that's why Milan is turning into Michigan, etc.
I will look at AF again to see if there's a way to use it to convert province code to province name. If not, the only fix will be to make sure the milan/michigan thing doesn't happen...
Or, allowing modules to plug in province "dictionaries" to LT to achieve this, but I probably don't have time to implement this now.
Comment #4
ptmkenny commentedHere's a workaround which is kind of ugly but worked for my case:
Modify the relevant addressfield.inc (name may be different) file in plugins/format so that the "key" being used is not the abbreviation but rather the name of the administrative area.
Example:
Instead of
'TO' => t('Tokyo'),
use
'Tokyo' => t('Tokyo'),
This is OK for me because all my locations are in English. This way, when the bulk taxonomize operation runs, the terms are regenerated to match the assigned values.
Comment #4.0
ptmkenny commentedadded info on configuration
Comment #5
Michael Molchanov commentedHere is my fix of this issue. I'll profile this solution later and provide new patch.
Comment #6
Michael Molchanov commentedComment #7
proweb.ua commentedthx Michael
#5 works
Comment #8
narkoff commented#5 solved issue for me as well.