Duplication of terms
restyler - July 9, 2009 - 13:08
| Project: | Taxonomy Menu |
| Version: | 6.x-2.4-beta2 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Description
I got error message, "Invalid argument supplied for foreach() on /var/www/html/includes/menu.inc in line 743"
After that I noticed that some of the terms in menu are duplicated (check the screenshot)
The menu rebuilding checkbox doesn't help.
| Attachment | Size |
|---|---|
| Clipboard02.jpg | 36.31 KB |

#1
wrong file attached, here is the correct one
#2
i have also a lot of dupplicatas... Maybe because i tried to hook with my own custom path but my code seems to be ok. I desactivated my module but no matters how many times i flush the cache and build the menu : i got a lot of dupplicata each times...
#3
Ok, i saw that the webmaster has set terms that have several parents; in this cas it seems that's taxonomy menu repeat in each categorie 3 times a term if he has 3 parents (sorry for my bad english)
#4
@restyler Can you please provide me your taxonomy structure or a small sample of it?
#5
Marked issue #536118: Duplicate menu items as duplicate of this one, I'm experiencing the same problem.
The warning I referred to related to a custom block I have, but which didn't seem to affect Taxonomy Menu in any way... However after seeing restyler's foreach() error, I'm wondering whether an 'invalid argument supplied for foreach()' triggers it somehow...?
I've attached a screenshot of my taxonomy structure, the same one in the screenshot in my other issue.
#6
I went into the database after my last post and deleted all duplicate menu entries. Everything was back to normal, except that it just started happening again this morning.
Needing urgent help with this!
#7
Using the 'Select to rebuild the menu on submit' feature successfully gets rid of the duplicate items from the taxonomy menu, but they get placed at the end of the main menu (primary menu, etc.) as children of the last menu item...
For example:
Before rebuild:
Room Type- Luxury
- Mid-range
- Budget
- Budget
- Budget
- Budget
Other menu items
Last item
After rebuild:
Room Type- Luxury
- Mid-range
- Budget
Other menu items
Last item
- Budget
- Budget
- Budget
#8
subscribing
#9
I'm having this problem as well, with a pretty plain-vanilla install. No errors are thrown in my case, but the duplicates are displayed in the menu. See http://drupal.org/node/558530#comment-1972528 (image #6 shows the duplicates). I have examined my term_hierarchy table and confirmed that it does not contain any duplicate entries.
Follow-up:
1. Disabled and uninstalled taxonomy_menu
2. Verified that all related database entries and table had been removed, based on what is in taxonomy_menu.install
3. Verified using current version (6.x-2.3 under Drupal 6.13)
4. Re-enabled Taxonomy Menu and Taxonomy Menu Custom Path modules
5. Edited Vocabulary and rebuilt menu
6. Duplicate appeared immediately, just as in above-referenced image
It appears this must have something to do with the menu-building process.
#10
subscribing
#11
Subscribing
#12
I"m working on this and issue #426304: Hierarchical menu, NOT auto expaning not working ok on and off for the next few hours. I'll be on IRC if anyone wants to assist. indytechcook
#13
After hours of debugging and research, it seems these are linked to issues with the core menu system.
#550254: Menu links are sometimes not properly re-parented
#149562: Menu module causes duplicate menu items
#566094: menu_tree_data() doesn't build proper hierarchy
Some of the times say they are for D7 but also apply for D6. I haven't tested any of the patches yet.
#14
at this time, if I have a flat taxonomy, do you recommend this module or the previous non-beta?
THANKS!
#15
According to the usage stats, nearly 700 sites have installed the new beta. There are a lot of good features and fixes in it. It's released as beta due to the number of changes that haven't been tested together.
I would use the new beta (of course testing your workflow).
#16
For thosing having this issue. Does this fix it? http://drupal.org/node/149562#comment-1969614
I've been unable to reproduce.
A side note that taxonomy menu does not support terms with multiple parents yet. There is some code being worked here #498182: Support for a term with multiple parents
#17
Subscribing
#18
See http://drupal.org/node/601174#comment-2156730 for a patch
#19
This has been commited. Please look for the dev release soon. If it fixes the issue, then please post here and I will add a new stable release.
Thanks again to elprans for fixing this long standing issues.
#20
change status.
#21
subscribing
#22
Hi,
I updated to the dev release (6.x-2.x-dev, 2009-Oct-29), I cleared the Drupal cache and I rebuilt the menu on submit, but I still have this bug. See the attached screen shot of my taxonomy structure and my menu.
#23
Do you have i18n setup? if so have you installed the patch from this issue: #316632: Integrate with I18n (I) - "Localize terms" or #498786: Integrate with i18n (II) - Solution for "Per language terms"
#24
This patch is part of 6.x-2.4-beta2. Please upgrade to that version and place this issue into RTBC if it works. I can't not release the next stable until this is resolved.
#25
No, I didn't install the module i18n.
#26
I've just updated to 6.x-2.4-beta2, and now my Drupal installation crashes:
Fatal error: Cannot redeclare _taxonomy_menu_term_count() (previously declared in /var/www/html/sites/all/modules/taxonomy_menu/taxonomy_menu.database.inc:130) in /var/www/html/sites/all/modules/taxonomy_menu/taxonomy_menu.database.inc on line 144#27
I can confirm the fatal error in 6.x-2.4-beta2.
It looks like the function was duplicated and modified, but the original function was not deleted.
See this commit: http://cvs.drupal.org/viewvc/drupal/contributions/modules/taxonomy_menu/...
Removing the first function at least returns the site to a usable state:
/**
* used to get the count without children
*
* @param $tid
**/
/** REMOVE THIS FUNCTION **
* function _taxonomy_menu_term_count($tid) {
* return db_result(db_query(db_rewrite_sql('SELECT COUNT(n.nid) AS c FROM {term_node} t INNER JOIN {node} n ON t.vid = n.vid WHERE n.status = 1 AND t.tid = %d'), $tid));
* }
**/
function _taxonomy_menu_term_count($tid) {
$view = views_get_view('taxonomy_term');
if(is_object($view)){
$args = array($tid);
$view->set_arguments($args);
$view->execute_display('page', $args);
return $view->total_rows;
} else {
return db_result(db_query('SELECT COUNT(n.nid) AS c FROM {term_node} t INNER JOIN {node} n ON t.vid = n.vid WHERE n.status = 1 AND t.tid = %d', $tid));
}
}
#28
Sorry. See beta 3.
#29
I've updated to beta3. I no longer have the fatal error, but I still have the bug about duplication.
#30
jpfle:
What if you UNINSTALL the taxonomy menu module, and then reinstall it?
By this, I mean disable the module AND then go to /admin/build/modules/uninstall and uninstall Taxonomy Menu.
Warning!
This will erase all taxonomy menu settings from the database. After reinstalling, you will need to reconfigure all of your Taxonomy Menu settings from scratch!
#31
I did it, and it fixed the bug! Thanks a lot! :-)
#32
Great!
Let's hope it does not show up again.
#33
Automatically closed -- issue fixed for 2 weeks with no activity.