2

I've tried all settings, with joint paths etc...but I just can't get the filter working properly, I know it's a settings thing, watched a whole bunch of videos but can't put my finger on it!

This is for advanced contextual filter, the dynamic one that can change depending on URL, not the static one.

Like this:

Animals
-Pets
-Farm

Path is:

localhost/animals/pets/cats.htm
localhost/animals/farm/cows.htm

I would like the filter animals/pets to show cats.htm content

I would like the filter animals/farm to show cow.htm content

I can get the filter working with single taxonomies, but not with full path.

animals works, but not animals/farm and not animals/pets

Attaching an image with the screen where I should set this up

enter image description here

  • Filter is dynamic, not the static one on left. It acts like a variable or a token, one in advanced settings. The .htm path is just for example sake – Bruno Vincent Sep 10 '17 at 16:13
  • A sceenshot of your complete view configuration would be helpful as well. Also, Drupal (and especially views) do not work with HTML pages, so how do you want to show cats.htm content? – Neograph734 Sep 15 '17 at 20:59
  • HTML is just for the example, not using .html suffix, that was just to distinguish the element as destination item, and not category name. Near giving up on this, I don't think it's even possible! – Bruno Vincent Sep 15 '17 at 23:25
  • You may implement HOOK_views_pre_view or HOOK_views_query_alter using your custom module to override the contextual filter with a custom value as you like. You can use something like arg(0) to read the URL. – Saud Alfadhli Sep 16 '17 at 0:11
4
+25

You must use 2 contextual filters

enter image description here

First one is: Contextual filter: Content: Has taxonomy term ID depth modifier

enter image description here

Second one is: Contextual filter: Content: Has taxonomy term ID depth modifier with the same criteria you did.

enter image description here

I put the view path to be the vocabulary name and tested contextual filters like:

//Hierarichay
      tag1
        tag2
        tag2

//Urls
    tag1/tag2
    tag1/tag3

The views gets results for the child tags every time {2, 3}. If you didn't use the first filter it will consider the parent as argument.

Hope it solve your problem.

| improve this answer | |
  • Thanks but now working still, what do I put for these settings? Depth Allow multiple values Set the breadcrumb for the term parents Display all results for the specified field Provide default value Show "Page not found" Display a summary Display contents of "No results found" Display "Access Denied" Skip default argument for view URL – Bruno Vincent Sep 17 '17 at 12:14
  • Display all results – Mohammed Gomma Sep 17 '17 at 16:15
  • Thanks Mohammed, but not working...tried almost every possible settings and combinations, days trying now;( – Bruno Vincent Sep 18 '17 at 1:04
  • It depends on you site configurations, taxonomy terms hierarchy and content relations, more information it may help. – Mohammed Gomma Sep 18 '17 at 5:52
  • Site for testing is over here: xuzo.com/a1test I sent you an email mohammed, whoever can figure this out will be my hero! – Bruno Vincent Sep 21 '17 at 9:08

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.