0

Let's assume I have a product named A, B, C and each of those products have variations.

Now, when I am making a block in views, when I only have the option to select product variations as seen in this image:

enter image description here

After this, there seems to be no way to select a product variation of say product A.

All the variations are there by default.

1

You need to add a context to tell the view which product you want to show. Either from the URL with product id in url, or static product id number, or some other way.

The context filter for views relies on a url or some other way to set a value. In this case you want to select one of your products that has variations. So, if your url is /myproducts/1, the context filter can be set to use 1 for the product id and show only that product along with only its variations.

How to pass Views contextual filter via URL? https://i.stack.imgur.com/8cLtw.png

Use Provide default value from URL, then choose which part of the path will have the product id in it. Then when you link to this view, use the url that way.

On your index page view, you can make the links to products this way so it passes the product id to your page.

  • Can you elaborate a little more. Since this question was asked, I have realized the answer lies in the 'contextual fields' from the advanced table in views, but when I select a content 'parent product' it does nothing – hidar Jul 23 '17 at 12:34
  • yes, you don't have a parent product, you need to use your view url to set the product. I'll add more to answer – troseman Jul 24 '17 at 1:31
  • The parent product has an id of 19, but the dropdown has only upto 10. To explain more. I have product A, B, C and product A has 3 variations. So, to build a view with only those tree variations in it, I don't know what to select, in the contextual fields. The parent product only allows me to chose a path component with id from 1-10. while product A has id = 19 – hidar Jul 24 '17 at 12:34
  • where are you seeing 'parent product'? I don't know where that is. you just have 3 products right? – troseman Jul 24 '17 at 16:02
  • oh I see in your screen cap above you're showing variations in your view, not products. if you instead show Products, and use the context filter to choose the product and let the product show it's variations normally that's the standard way. – troseman Jul 24 '17 at 19:15

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.