Topic for Tues: Issue with Views, Location, node_reference, and filtering on terms for a related node

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
lisarex's picture

Overview

I'm rebuilding the site in Drupal, with the very awesome assistance of himerus (Jake Strawn). There's a very complicated View to build and we could really use some input on how to make this happen. We will be there on Tuesday night for the Boston meet up. I've also cross-posted this to my blog as well, so there may be other comments there: http://www.lisarex.com/2009/10/views-related-node/

There are two content types, Restaurant and Soup (a restaurant can have more than one soup).

Client requirement:
1. The site visitor will click their state/province.
2. On the state page should see a cloud tag of soup ingredients, filtered to show soups belonging to restaurants in that state.
3. Next, they'll click their city,
4. On the city page, they should see a cloud tag of soup ingredients filtered to show soups belonging to restaurants in that city.

It works like this in their existing site: http://whatsthesoup.net/

Location module and Gmap are working together to display a Google map of the restaurants on home page, state views & city views. See below for explanation of the current setup with maps.

The Problem

The problem comes from the client requirement (described above) to also be able to filter down the nodes by ingredients. The ingredients are taxonomy terms on the Menu Item (Soup) content type.

Setting up the relationship in Views, and accepting a 3rd argument does work as expected, so if you were at views-page/MA/Boston/chicken would correctly display the appropriate nodes in the Boston area that had a related Soup node with the taxonomy term chicken assigned to it.

The main issue here is providing the appropriate means of truly filtering or “searching within these results”.

The paths used by the view are working as follows:

restaurants/STATE_ABBV
restaurants/STATE_ABBV/CITY_NAME
restaurants/STATE_ABBV/CITY_NAME/INGREDIENT

However, the following paths should also work, or have an alternative to properly filter out the nodes without breaking the arguments that are expected by the main view. The proper implementation would have a block with taxonomy terms that are available on the related nodes for the nodes displayed in the main map view.

restaurants/STATE_ABBV/INGREDIENT
restaurants/INGREDIENT

However, with the current argument setup, this doesn't seem even remotely possibly without a lot of custom PHP in the argument properties, and some overly complex use of views_prerender hooks to manipulate the structure in a way where it knows if it is receiving a term name or term id rather than an argument of city & state.

An exposed views filter will not work in this case for two reasons.
1. It's an ugly form
2. selecting “Matches Any of these” requires selecting all the node terms, and this is a freetagging vocabulary that needs to coast on autopilot, new terms would not be selected in the filter item of the view.

Avoiding custom code

It seems this functionality “should” be possible through views, with “minimal” custom code. If custom code was required (not provided by some 3rd party module) it would be because of the need to have the terms actually not be for the primary Restaurant node, but the related nodes of the Soup type.

Ideas? Thoughts? I hope someone has some genius to share on this!!


Current Setup with Maps

The Restaurant is the primary content with nodes created with node_reference CCK field for the “child” items of that restaurant. [Is the child item the soups?]

Primary View: Uses the GMAP style to display nodes filtered by node type (Restaurant) and that a location is available. Two arguments are accepted to filter the view. (State/City)
Attachment: Accepts same two arguments of State/City, and displays summary lists when an argument is not present to give links to click through to the next level, So the summary list contains first a list of States with available nodes, then after choosing a state, the map shows nodes in that state, and this attachment shows now the city names with available nodes as shown on the map. Clicking on a city takes you to the map further filtered down, and the summary list is replaced with a list of Restaurant nodes in that specific area corresponding to the nodes/markers on the map.

This portion is all working just fine, and as expected with the union of Views, CCK, Location & Gmap

Comments

My issue as well....

himerus's picture

I've been working with Lisa on this project, and this issue has been a stumper.

I'm feeling like the true solution requires custom code, which I didn't want to have to do in this situation. The recent post robert douglass made on Views3/Solr made it look exactly like what would solve this issue.

We are looking for some recommendations on how it's possible using Views & Contrib code for the most part.
I've only recently becoming decent with Views arguments in a lot of situations, this was my first attempt with Views relationships, and some of it still puzzles me. I just felt like in some way, it should be possible without writing code. (unless a tiny bit in the argument validation code, etc.)

any luck?

kobnim's picture

I'm having a similar problem. Were you able to find a solution?

Boston

Group categories

More Specifically

Group events

Add to calendar

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week