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.

AttachmentSize
Clipboard02.jpg36.31 KB

#1

restyler - July 9, 2009 - 13:11

wrong file attached, here is the correct one

AttachmentSize
Clipboard02.jpg 34.15 KB

#2

nyl auster - July 9, 2009 - 13:23

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

nyl auster - July 9, 2009 - 15:39

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

indytechcook - July 20, 2009 - 10:56
Status:active» postponed (maintainer needs more info)

@restyler Can you please provide me your taxonomy structure or a small sample of it?

#5

BWPanda - August 5, 2009 - 23:15
Title:Duplicates of terms» Duplication of terms
Version:6.x-2.3» 6.x-2.x-dev
Status:postponed (maintainer needs more info)» active

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.

AttachmentSize
taxonomy_structure.png 6.96 KB

#6

BWPanda - August 12, 2009 - 23:21

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

BWPanda - August 18, 2009 - 03:04
Priority:normal» critical

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

alex_andrascu - August 19, 2009 - 13:20

subscribing

#9

BayouBill - August 26, 2009 - 18:26

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

TRex2003 - September 16, 2009 - 12:30

subscribing

#11

Rayrunner - September 17, 2009 - 22:39

Subscribing

#12

indytechcook - September 18, 2009 - 12:17

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

indytechcook - September 18, 2009 - 16:41

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

nally - September 18, 2009 - 17:21

at this time, if I have a flat taxonomy, do you recommend this module or the previous non-beta?

THANKS!

#15

indytechcook - September 18, 2009 - 17:29

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

indytechcook - September 19, 2009 - 00:50

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

Skjalf - October 7, 2009 - 20:29

Subscribing

#18

elprans - October 15, 2009 - 22:56

#19

indytechcook - October 18, 2009 - 01:15

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

indytechcook - October 18, 2009 - 01:15
Status:active» needs review

change status.

#21

jpfle - October 30, 2009 - 23:14

subscribing

#22

jpfle - October 30, 2009 - 23:42

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.

AttachmentSize
taxonomy-structure.png 28.91 KB

#23

indytechcook - October 31, 2009 - 01:32

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

indytechcook - October 31, 2009 - 18:49
Version:6.x-2.x-dev» 6.x-2.4-beta2

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

jpfle - October 31, 2009 - 19:09

No, I didn't install the module i18n.

#26

jpfle - October 31, 2009 - 19:15

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

arlinsandbulte - October 31, 2009 - 19:52

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

indytechcook - October 31, 2009 - 20:26

Sorry. See beta 3.

#29

jpfle - October 31, 2009 - 20:35

I've updated to beta3. I no longer have the fatal error, but I still have the bug about duplication.

#30

arlinsandbulte - October 31, 2009 - 20:46

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

jpfle - October 31, 2009 - 21:48
Status:needs review» reviewed & tested by the community

I did it, and it fixed the bug! Thanks a lot! :-)

#32

arlinsandbulte - October 31, 2009 - 22:20
Status:reviewed & tested by the community» fixed

Great!
Let's hope it does not show up again.

#33

System Message - November 14, 2009 - 22:30
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.