I desperately need to sort a view by taxonomy term weight BUT my key vocabulary is 4 levels deep and term weights appear to "reset" at each level. So, for instance, in my vocabulary the terms District, Elementary and Pre-K all have a weight of 0. For example, a portion of the taxonomy for a school site that I'm building looks like this:
Extracurricular / Weight=14
-- Administration / Weight=0
---- Clerical / Weight=0
-- Athletics / Weight=1
---- Baseball / Weight=0
---- Basketball / Weight=1
---- Cheerleading / Weight=2
When I sort by Weight things like Administration, Clerical and Baseball all float to the top (even above their parents) since they all carry a weight of zero.
I guess what I'm looking for (and not finding) is a way to sort my view by Weight times Depth...or more realistically something like...
Sort = Depth(Parent)Weight(Parent)100 + Weight(Term)
Comments
Follow-Up
Thought I'd better post a little follow-up since I'm no longer "desperate", but still interested in knowing how this might work now. It just seems wrong having to make the data serve my needs in this manner.
After trying a couple of things (exported my taxonomy, used Excel to calculate new term weights and imported them back) I just gave up, bit the bullet and added my own "Rank" field to my Jobs content type. Now the thing sorts the way I want it to.
Mark
Mark
I'm wanting to solve this too.
There was apparently some way of doing it in Drupal 5 but I those modules are not available for 6.
It seems a fairly obvious need.
Same problemo...
I'm looking for a solution to the same problem. (I couldn't figure out for the life of me how to explain it in the first place! Glad you did! )
@Summitt Dweller - can you explain the ranking system you used? I may have to do the same thing for now too.
I had toyed with using different levels of taxonomy as weight numbers. For instance, I have six galleries. In each gallery there are images. I need to order the galleries themselves and then the images within the galleries. I was thinking of doing it like this:
The vocabulary is Products... the terms are:
Vehicles -
-- 1Vehicles
-- 2Vehicles
-- 3Vehicles
-- 4Vehicles
Fleets -
-- 1Fleets
-- 2Fleets
-- 3Fleets
-- 4Fleets
and so on.
Then I could create my view with the filter of Vehicles or Fleets and then sort on the sub category of the term. But I suppose if I was going to go about it this way, I could just make each parent term a vocabulary, and then the numbered versions the terms.
I also thought about using the CCK integer field and making a drop list of numbers, like weight works. But one of the big problems with this is with 36 items you'd have to remember what order the other items are. You might end up having to do a lot of re-ordering of the images. Or end up with a strange sequence. For instance the vehicles might be numbers 3, 18, 46, 85. And again, tracking the order would require a cheat sheet.
I had one more idea: Creating a menu for each of the products. It won't be displayed. Then add the fleet images to the fleet menu, vehicles to vehicles menu, etc. Since these are images in a gallery, they don't really need to be on a menu. then we can use the menu weight option to sort the items. Or, sort them in the admin/build/menu section. I actually don't know yet if you can use the menu weight as a sorting option in views. If not, then this method won't work either. It is very frustrating...
The other problem I was trying to avoid was trying to explain to my client how these cockeyed methods work. Thankfully, we only have 6 products, with no more than 9 items in each gallery, so its pretty easy to manage. What I may end up doing is having the client do is modify the Authoring Information date, and sort by that.
I'm surprised that this hasn't come up more often. I'd appreciate any feedback to my ideas, or any ideas anyone else may have...
K
EDIT: I just checked views, and I didn't find any option to use menu weight for sorting... :/
Lineage
http://drupal.org/project/lineage
Seemed to do the trick for me :)
How to filter Parent Term and Child Term in Views
First of all, i am using Drupal 7.
I try to setting up FILTER CRITERIA > Taxonomy term: Weight
But it disappointing me. Because taxonomy weight always start in 0. If i am going to make multiple level term, it won't work. and cannot the the result.
My solution:
1)Labeling your term with a description. (for example APPLE)
2)Views > FILTER CRITERIA > Term description (has word APPLE)
3)APPLY
It works charm for me~ i hope this solution is works for yours.
I hope someone can suggest more better ideas for this matter.
-Reviews-
Benefit:
1)LABELING- Feel more comfortable / easy to manage the term
2)SORTING- Term weight is the character who do the sorting. You can raise up / lower down the weight anytime comfortably and it won't destroy your page.
CONS:
1) Since using description to do the labeling. Your term MAYBE cannot disclose the Term Description publicly. Only for admin use purpose.
Solution!
This module does exactly what you want, sorting by taxonomy term order as displayed in a tree:
https://www.drupal.org/project/views_term_hierarchy_weight_field