0

Is it possible to return two values when user chooses a value from a defined list? The values I wish to return are the value that a user chose AND a default value if it exists.

I have a taxonomy list of values (example: 10%, 20%, 25%, 100%, Any%). This list is exposed to the user as a dropdown filter on form.

I have a content type with an entity reference field referring to these values. Some or all of these values may be referenced in this field.

If the user chooses, for example 10% then the returned results should show products that have 10% set but I also want it to return Any%, if that is referenced in the product. So Any% should be shown alongside the product always, if it is referenced on that product.

Is this possible within views UI or do I need a query alter?

Default view before a choice is made

Product 1 Percent Available
10%
20%
30%
45%
Any%

Example 1: User has chosen 10% from exposed filter:

Product 1 Percent Available
10%
Any%

Example 2: User has chosen Any% from exposed filter:

Product 1 Percent Available
Any%

1 Answer 1

0

You can do this by splitting it up into two filters:

The exposed one, as you described it above. Then add 2nd, non-exposed filter on the same field, and the field value must be Any%. Then, in the views UI, create a filter group, move both filters in there, and set the group condition to OR.

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.