sort taxonony links ($terms) by vocabulary ($vid)

RobertNelsonVance - January 30, 2009 - 08:49
Project:Taxonomy Image
Version:5.x-1.5
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:NancyDru
Status:closed
Description

Hi-

I am interested in sorting taxonomy images by vocabulary. I have several different vocabularies and a number of terms for each. It is possible that several terms from each vocabulary will be selected per node.

I am currently using <div class="taxonomy"><?php print $terms?></div> in my node.tpl.php file and it obviously displays the terms as it normally would (not sorted by vocabulary).

I have found a way to do what I want, sort by vocabulary, using http://drupal.org/node/133223, but have not yet been successful at adapting it to play well with Taxonomy Image. Can anyone provide assistance with adapting this so that it supports Taxonomy Image?

Thanks for your help!

#1

RobertNelsonVance - January 30, 2009 - 19:56

To add further detail that I have found desirable while tinkering around with this...

What would make this even nicer, if someone's just going to write the code and post it up here, is if a variable option is included for how to sort the Vocabulary (sort by Vocabulary ID, or alphabetically, or by weight). Then you could include a similar variable option for how to sort the Taxonomy Terms within the Vocabulary.

Even a step further would be another set of variable options for both Vocabulary and Terms that defines how to handle each when there are two with the same rank - For example, two Vocabularies that are the same weight should be sorted alphabetically, or two Terms with the same weight should be sorted by the Term's ID.

So all of this together would include the following:

  • Sort vocabularies by:
    • Vocabulary ID
    • Vocabulary Weight
    • Alphabetically
    • If two vocabularies have the same rank via the above, sort by:
      • Vocabulary ID
      • Vocabulary Weight
      • Alphabetically
  • Sort terms within vocabularies by:
    • Term ID
    • Term Weight
    • Alphabetically
    • If two terms have the same rank via the above, sort by:
      • Term ID
      • Term Weight
      • Alphabetically

Of course all of this is assuming that someone might just go and write the code and just post it here as a contribution to the community. Adding this level of complexity would aid novice users in building out exactly what they want and save future support posts for variations on my initial support request.

Any suggestions on accomplishing all of this, WHILE keeping it friendly with Taxonomy Image, AND keeping it all within the theme file(s)?

#2

NancyDru - February 1, 2009 - 19:33
Status:active» postponed

I just posted a follow-up in that thread on how to show the image.

Any suggestions on accomplishing all of this, WHILE keeping it friendly with Taxonomy Image, AND keeping it all within the theme file(s)?

Well, if I add that to this module, it wouldn't be within the theme layer.

#3

NancyDru - February 12, 2009 - 23:43

You wouldn't want to sort vid above weight. I think it would be weight-name or weight-vid. And then the same for terms with vocab.

#4

skizzo - February 13, 2009 - 17:54

@RobertNelsonVance: not within the theme layer but...
would taxonomy_hide help? You could use it
only for its "group by vocabulary" functionality.

#5

NancyDru - February 13, 2009 - 22:29
Status:postponed» active

I am about to commit this fix. See the Taxonomy Hide caveat on the project page.

#6

NancyDru - February 13, 2009 - 22:52
Assigned to:Anonymous» NancyDru
Status:active» fixed

This feature has now been committed on both branches. The settings page now uses tabs rather than collapsed fieldsets. The sorting option is on the Link Alter tab. Please test this feature and let me know what you think.

#7

RobertNelsonVance - February 14, 2009 - 04:59

@skizzo

Thanks for the suggestion about the Taxonomy Hide Module. That's perfect.

I searched forever for a decent solution, the time I spent I could have written my own.

Thanks again, I had abandoned it for the time being, but now it's solved!

Regards

#8

NancyDru - February 14, 2009 - 05:08

Well, you could at least look at my solution.

#9

skizzo - February 14, 2009 - 16:29

I don't see the #6 changes commited yesterday in today's build (packaging script on 2009-02-14). I will check back tomorrow. Re Taxonomy Hide caveat: you may want to add also a reference to util. Useful for changing a module weight via Drupal administration, for those that do need TH alongside with TI.

#10

NancyDru - February 14, 2009 - 16:33

#11

skizzo - February 15, 2009 - 11:30

Yes indeed. Focusing on "TI Blocks" I did not realize that one must enable
"TI Link Alter" in order to see the new tabbed interface. Thank you.

#12

NancyDru - February 15, 2009 - 13:34

Well, any of the TI contribs will trigger the menu system to build tabs. I probably should have mentioned that you need to TRUNCATE (empty) your menu_cache.

#13

System Message - March 1, 2009 - 13:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.