Closed (outdated)
Project:
Taxonomy Menu
Version:
6.x-2.9
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Nov 2009 at 00:35 UTC
Updated:
11 Mar 2016 at 15:10 UTC
Jump to comment: Most recent
Comments
Comment #1
indytechcook commentedThanks hass. I use taxonomy_get_tree to pull the list of terms. This should be respecting the correct weight. Do you have another suggestion?
Comment #2
hass commentedI do not have any weight configured myself... core sorts correctly itself with weight = 0. You may take a look how core solve the ordering... I have never taken a look how this ordering is done.
Comment #3
indytechcook commentedTaxonomy Menu and Taxonomy both use taxonomy_get_tree to pull the vocabulary and cycling through it in the order it was received from that function.
The only different appears in vocabularies that are set as 'tags' Are you using a tags vocab?
Comment #4
indytechcook commentedChange status
Comment #5
hass commentedSorry, what do you mean with tags? My terms have only a title and fields added with the term fields module, but this is not important here.
Comment #6
hass commentedDo you mean free tagging with "tags"? I'm not using free tagging...
Comment #7
indytechcook commentedhmm.. Ok. Can you please attach an XML export of your taxonomy and give me all of your taxonomy menu settings so I can reproduce?
You are welcome to email them to me if you don't want to post them.
Comment #8
hass commentedHow should I export to XML?
Comment #9
indytechcook commentedUse this module: http://drupal.org/project/taxonomy_xml. It's also how I keep taxonomy's in sync between environments also :)
Comment #10
indytechcook commentedThe terms as saved in the correct order, the issue appears to be how the menu system is pulled. I'll add waits to the menu save function to keep the order.
Comment #11
indytechcook commentedFix committed: http://drupal.org/cvs?commit=297660
Comment #12
hass commentedGreat, thx.
Comment #14
indytechcook commentedI had to back out this change. I caused to many issues with updating the taxonomy. #780720: Menu weight not being set properly.
reopening this issue. There needs to be a better way. possibly updating the taxonomy weight on hook_taxonomy.
Comment #15
hass commentedAny plans about the time frame you need to get this finally fixed?
Comment #16
indytechcook commentedWell, I'm not sure of the correct approach. The original fix was just to work around the difference in ordering between the menu and taxonomy systems.
One recommendation was to create an option to "Order by Alphabet" which sets all of the weights to '0'. I'm not sure if this will work but others have had some success hard coding this.
It really bothers me that I can't just use the taxonomy term's weight as the menu weight. I use taxonomy_get_tree to pull and insert the terms as menu items in the correct order (the same function the taxonomy module uses).
Another problem is that reseting the vocab to alphabetical doesn't trigger any hooks so I have no way to reordering the menu unless I use DB triggers (which i'm not doing).
The only other option is to have taxonomy menu track the weights, but put in more resource intensive functions to check the parents, preceding terms to set reset the weight of the menu items. I'm worried about the load this will be for every term update.
I'm open to thoughts.
Comment #17
indytechcook commentedA possible fix is to place an option what sets the menu weight to 0 on initial insert. I will not hard code the weight = 0 for all occurrences. This will cause to many other bugs.
Comment #18
hanoiisubcribe
Comment #19
tomsm commentedA hard coded fix:
I changed line 542 of taxonomy_menu.module from
$link['weight'] = $item['weight'];to
$link['weight'] = 0;to have alphabetical sorting in all languages.
Comment #20
tomsm commentedComment #21
MattBrigade commentedI have came across a way to ensure the weight of the menu items are set to 0 (to list items alphabetically) and NOT have to hack the module. The Taxonomy Menu does actually provide some hooks for other modules to alter the menu items as they are saved/updated.
You need to set up a small custom module. You could name it something along the lines of "taxonomy_menu_mods". (If you don't know how to create a custom module, you can learn how pretty quickly with this great tutorial: http://drupal.org/node/206753)
Inside the module, use the following hooks (NOTE: Replace "mymodule" with whatever yo decided to name your module):
That's it! To force Taxonomy Menu to reset all the weights, go to your vocabulary's settings page, check-off "Select to rebuild the menu on submit" and hit "Save". All Taxonomy Menu items set/saved from there on out will be created with a weight value of "0".
Hope that helps!
Comment #22
tomsm commented@ mattapus
Thank you for the tip!
Comment #23
hass commentedThe original issue was only about non-latin characters... Above hack sounds not like a real solution.
Comment #24
MattBrigade commentedMy apologies if my post isn't a real fix for this issue. There was talk is posts #17 and #19 about forcing the Taxonomy Menu item's weights to 0. They were hacking the module to achieve this which is not quite ideal. I was just pointing out a way to do the same thing through hooks instead.
Comment #25
dstolThe Drupal 6 version is no longer supported