0

I have a content type product.I want to create a page view of the products. The view should show only those products whose field featured (checkbox) is checked.

How do I use Contextual Filters for this ?

If the field was a taxonomy-term ,I would go to Provide default value -> Taxonomy Term ID from URL.

But, since the field is a checkbox I am not able to achieve this.

Thank you .

2 Answers 2

1

If you want this filter you should add the field as a "standard filter" and not contextual filter. In Views UI look for the headline Filter criteria, add your field "featured" and choose what value that has to be set.

Here is a screenshot how the UI looks, it is under filter criteria where you should push add.

Views UI

3
  • Thank you for the response. I could not get through the standard filter thing. Could you please tell me how to get it. Commented Jul 29, 2012 at 19:32
  • I have updated my answer. Commented Aug 26, 2012 at 15:02
  • Thank you Pontus Nilsson. Actually I just forgot to see that and directly went to Contextual Filter which took much of my time. But after sometime I realised that it could be done through Filter Criteria. Commented Aug 26, 2012 at 15:25
0

I went through to the same issue. The problem, is that when you add a "checkbox" field in your content type, by default, the values of your checkbox are empty.

In order to be able to use the featured field (checkbox) as a filter in your view, you have first to define the 2 possible values of your checkbox when editing your feature field of the content type. You can put any pair of values you want, yes/no, 1/0, true/false, pretty/ugly...etc

Find attached below 2 images as examples.

enter image description here

enter image description here

Hope it will help.

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.