1

I am building a website for multiple summer resorts. I am now concentrating on the restaurants section.

I have a content type - Restaurant.

It has multiple fields but I will just put down the ones that are connected to this question;

field_resort: Term Ref.
field_restaurant_category: Term Ref.

And then the url pattern;

[node:field-resort]/restaurant-guide/[node:title]

I need a block in the restaurant parent page [node:field-resort]/restaurants that then displays a grid with each individual taxonomy term [field_restaurant_category].

What the problem is is that I want to have a page that once you click on one of those categories, takes you to a page that displays teaser views of all the restaurants for that specific food categorie from only that resort while appending the url to keep the resort as the parent.

resort-1/restaurant-guide/[field_restaurant_category]
resort-2/restaurant-guide/[field_restaurant_category]
resort-3/restaurant-guide/[field_restaurant_category]
1
  • 1
    Welcome to Drupal Answers! So far, you stated facts, but you didn't ask any explicit question.
    – avpaderno
    Commented Jan 3, 2016 at 8:05

2 Answers 2

0

In Views the pattern for the path cannot have a contextual filter as the first part of the path.

Contextual filters and paths

The normal way a view gets values for contextual filters is by the view path. The easiest way of doing this is to append filter values to the path, separated by slashes. It is also possible to have contextual filter values within a path. This is done by using a percent sign where the view expects a contextual filter value in the path of the view (for example user/%/comments).

So your pattern needs to change to something like this:

resorts/%/restaurant-guide/%

as in resorts/[resort]/restaurant-guide/[restaurant-category]

Then two contextual filters:

**content resort (field resort)**
Taxonomy term ID from URL
Validator: Taxonomy Term
Vocabulary: resort
Filter value type: Term name converted to Term ID


**content restaurant category (field restaurant category)**
Same as above but with Vocabulary: restaurant category

Then keep in mind that you might need to deal with spaces in your taxonomy terms

1
  • @ArronMurray, please mark the answer as correct if it worked
    – argiepiano
    Commented Jan 3, 2016 at 16:02
0

I was a bit of a novice when it came to contextual filters.

Taxonomy term ID from URL Validator: Taxonomy Term Vocabulary: resort Filter value type: Term name converted to Term ID

content restaurant category (field restaurant category) Same as above but with Vocabulary: restaurant category

This worked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.