Any help would be very much appreciated please.

I have a content type named restaurant and I have three taxonomy term fields (cuisines, neighborhoods and occasions) in it. I've created a view to expose these 3 fields as checkboxes for users to search restaurants accordingly.

Cuisines and Neighborhoods are required fields in the node, but not occasions. The problem is that if there is a restaurant that has not been tagged with an occasion, that restaurant will not show in the search results because in my filter criteria, I've selected "is one of" > all the terms in occasions.

I need help to turn this occasion filter as an optional one, where a node that has not been tagged with an occasion will appear when the user select a cuisine or neighborhood where this node is listed in.

I believe that this can be done via hook_views_query_alter but I don't know how.


In your view I would not select any of the occasion field items and allow all the items with or without this field to populate. If the user wants to drill down into restaurants with this information you can have them use the select menu or whatever mechanism to choose the specific occasion. I think that starting off with no filter on the occasion field might be the way to go.

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.