I am still unclear on how to set up the relationship between child and parent. I have a Taxonomy with a single level of parent/child relationship. According to the instructions on the project page, I am also supposed to "...link from a nodereference field to the nid on the same node type. That is, the nodereference field is used as a pointer to the "parent" node."

I am using this Taxonomy with Profile2 which are not nodes but entities. I am lost and any nudge in the right direction would be GREAT!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

geerlingguy’s picture

Check out the new documentation page and see if that helps a little bit. I might make a tutorial or something for working specifically with Taxonomy views, but I haven't yet done anything with Taxonomy term references.

adam_b’s picture

I'm also having problems here - I'm just trying to create a hierarchical list of terms in vocabularies for people who shouldn't have access to /admin/structure/taxonomy/.

Whenever I try and use this plug-in I get an error message warning that the main field is invalid.
Should I be able to do this, or am I barking up the wrong tree?

geerlingguy’s picture

or am I barking up the wrong tree?

I see what you did there!

This module should work for your use case, it just hasn't been too well tested, and there may very well be a bug preventing it from working properly with taxonomy terms correctly. I'll try to test this out on my own at some point, but time is really limited for me until mid-May.

adam_b’s picture

The pun was purely by accident, I assure you ;)

When you do get around to it, I'm just working with a simple two-level hierarchy - no multiple parents or anything like that.

geerlingguy’s picture

Marked #1556194: Error when listing vocabularies and taxonomy terms hierarchically as a duplicate, as this issue's older. Still don't have time right now to work on it, sadly :( Hopefully soon!

tekket’s picture

Simple Taxonomy Howto:

Here is a simple tutorial how to set Views Tree to display hierarchical taxonomy.

Create a new term view using the fields row style

  1. add relationship for taxonomy term: parent term
  2. add field term id (do not use relationship) and exclude it from display
  3. add field term id with relationship, exclude from display
  4. add any fields you want to display, like term name, term description, etc...
  5. Change style plugin to Tree (Adjacency model)
  6. Set Main field to Term ID
  7. Set Parent field to Term ID with parent relationship
geerlingguy’s picture

Status: Active » Fixed

Awesome work, tekket! Thanks for your help—I've added your information to the Views Tree documentation page: http://drupal.org/node/1493366

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

hixster’s picture

HI , thanks for the module and this guide - how is the view meant to be triggered? When viewing a node with a term attached to it or a term? Please can you explain, thanks

hixster’s picture

Status: Closed (fixed) » Active

sorry, moving to active. Can you put the instruction above in context. Are we to create a path based taxonomy term page or block. How does the view get's it argument (context).
Many thanks

hixster’s picture

Status: Active » Closed (fixed)

Ignore me, rebuilt views from scratch and now this is working.

quadcomm’s picture

I'm a long-time PHP programmer but somewhat new to Drupal. It took me a while to figure out the instructions in #6. I'll expand on it in case it helps other newbies:

The ONLY module you need is this one, Views Tree. You do not need to download a Relations module (as far as I know, I'm running a pretty vanilla Drupal at the moment).

1. Add a new View. Set Show:Taxonomy Terms. Leave everything else default, especially Display:Unformatted List.
2. Add a Relationship (To find this you may need to expand the "Advanced" part in your Views configuration screen) and select Taxonomy term: Parent term. Here's a picture: http://i.imgur.com/wg771gA.png
3. Add a Field Taxonomy term: Term ID: http://i.imgur.com/kvxVuv7.png
4. Add another Field, Taxonomy term: Term ID AND add set the Relationship to Parent: http://i.imgur.com/NuodZTY.png
5. Change the Style to Tree (Adjacency model). Set Main field to the first Term ID, set the Parent field to the second Term ID (with relationship): http://i.imgur.com/KDBvwAa.png

This is what the basic Views configuration should look like when you're done:
http://i.imgur.com/HYqPunc.png

kyletaylored’s picture

Could you post a screenshot of what the output looks like? I feel like I'm not getting the right results.

loopy1492’s picture

Well, I got to step 1. :(

When I go to add Taxonomy term: Parent term, it's not in the list of fields.

And when I go to add Taxonomy term: Term ID, it won't let me add it without the association. And when I try to add it, I get this error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'parent' in 'on clause'

OnkelTem’s picture

Category: support » bug
Status: Closed (fixed) » Active
FileSize
47.08 KB
71 KB

Tried to create views tree with taxonomy terms. But it simply doesn't work, printing ordinary list.
See the screenshots.

OnkelTem’s picture

Priority: Normal » Major
trrroy’s picture

For me, the Views Preview does not show the tree layout but my page display does output as a tree. Here's what my page output shows and here's what my preview shows.

nessunluogo’s picture

I belief I have the same issue of Onkel, but I find there was simply a CSS bug where UL had no left padding to explicit the indentation.
The same thing was in the preview: HTML il ok, it just lacks of intentation becouse of CSS:

.views-admin ul.secondary, .views-admin .item-list ul {
    margin: 0;
    padding: 0;
}

I simply modified it on firebug like this:

.views-admin ul.secondary, .views-admin .item-list ul {
    margin: 0;
    padding: 0 0 5px 10px;
}

... and it looked like it should.

Onkel, trrroy, can you check this?

ikeigenwijs’s picture

Issue summary: View changes

bug Still valid!
the views preview does not show he hierarchical indented dispaly.
The page does everything correct.

babusaheb.vikas’s picture

Take a look on Show subterms under parent Terms using views, which shows an instruction to achieve the structure of tree with taxonomy terms.

sajidmanzoor’s picture

Version: 7.x-2.x-dev » 8.x-2.x-dev
Category: Bug report » Support request

Hello
I am using View tree plugin for Drupal 8 and i have issues with it.
I have a custom taxonomy like following:

Level 0
- Level 1
- - Level 2

Level 0.1
- Level 1.1
- - Level 2.1

I have followed this https://www.drupal.org/project/views_tree/issues/1424414#comment-6434062 and it is rendering item like this

Level 1
- Level 2
Level 1.1
- Level 2.1

It is not printing elements of first level (Level 0 and Level 0.1)

Plz, tell me where I am doing wrong.

Thank You