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

Overview

I'm rebuilding a site in Drupal, with the very awesome assistance of himerus aka Jake Strawn. There's a very complicated View to build and we could really use some input on how to make this happen, and whether it's possible using just Views & Contrib code (for the most part). We will be at the October 6th Drupal Boston meet up as well.

I've also cross-posted this to the Boston Drupal group as well, so there may be other comments there: http://groups.drupal.org/node/28172

So, 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!! Feel free to contact me if you need more info, or leave comments. Much appreciated!

--------

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.

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

Have you tried using

Have you tried using http://api.drupal.org/api/function/custom_url_r... ... could maybe be used to convert restaurants/INGREDIENT into something like restaurants/all/all/INGREDIENT