I am having real trouble with this and would appreciate any help.

I have a view block that needs to display all variations of a product that have the same sku with an increment at the end.


Product name is: 4 jembi avenue

This produces a url of /4jembiavenue

All product variation skus are based on this, so every product variation will now have sku

4jembiavenue0 4jembiavenue1 4jembiavenue2

so on so forth.

What I need is views to display ALL product variations in the view.

I can achieve this by using a filter and setting it to Contains: 4jembiavenue. However as I am intending to have many products displayed like this I do not want to do it like this as each new product would have to have a new block and a new view.

I can use a contextual filter to get the value (4jembiavenue) from the URL and it works fine, but of course it only displays 1 product variation where I am going to need up to 60.

So my question is this:

How can I use a contextual filter with a "contains" operator to find and display all of the product variations?

If you know of any other way I can achieve this I would gladly try this too.

Thanks in advance for any help!

1 Answer 1


You could try like. First include sku in your view and exclude it from display. Then write this code it would give u desired results.

function modulename_views_query_alter(&$view, &$query)

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.