I try to filter selective on countries that come from Address Field Module but I can't get it to work with the full country names. If I check off the country fields "Display the localized country name instead of the two character country code" the selective filter works. Otherwise the dropdown list is populated correctly with the countries that are in the result set, but after clicking "Apply" there are no more results.
I have tried to rewrite the output of the the country field used by the selective filter but this just shows the rewrite pattern itself like [replacement] so many times like the results. The filter nevertheless works that way too.
Is there something i overlooked or is this a common restriction?
Comment | File | Size | Author |
---|---|---|---|
#18 | 2504309-18-rerolled.patch | 1.55 KB | glynster |
#6 | views_selective_filters-select_list_key_fix-2504309-6.patch | 1.74 KB | jerry |
Comments
Comment #1
Valera Tumash CreditAttribution: Valera Tumash commentedI have exact same issue. In addition when you change the url from
?field_address_country_selective=Australia
to?field_address_country_selective=AU
it will work.Any updates on this thread?
Comment #2
drupal_sh CreditAttribution: drupal_sh commentedValera, I have the same issue too. Were you able to find a workaround to get this to work?
Comment #3
iampumaIn the selective handler file retrieving the key with the get_value() function is not working correctly for select fields.
The patch will retrieve the value directly through the field alias, afterwards go further with get_value() if a value is not found.
Comment #4
iampumaComment #5
iampumaUpdated to check for an array or object instead.
Comment #6
jerry CreditAttribution: jerry as a volunteer commentedAttaching an updated version of the patch above to limit the field alias to 60 characters, as is apparently required.
Comment #7
herved CreditAttribution: herved commentedI got the same issue today.
Indeed it seems field aliases are limited to 60 chars in \views_plugin_query_default::add_field().
The patch in #6 looks good to me and is working well.
Thank you everyone ;)
Comment #8
petr.hajek CreditAttribution: petr.hajek at Aira GROUP s.r.o. commented#5 Worked for me. (I haven't tested #6)
Thanks.
Comment #9
michael_wojcik CreditAttribution: michael_wojcik as a volunteer and at Mediacurrent commentedRan into the same issue with Country and State (AKA Administrative Area) fields from the Address Field module.
Patch from #6 worked perfectly for me.
Marking this issue as "Reviewed & tested by the community". Patch from #6 should be ready to be ported, pending the module maintainer's approval.
Comment #10
david_garcia CreditAttribution: david_garcia commentedI've been looking into this and it looks as though there are 2 different issues here. One related to alias length and the other I'm still not sure what to.
I've opened a separate issue for the truncated alias problem.
#2743873: Field aliases are limited to 60 characters
As for the original report in this issue regarding address field, and the implemented solution, I'd like to see an explanation as to why this:
Has priority over:
When the original implementation was the other way round.
Comment #11
david_garcia CreditAttribution: david_garcia commentedBTW, before RTBC an issue ensure that a proper summary template has been used and filled in the description:
https://www.drupal.org/issue-summaries
Thanks!
Comment #12
david_garcia CreditAttribution: david_garcia commentedComment #13
glynster CreditAttribution: glynster commentedI have applied views_selective_filters-select_list_key_fix-2504309-6.patch and addressfield now works successfully with selective view filter. I am using the latest version of views_selective_filter. RTBC +1
Comment #14
ochic CreditAttribution: ochic commented#6 works for me with 7.x-1.5, but I cannot apply the patch with dev version.
Comment #15
achikas CreditAttribution: achikas commentedgreat patch. would be nice to see it in the next version.
Comment #16
bohemier CreditAttribution: bohemier commented#6 works for me as well... RTBC as well
Comment #17
NWOM CreditAttribution: NWOM commented#6 still works great. Thank you!
Comment #18
glynster CreditAttribution: glynster commentedRereolled #6 to work with latest dev version and 7.x-1.6