Drupal: Group and sort by taxonomy term
For the reclaimyourcity relaunch, we added different categories (via taxonomy) for our picture specials. Now, a view was needed that displayed all special titles grouped by the particular category. And the categories should be sorted by the term’s weight since the category other should be displayed last. The following steps delivered the desired result:
1. First select the required fields of the picture specials, namely Content: Title and Content: special_type which refers to the terms of the corresponding vocabulary.
2. Exclude the special_type from display and in the grid layout settings, set the grouping field to special_type. Now, the picture specials are already grouped by the category, however, the tricky part was finding the switch to sort the categories.
3. Add a relation with Content: Taxonomy terms on node which is identified by default with term.
4. Add the sort criteria (term) Taxonomy term: Weight (asc).
And now all picture specials are displayed grouped by the categories and ordered by the categories’ weights.