0

I know variations of this have been asked left and right but I can't get this to work.

I have a Commerce Kickstart Product Display (shopping cart form, basically a node).

Inside this content type is a display field which uses ViewField to insert a View inside the form. This View is a list of related products (nodes in the same category). I pass the category of the current node as a token %1 to the View and it works great.

However, I'd like to further exclude the current node (ie. the product being displayed) from this Related Products view.

I tried adding a second Contextual Filter:

Indexed Content: Node ID Provide Default Argument: Content ID From URL

and then checking the 'Exclude' box in the More section.

And this does nothing. The current node still displays in the Related Products View.

NOTES: 1. FWIW: This View is of Type: 'Product Display' (from Commerce) as opposed to 'Content' or 'Message')

  1. There is no default argument for 'Node ID'. Only 'Indexed Content: Node ID'. Probably because of the type of View (I cloned an existing view in Commerce Kickstart as a template.)

Any ideas?

1 Answer 1

0

Why don't you rather just pass the product display node id as a second parameter in your view field (you are allowed to use a comma separated list of arguments), and then don't bother with providing a default argument at all. The second argument to pass is [node:nid]

3
  • Then what do I use for the Contextual Filter?
    – jchwebdev
    Sep 12, 2014 at 6:35
  • Oh and how do I get it to be NOT NID=='current node'. (sigh) I wish these filters could just use SQL Queries.
    – jchwebdev
    Sep 12, 2014 at 7:22
  • You still add a second contextual filter, you just don't give it a default value because you are always passing it in. And in the contextual filter configuration settings right at the bottom is a dropwdown 'more' that will reveal the 'exclude' setting. Sep 12, 2014 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.