When the location Country field is added as an exposed filter in a View, the "Force single" option is selected, and a default value is given, the resulting query returns no rows. In my case, I have the default value set to USA. If I hit the view with no parameters, no rows are returned, despite USA being selected by default in the exposed filter. When I click the filter Submit button, the resulting query is fine.
I have tracked this down to location_handler_filter_location_country.inc's query() method lines 66-73. When "Force Single" is selected, $this->values looks like array( 0 => 'us' ).. when Force Single is not selected, $this->values looks like array( 'us' => 'us' ).. thus, these lines end up putting 'country='0'' in the sql query when Force Single is engaged.
I'm going to see if I can't figure out a solution to this.. will post a patch.
Comment | File | Size | Author |
---|---|---|---|
#4 | snapshot1.png | 177.43 KB | anithagutta_a |
#1 | 749722_location_country_exposed_filter.patch | 822 bytes | reubenavery |
Comments
Comment #1
reubenavery CreditAttribution: reubenavery commentedHere's my patch.. seems to work, hope I'm not missing something!
Comment #2
YesCT CreditAttribution: YesCT commentedI missed this earlier. Adding tags.
might not be related, but might be: #730730: Default country location should not be 'us' but blank
Comment #3
rooby CreditAttribution: rooby commentedThis problem has been fixed in this issue #467412: Cannot Select Particular Countries for Views Location Filter
If you get the latest dev the problem should be gone.
Marking this issue as a duplicate.
Comment #4
anithagutta_a CreditAttribution: anithagutta_a commentedProfile Location Countries list optins is Not Showing up in Exposed Views filteres. help me