0

I have a View which lists products (nodes). In the View, I first display the taxonomy the node belongs to, and then the title and image of the product. I have ordered the query by taxonomy. The problem is that I get a repeated taxonomy for each row of the View (each product). How can I display the taxonomy just once, the first time it occurs, and then all the products belonging to that taxonomy, then another different taxonomy and its products and so on...

Now I have this result

Sports
    - The great book of soccer
Sports    
    - Practicing tennis
Sports 
    - Mastering Chess
Science
    - Quantum Mechanics
Science
    - Cold fusion

and I want this result

Sports
    - The great book of soccer    
    - Practicing tennis
    - Mastering Chess
Science
    - Quantum Mechanics
    - Cold fusion
1

You can achieve this using the Grouping field setting in the view's Format settings. You will need to be using Fields (as opposed to Content) in the Format section of your view.

Show Fields

In your Fields list, click on the taxonomy term field to open the field configuration. Check Exclude from display and apply:

Exclude image from display

In the Format section of your view, click on the Format Settings.

Open format settings

The Grouping field Nr. 1 select list is available in each Format type, so no worries if you have it set to HTML list or another format. Change the field from None to the taxonomy field you want to group by and apply.

Grouping field settings

Your view will now show products grouped by the taxonomy term. From this point you can use the Sort criteria of the view to get the ordering of products or taxonomy terms you need.

Result of grouping

  • You're quite welcome! – Kristin Aug 11 '16 at 14:19

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.