I am working on a travel website, and I made taxonomy with depth continent/country/city. I also have taxonomy locations restaurants, museums, nightlife... I have content types destinations and locations. I made a view from location content (all restaurants)

I would like to have locations filtered from destination taxonomy term in URL (e.g. destination/europe/france/paris to sort only restaurants from Paris, but destination/europe/france to list all restaurants from France).

Can anybody help?

  • have a look at my answer here might be helpful I think. – Jack-PL Aug 14 '13 at 20:55

The best way to do this is as follows:

Assuming you have fields in your content type for continent, country, and city: Add each of these fields separately in your view's Contextual Filters. You can leave them at the default settings for now.

Then, change your path settings for the page to one like such: destinations/% (the % will be replaced with your contextual filters).

After saving the view, you should then be able to visit a path such as destination/europe/france/paris OR destination/europe/france, granted you have content within those areas.

  • After re-reading your question, I totally missed that your are using taxonomy for the continent/country/city. Not exactly sure if the approach I listed above will work with taxonomy, but you can give it a shot. Sorry about that. – EJK Aug 14 '13 at 15:47
  • No, unfortunately it doesn't work this way. I want to achieve that when I set manual URL destinations/europe/france/paris for content about Paris, all the restaurants from Paris appear in block view. That block should appear only when the part of URL, in this case "paris", is matched with term "paris" in restaurant content taxonomy term. – user20054 Aug 14 '13 at 16:17
  • I tried to make view block listing all locations content and than to add filter with taxonomy term witch would some how find term in row url separated with slashes. But, i suppose that Drupal use internal path and for some reason it cannot recognize my term or I'm making mistake somehow. – user20054 Aug 14 '13 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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