1

I have a view that displays results of nodes. In these nodes, I have a block field via Display Suite (a table view from Commerce Add To Cart Extras). The block View renders fine in a full node display, since I can easily pass the contextual filter, but I need this block field to also render in the node when it's a teaser as a result of a View.

I tried looking at the Views default from context module, but I can't seem to get it. How can I get my views in my teaser to just know what the context is within its particular node?

I hope this makes sense.

  • When I look in devel, for each node, I see the correct product ids in my product ref field. So, it looks like the context is getting passed. So I guess it is a rendering issue. – vintorg Nov 8 '13 at 1:42
3

The way to do it:

  • Enable Views content pane (views_content, part of ctools I think)
  • Create a Views display using content pane instead of block display type.
  • Configure a contextual filter, but don't give it a default value.
  • Configure the content pane "argument settings" to take a node id from url.
  • In Display Suite, create a "Dynamic field". Move it into one of the layout regions.
  • Click the cog-wheel icon in the dynamic field, choose content to display, you find your newly created Views display under "Views panes".

Good luck!

  • I didn't see an option for argument settings, or where to take a node id from URL. – vintorg Nov 8 '13 at 2:53
  • There are some settings at the top of the second column of the Views UI. One of that should be "Argument mode" i think – donquixote Nov 8 '13 at 3:07
  • @vintorg: You can improve the answer if you want. – donquixote Nov 8 '13 at 11:02
  • Not sure I can - it worked just as you said it would. – vintorg Nov 9 '13 at 5:49
1

Just want to add that if even after enabling Views Content Panes + creating the Content Pane display in Views, well the Views Panes section still does not appear in the Display Suite's Dynamic Field's settings, this might be because your content pane's "Argument input" setting is not properly configured.

In my case I had selected "From context" -> "URL" when I actually needed to select "From context" -> "Term ID".

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.