0

I have a "Collection" content type, and a "Product" content type.

Each "Product" node has a node reference to a "Collection" node, and a "Collection" node can have several "Product" nodes referring it, while a "Product" node can only belong to one "Collection" node.

I created a view to list all collection as photo thumbs with link to collection node. I display this list as a footer in collection nodes and products nodes.

What I want to do as "special" is to highlight current collection in the collections footer when I display a product node which belongs to this collection. Same thing when I display the collection itself.

Is it possible to do this using views and as possible without Javascript?

1

First check the thumbnail is passing your condition then simply just add a unique class to that field using the tpl file for that field.

| improve this answer | |
  • Thank you for your reply. But I don't understand where to put the condition? and which tpl file you're talking about? views-view-field--field-product-collection-nid-1.tpl.php? – Rad_One Jan 30 '12 at 10:11
  • every field in view can have their own tpl file.so go to the theme information in view and check the name and code for your thumbnail field.Now add some field which will help you in making the condition. Exclude all that field from display. Now you can get that field in the tpl file and create the condition. – j2r Jan 30 '12 at 10:23
  • OK, I got that. – Rad_One Jan 30 '12 at 10:55
  • I have to list collections nodes so I created a view with filter on content type == 'collection'. how to get products which belong to a collection? I've tried with Reverse Node Reference without success. – Rad_One Jan 30 '12 at 11:28
  • have you tried with creating relationship first? – j2r Jan 30 '12 at 12:38

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.