I don't think this is possible yet.
I think this would help when dealing with #717412: Document process for sorting a node view by taxonomy term (various edge cases).
I don't think this is possible yet.
I think this would help when dealing with #717412: Document process for sorting a node view by taxonomy term (various edge cases).
Comments
Comment #1
anrikun commentedComment #2
anrikun commentedActually, adding this was quick.
Please review the attached patch. It adds the missing "Vocabulary weight" (field and sort).
Comment #3
iamjon commented#773000: Views : manual or weight sorting on grouping taxonomy maybe related
Comment #4
kbaringer commentedThanks for the suggestion, but unfortunately the patch doesn't solve the problem with sorting by taxonomy term weight. What it does is add an option to sort by vocabulary weight (which is also a worthwhile improvement!).
The thread at http://drupal.org/node/773000 deals with getting the taxonomy term weight to be recognized when the query results are grouped by taxonomy term in the HTML List style. This way the groups that are created for each taxonomy term will be sorted on the page by the weight of the term ($title in the item_list class as written by views-view-list.tpl.php).
Suggestions on that topic are still welcome!
~K
Comment #5
anrikun commentedHave you tried to sort by vocabulary weight (you need the patch for that), then by term weight?
It works for me.
Comment #6
kbaringer commented@anrikun, I did try sorting by vocabulary weight after applying the patch, but it doesn't solve the problem for the site I'm modifying because they are already filtering the view using vocabulary. All of the nodes that are returned have the same vocabulary, so sorting by that field doesn't do anything.
The only thing being displayed by the view are node titles, but they are grouped (in HTML lists) by taxonomy term. The client would like the groups to be sorted within the view based on the weight of the taxonomy term.
Comment #1 in this thread http://drupal.org/node/773000 states "You would have to override the argument handler of terms". I'm willing to give this a try but since I'm still learning my way around the Drupal architecture I'd love to have a mentor. Anyone willing to help me out?
~ K
Comment #7
anrikun commentedCould you post a screenshot of your view's edit form (admin/build/views/edit/VIEW_NAME)?
Comment #8
jelo commentedsub
Comment #9
fbackelj commentedHello, using this patch I was able to get a two level sorted list, first by Grouping field using the patch from #2 here, and then by Node title. The details are at http://drupal.org/node/921498.
Thanks for this patch.
Comment #10
anrikun commentedThanks.
Can someone else confirm that the patch works? This could then be marked as RTBC.
Comment #11
Alphabool commentedanrikun, I don't mean to hijack this thread, but I want to know whether this patch would make it possible to specify the vocabulary a term comes from when specifying a taxonomy term field in Views. That is currently what I am struggling with.
Comment #12
anrikun commented@Alphabool: You should try the "vocabulary" filter that already exists in Views.
The patch here only provides the missing "sort by vocabulary weight".
Please, if you need further help about this, post it as a separate support request.
Comment #13
tannerg commentedIs this patch scheduled to make it into the main branch of this module?
Comment #14
anrikun commentedIt has to be marked as RTBC first (I won't do it myself as I'm the one who posted the patch).
Comment #15
dawehnerIn general feature requests are currently only applied to 6.x-3.x.
6.x-2.x is in a bug fix only status. But this clearly can't break something
Comment #16
bolecha commentedWhere to apply the patch#2?
I can't find modules/taxonomy.views.inc.
Is this file in the views module?
Comment #17
dawehnerIs this file in the views module?yes it is
Comment #18
bolecha commentedThank you.
I found the file.
Comment #19
polHello,
I made the same patch for myself this morning and I was about to make a new issue when I found this thread.
I've updated the patch and added the taxonomy vocabulary weight as an argument and also for the term weight.
Maybe it will be useful to someone one day, who knows ;-)
This patch is for views 7.x-3.x but I'm pretty sur that it can be almost the same for 6.x-2.x and 6.x-3.x, if you need them, I can provide them.
Comment #20
polComment #21
tim.plunkettTriggering the testbot.
Comment #23
polI'll provide a new patch very soon, probably today.
Comment #24
polUpdated patch.
Comment #25
johnpitcairn commentedPatch at #24 works for me. I have a multi-value taxonomy field, and I'm able to add a relationship "Content: taxonomy terms on node", a field "Taxonomy: term name" using that relationship, group the display by the taxonomy term name field, then sort the groups by term weight using the relationship, and by node title within each group. Sweet.
Comment #26
tim.plunkettI don't think this inline comment is necessary. Perhaps it was from the examples/documentation? Let's remove it.
Otherwise, looks great.
Comment #27
polHere's the modified version of the patch.
I removed the inline comment as suggested by @tim.plunkett.
Comment #28
polComment #29
tim.plunkettLooks good to me!
Comment #30
dawehnerThis is the schema definition in taxonomy.install, so it's technical a number.
Based on this, the handler types should be a bit different:
views_handler_field_numeric
views_handler_argument_numeric
views_handler_filter_numeric
Comment #31
tim.plunkettRerolled, included patch credit for Pol and a commit message.
Comment #32
FranCarstens commentedThe timing on this is perfect. I so need it today! Btw. it works for me. :D
Comment #33
dawehnerThis looks perfect so far.
Comment #34
dawehnerThanks for the patch!
Committed this one to 7.x-3.x and 8.x-3.x