This question pops every time I create a new e-commerce site.
I have a horizontal main menu with Home, Products, Blog, etc... in it. I need to get the terms from my Product catalogue as the drop down menu underneath Products.
I use Taxonomy Menu to good effect elsewhere in the site, but I can't see any way of moving an entire Taxonomy Menu (or even a sub-set) to underneath a menu link in another menu.
My usual method is to hard-code a function into my theme (with appropriate caching of course), which builds up the sub-menu of terms. I then have to create another function to mimic the menu rendering functions, and inject the 'taxonomy menu' when my loop hits a certain menu link ID. Finally I use that function in place of the standard method of outputting menu links in my page template file.
Needless to say that's not a good method and it leaves me feeling dirty every time. I'd really prefer a more opaque method that keeps the menu in sync when terms in the vocabulary are changed.
It seems like this problem would have been solved over and over again, but my Google-fu is failing me.
Anyone got any good suggestions (that don't involve creating a View, which would be way too much overhead)?
I should also mention the lazy man in me is looking for a pre-built module to do this. It would be fairly trivial(ish) to implement the code on a case-by-case basis (see hampusn's comment below) but I'm hoping there's a generic module based solution available.
module_invoke_all('menu_rebuild', $menu, $changes)
in combination withhook_taxonomy_term_insert($term)
? I'm not sure when you want to rebuild the menu.module_invoke_all('menu_rebuild'
anywhere in the source so I'm not so sure it exists :). I might have gotten it from this issue. Your topic is interesting though. I'll dig some when I get home from work.