1

I am trying to display related nodes block using a single view for all the taxonomy terms. So that if user click on any node title he/she will see the related nodes based on the node's taxonomy term.

I tried adding contextual filter with taxonomy term by selecting all the vocabularies, but doing this will display nodes from other terms as well.

The reason I am trying to use single view is, I have tabs (Quick tabs) structure on a node page, with related nodes as a Tab. So I cannot create different views for nodes based on terms, and cannot specify different views in quick tabs settings.

3
  • I tried by adding a contextual filter 'Content: Has taxonomy term ID (with depth)' and specifying the depth, still it does give nodes from other vocabularies
    – AnAnD
    Commented May 23, 2013 at 9:54
  • This is for sure doable. I have seen it in a recent tutorial video on views. If I find it I'll post it, if it can be of help. Commented May 23, 2013 at 10:13
  • 1
    Yes of-course, at this sunny day any shade is useful :)
    – AnAnD
    Commented May 23, 2013 at 10:26

2 Answers 2

0

A slightly different approach which might mean taking out your beloved QuickTabs and replacing it with another 'tab' solution.

WHAT YOU NEED

optional but recommended

HOW TO

  1. Install the required modules together with any dependencies.
  2. Create your content(I think you have that covered) adding a term reference field to each. Ensure you create the accompanying vocabularies for the particular references.
  3. Create a view(Again I think you have this covered). Add an EVA display. Just click on the add display link and add "EVA Field".
  4. Make some configurations to the display under "Entity Content Settings". The configuration you probably need is Entity Type: Node, Bundles: Your_Content_Type EVA will complain if you do not provide the preceding configuration.
  5. Add the contextual filter has_taxonomy_term. Under the settings set When the Filter is not available,select provide default value and the option that you need is Taxonomy Term ID from URL.
  6. Once that is done head over to your content type's display settings. If you have Display Suite installed there are more options in this section. Even without it we can still build something. The first thing you need to do is to create a fieldgroup.
  7. The group that you are creating should be a horizontal tab/vertical tab. Depends on what you want.
  8. Create another group which should be a horizontal tab item/vertical tab item depending on your earlier option. Example create two tabs. One for the node and the other for the related nodes.
  9. Drag the 'main' node's fields i.e. title,body e.t.c to the horizontal tab item for the node.
  10. Drag your EVA Field that you had created earlier (It should be there) under the horizontal tab group item which you meant to represent the related nodes.

That should be the ten steps to glory :-) Just style it then you should have some pretty working tabs in your hands.

If you noticed it is also possible to add other tabs to display a specific field of the content type.

Very long but hope it helps.

3
  • Thanks a lot @Dmitri Kowalski, I will give it a try on dev site, though I have already moved to production. will update my comments once fully tested :)
    – AnAnD
    Commented Jul 15, 2013 at 7:09
  • You most welcome. Commented Jul 15, 2013 at 8:33
  • I got it working... with Quick Tabs and views
    – AnAnD
    Commented Jul 16, 2013 at 12:19
1

You need to create a block view with all content. Then filter content for your specific term by adding a filter-> content type.

Then add a Content: Has taxonomy term ID. On the config of the later. When the form value is not provided in the URL choose provide default value -> Taxonomy term ID from URL.

Enable load default filter from page and load default filter from node. On the latter enable your vocabulary.

Afterward, config the case that the ID is present on the URL. Specify validation criteria by choosing taxonomy term and again chose your vocabulary.

It should work! Check the whole tutorial on http://www.drupalgardens.com/videos/410746

6
  • Thanks a lot, I have tried the same. My problem comes when I select multiple vocabularies to filter the nodes. Because of this I get nodes from other vocabularies also.
    – AnAnD
    Commented May 23, 2013 at 10:48
  • and also since I am using the block on quicktabs the views contestual filter validation is failing
    – AnAnD
    Commented May 23, 2013 at 11:04
  • I misinterpreted your issue then, can't really help. Commented May 23, 2013 at 11:08
  • I have 6 vocabularies, so I can create 6 different views. Once if I have 6 views, how will I display them on a single quick tab?
    – AnAnD
    Commented May 23, 2013 at 11:25
  • Is quicktab some sort of panel? Or some sort of view's container? I've never used quicktabs. Commented May 23, 2013 at 11:28

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.