I'm trying to create a list that will take the current node's zip code and display other locations nearby. For example, a hotel node will show a list of nearby restaurants and theaters in the sidebar.

I tried using the "Location: City" field but it has no options and so I used the "Location: Distance / Proximity" but views tells me "This display does not have a source for contextual filters, so no contextual filter value will be available unless you select 'Provide default'."

Are contextual filters going to be added to Location 7.x-4?

Comments

rooby’s picture

Status: Active » Postponed (maintainer needs more info)

There is an issue for drupal 6 for a nearby locations view - #356562: block view with proximity nodes
There is also a page on the location handbook at http://drupal.org/node/1038082

The solution is the same for drupal 7, however the views exports won't work.
If you still can't get it to work in d6 based on that information I will see if I can do a drupal 7 export of the same sort of thing.

In regards to the contextual filters, they are available on location 7.x-3.x-dev and are working from my tests.

Are you using the latest version of 7.x-3.x-dev?
If not can you update the the latest and try again?

If it still doesn't work can you give screenshots of the malfunctioning contextual filters and an export of the view.

rocbrook’s picture

StatusFileSize
new10 KB

Thanks for the response Rooby. I've now updated to "location-7.x-4.x-dev" with D7.7, followed all directions in the handbook but I'm still unable to get the correct data. One thing I noticed is that the contextual filter for Location/Proximity does not allow me to specify a distance amount, it only allows me to specify "Distance Unit" via a dropdown.

I have no screenshot as there are no errors. Attached is my view.

Thank you in advance

rooby’s picture

Status: Postponed (maintainer needs more info) » Active

I've now updated to "location-7.x-4.x-dev" with D7.7

You will want to use 7.x-3.x-dev, at least for now.
7.x-4.x-dev is still well under construction.

See if you still have problems with 7.x-3.x.

rocbrook’s picture

StatusFileSize
new11.72 KB

OK, now using v .3 from Aug-26 - I updated db and cleared all caches, tweaked the heck out of the view and still no luck. Attached is my view export.

I have a "hunch" the problem is in the Contextual filters, it's as if when the node loads, the lid/zip is not being passed.

Also, I noticed is that there is no way to specify proximity distance, so does Location load nodes that are a mi/km away, 2 mi/km away?

I really appreciate your help!

rocbrook’s picture

Made advances. So one of my problems was I took the "optional" part of the installation txt too seriously when it came to zip codes. So, needless to say, if you're having proximity issues, don't be a dumbass like myself and INSTALL THE ZIPCODES. I have them in the db now and that has helped tremendously, I can now create a block in views that has an exposed filter that allows narrowing them down by entering the appropriate zip code... however, I have not been able to make that block take the current nodes zip info and automatically provide results of other nodes with nearby zips in the block, which is what I want. I don't think the Proximity contextual filter is working...

Any ideas? I've tried adding the "Content: Nid" argument to the Contextual Filters and then using it for the filter "Location: Distance / Proximity" with the option "Nodes latitude / longitude from nodes nid argument" to no avail. It almost seems the "Content: Nid" is not passing the appropriate data!

Why is the Locations module part of the Node and not separate field that can be added when managing fields for Content Type? It's really confusing because most everything else in D7 is a field.

rocbrook’s picture

Solved: Use "Global:Null" instead of "Content: Nid" as an argument.

colinafoley’s picture

I haven't been able to get the Proximity contextual filter working. I want to be able to pass the zipcode in the URL in order to filter the results by proximity. Do I need to use Node Locations instead of the Location field?

It doesn't make sense to me to use Content:Nid since I don't want to filter by a specific node location, just a zipcode. I feel like what I'm missing is a "Relationship", but Location isn't available as a "Relationship" like it was in Drupal 6.

I'm not sure I follow the Global:Null business either, since I only want to contextually filter by zipcode and filter by Content:Type otherwise.

leewoodman’s picture

Solved: Use "Global:Null" instead of "Content: Nid" as an argument.

thanks for that...sorted my issue!

swfindlay’s picture

#7 - Did you ever solve this?

I have exactly the same problem - trying to pass info from the URL (lat/lng) to generate the proximity view. I'm not sure how to configure the Contextual Filter / Filter Criteria options to achieve this.

Any help greatly appreciated!

zhuber’s picture

Here is how I solved this issue.

My specific use-case:
Listing page that load a list of "hotels" near a given node, sorted by proximity.

Solution:
Add contextual filter for "Content: Nid"
Underneath "More" select "Exclude"
Add a sort for "Location: Proximity"
Select "Node's Latitude" as the "Origin" value
Select your node argument and save