Imagine nodes with a terms from three vocabularies. One of the vocabularies is called Priority, and each node has term High, Medium, or Low from the vocabulary.

Drupal should provide a way to order the nodes' primary sort by their taxonomy from a selected vocabulary. E.g., if the nodes are sorted by their respective term in Priority vocabulary, all nodes with term High are sorted before all nodes with term Medium. Note that an alpha sort works in this case, but sort should also be doable based on terms' weights.

I can't use Views's built in sort because it does not distinguish by vocabulary; it appears to sort by whatever term it can find in the node, regardless of taxonomy. My nodes have terms from multiple vocabularies, so that sort would be nonsense. Per #150896: Sort on Taxonomy: Terms for [your vocabulary], it appears that the Drupal system makes this unacceptably difficult for Ernie to implement in Views.

I also reviewed Comparison of Node Ordering Modules, and none of those appears to support this request.

I imagine this issue is not filed correctly, but I am not knowledgeable enough of Drupal's or Views's design and future path to know what the correct approach is. Thought I would start with the core and work up from there.

Comments

aren cambre’s picture

To be clear, I should be able to sort on term ID, term name, or term weight but only from one vocabulary I choose.

brush’s picture

Status: Active » Needs review

i'm working on a related, but more complex challenge (see #557454: filtering by a term in one vocab while sorting by another vocab). but it might help to clarify something for newbies reading this thread: it is possible using views to "sort nodes by terms in a single vocabulary" if by that you mean that you only want to see nodes that are linked to a term in that vocab. this seems to be the use case in this issue above.

ie. in the example above if there are nodes that don't have a "priority" rating, they won't be displayed. and any other vocab terms will be ignored for sorting purposes.

do this by creating a filter on Taxonomy: Vocabulary. then create sorts on Taxonomy: Term name or whatever.

or is this not the use case above?

aren cambre’s picture

My use case is simply that if notes in a view has terms from a taxonomy, the nodes are sorted by their respective terms' weights.

E.g., suppose you have these taxonomy terms and weights:
A - 100
B - 500
C - 0

If you ordered those taxonomy terms by weight, the order is C A B.

Now, suppose you have these nodes with taxonomy:
W - C
X - A
Y - C
Z - B.

If you order the nodes by their taxonomy terms' weights, they would be ordered W Y X Z.

catch’s picture

Version: 7.x-dev » 8.x-dev
Component: node system » taxonomy.module
Status: Needs review » Active

No patch here, this would need to be done in Drupal 8.

amateescu’s picture