Hi!
After succesfully used of this module in conjunction with Location module (see: http://drupal.org/node/1542404), I am experimenting now integration with Addressfield module (that's assuming more and more importance, and the version 7.x-5.x of Location module itself most likely will be based on it - see: http://drupal.org/node/1346746).
So, I've created a view that retrieve all Countries with at last a node associated to (see it in attachment).
Then I've setted up a Global Filter to use this Views.
Results:
The resulting select show problem very similar to issue in http://drupal.org/node/1542404:
<select id="edit-view-global-filter-addressfield" class="global_filter_2-view_global_filter_addressfield form-select" name="view_global_filter_addressfield">
<option value="">Worldwide</option>
<option selected="selected" value="46">AL</option>
<option value="50">US</option>
</select>
But, we have here different problem:
- Options shows country CODE instead of country NAME
- Values in options are the NIDS of nodes associated to countries (instead they would be country CODES)
- Other countries associated to a single node (addressfield setted up to multivalue) are omitted (e.g. my view correctly retrieve also the country US for the same node that also have IT)
What I really don't understand is this mismatch of what Views returns with what the select provided by Global Filter shows: why Global Filter retrieve NIDS when my view doesn't return those? And why some records are missed when Views returns that instead?
Thank you very much.
Comment | File | Size | Author |
---|---|---|---|
exported-views.txt | 5.44 KB | MXT |
Comments
Comment #1
RdeBoerSorry MXT,
Is this still an issue for you? Or did you find an alternative solution?
Rik
Comment #2
MXTHi!
unfortunately this is still an issue...
Comment #3
danon1981 CreditAttribution: danon1981 commentedSubscribing
Comment #4
MXTYES, I have a working solution now.
I think all problems here are due to what amarcus explains here: http://drupal.org/node/1678596#comment-6226254
So, to resolve, I've used the addressfield_tokens module and developed a workaround similar to what I've already used here: http://drupal.org/node/1542404#comment-6046606
Addressfield_token provides a function _addressfield_tokens_country() very similar to location_country_name() provided by location module.
Here what I did:
In the view that retrieves all countries list I opted to use addressfield_token formatters/tokens, an turn on aggregation settings to group by country. In this way I obtain a select that shows wrong html, but correct data (resolving issue I've described in point 3 in my first post in this thread):
So now I can do a form_alter to manipulate and rebuild the select in this way:
And all works fine now!
Yes, this is still a workaround, so I hope this module can better manage addressfield data someday...
Thank you very much!!!
Comment #5
RdeBoerNo thank you MXT!
Your code will make a generic Addressfield integration easier. Great job.
I want to work on the integration, but don't have the time right now.
Rik
Comment #6
ceaucari CreditAttribution: ceaucari commentedIf i got it wright I think you could use http://drupal.org/project/location_taxonomize to automatically generate taxonomy terms from Address fields and this terms can be used with global filters
I hope it helps.
Comment #7
MXTThank you for your suggestion ceaucari but we already know about location_taxonomize (see my comment here: http://drupal.org/node/1542404#comment-6039412).
What we are trying to do here has another purpose.
Comment #8
RdeBoerNot so easy to create a generic solution for this.
For people wanting to do something like this with AddressField I suggest following along the lines of what MXT did in #4.
Rik
Comment #9
RdeBoerClosing as no further expressions of interest and MXT provided a solution in #4.