6

i have a vocabulary that contain plus of 5 level descendant, i need to create the view to display the first 2 levels and grouping by the first one, i do this:

  1. FIELDS: (Parent) Taxonomy term: Name - Taxonomy term: Name
  2. FILTER CRITERIA: Taxonomy vocabulary: Machine name (= All Type Announce)
  3. SORT CRITERIA: (Parent) Taxonomy term: Weight (asc)
  4. RELATIONSHIPS: Taxonomy term: Parent term

and i get all list of taxonomy for this vocabulary grouping by parents, how to set only 2 levels?

4

This link saved me :), hopefully you get the results too....

Here is a quick tip that has proved helpful in a few different instances. Say you have a taxonomy vocabulary that has a set of root terms and these terms have children. For example:

Honda -Civic -Accord Toyota -Camry -Prius

Now say you want to configure a view that only shows the first level of this vocabulary. For example:

Honda Toyota

This is pretty easy to do and can prove useful when wanting to show a top level view of your terms. You can accomplish this with two steps within a term view:

  1. Add a relationship to the ‘Parent Term’.
  2. Add a filter using the ‘Parent Term’ relationship against the Term Name and set the operator to ‘Is Empty (NULL)’

Simple as that.

Happy Drupaling!

0

You should be just fine by introducing 2 chained parent relationships. Setting the criterion where parent of the parent is NULL should work. Well, this is a purely UI way of doing that, which is a pro. The con is that queries with nested relations might become heavy at some point, therefore consider turning on Views cache when you deploy the site.

  • "Artur's" method is pretty good. The only thig what I want to say is that "Setting the criterion where parent of the parent is NULL" need to be "equal to 0 (zero)". Also to get it work I had to group terms by parent. – hugronaphor Jun 24 '13 at 18:44

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.