We have a view built that displays nodes from three countries (U.S.A, Mexico, Canada). We have used the location module to input our location data and are using the Gmap module to display the nodes via Google maps. When building the filters (which we exposed) for our views display we noticed that the Location: Country filter does not respect 'Is' or 'Is Not' operator. Instead of just showing USA, Mexico and Canada (the three countries we selected when configuring the filter )the dropdown select list in the exposed filter still displays all the countries. I am pretty sure this is a bug in the location_handler_filter_location_country.inc file, but I do not know where to begin to fix this issue. Any help or suggestions would be greatly appreciated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

j0rd’s picture

Same issue. Would like a resolution myself.

Other views fields (content textfield) have an option for "filter to selected items" when you expose a view. Location should include this as well.

j0rd’s picture

Version: 6.x-3.x-dev » 6.x-3.1-rc1
Status: Active » Needs review
FileSize
1.9 KB

Here's my patch, which takes some code from the views_handler_filter_in_operator which provides the "Limit list to selected items" functionality and copying some code from that codebase as well.

I'm not sure if this will cause any other problems, so I'd recommend someone who knows views more than me review the code before it's committed into the codebase.

marqpdx’s picture

Hi,
i'm getting the same issue. i tried the patch, but it did not seem to work for me. i have selected a subset of the listed countries, yet all of them show in the dropdown.
thanks,
m

j0rd’s picture

I applied this patch again to my location module and it worked again. I'm not sure what your issue is. Does the patch not apply for you?

cd sites/all/modules
patch -p0 < location_views_exposed_filter_country_filter.diff

You'll of course need to select the countries you want to show up in your exposed views filter. For me, this patch works. I'm using the latest Views and Location modules to date.

q0rban’s picture

Attached patch fixes it for me.

marqpdx’s picture

i applied the latest patch, by hand, and it worked fine. thank you very much!!!

will this be rolled into a release?
much appreciated. this is huge for us!
thanks again.
m

alison’s picture

Just came over from a duplicate issue I created (#759748: Filter by Country, exposed, limit list to selected), not finding this one first...

Anyway, I just wanted to give a "me too!!" to supporting getting this feature into a release at some point. Thank you!

YesCT’s picture

Issue tags: +location bdragon check

tagging.

YesCT’s picture

Component: Code » Location_views

alisonjo2786, I saw your "me too", one of the best me too's to get anything into location is to do a review *grin*

http://drupal.org/patch/review

Please contact me if you want help doing a review.

clashar’s picture

subscribe

Sinovchi’s picture

I applied patch from #5 and it works very well! Thank you for this module and patch! Will this patch be included into the locations module?

vosechu’s picture

Status: Needs review » Reviewed & tested by the community

patch from #5 works great for me as well. Setting to rtbc.

Fabianx’s picture

subscribe, from looking at the code it seems fine.

rooby’s picture

Version: 6.x-3.1-rc1 » 6.x-3.1
Status: Reviewed & tested by the community » Fixed

Changing version as problem still in current version.

Thanks for the patch, works as expected.

Committed patch in #5 to 6.x-3.x and HEAD.

http://drupal.org/cvs?commit=473680
http://drupal.org/cvs?commit=473682

rooby’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

awasson’s picture

Subscribing