3

I am trying to filter views output using Parameters from url with views contextual filter. There are two fields on the content type :

  • 1.field_sku
  • 2.field_width

I simply added the contextual filter for the first one , but as i add the second filter it doesn't work. Is it posibble to add multiple contextual filter to a view?

1
  • Of-course you can add multiple contextual filters. Could you please add more information about how you're using it. Jun 25, 2013 at 16:27

2 Answers 2

1

It is because how you get them,contextual filter usually get from url and when you have 2 , you should have 2 parameter in url , as example it should something like "mysite.com/3/reza", this is one step, another step is that you specified in your contextual filter that which arg is for this filter(put your default value in raw value form url,then you see path componet), (in my sample 3 is arg(0) and reza is arg(1) ) and if you observe this note it work for you correctly.

1
  • What if I have to get all media entities that uses a specific fid (e.g 10) and it could be either image or document media entities and both type has different fields as field_image and field_document? I have the URL like "media/find-by-file-id/%" then how can get all entities using multiple contextual filters like "field_image:target_id" and "field_document:target_id"? Jan 2, 2022 at 18:40
1

The question isn't well described, but i think this is your solution:

Querying the configured multiple contextual filter isn't working as i expected first and I spent lot of time to figure out why, then finally the solution was found:

Instead of Content: The name of Taxonomy (taxonomy_vocabulary_#) you need to select Content: Has taxonomy term ID Contextual filter and enable Allow multiple values to able to use multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND). If You have another Contextual filter configured, you can separate the query with "/".

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.