Closed (duplicate)
Project:
Taxonomy Menu
Version:
6.x-2.x-dev
Component:
Sync
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Dec 2010 at 09:58 UTC
Updated:
29 Apr 2013 at 15:46 UTC
If I add or update a node linked to a child term, the parent menu -item does not get updated while it may change if "Display number of items" is checked (as well as "Use 'all' at the end of URL") (or if "Hide empty terms" is checked)
Example:
Menu looks like:
term 1 (3)
- term 1.1 (2)
- term 1.2 (1)
term 2 (4)
If I add a node tagged with term 1.1 the updated menu should look like:
term 1 (4)
- term 1.1 (3)
- term 1.2 (1)
term 2 (4)
I quickly solved it by adding the following lines (no guarantee that it works for all combinations of settings)
function _taxonomy_menu_nodeapi_helper($op, $terms = array()) {
$org_op = $op; // NEW LINE
foreach ($terms as $key => $tid) {
...
if ($menu_name && $vocb_sync && ($menu_num || $hide_empty)) {
switch ($op) {
...
}
taxonomy_menu_handler($op, $args);
// NEW LINES: update parent menu items as well if display_num or hide_empty
foreach ($term->parents as $parent) {
_taxonomy_menu_nodeapi_helper($org_op, array($parent));
}
// END OF NEW LINES
}
}
}
Comments
Comment #1
dstolComment #2
dstolIt'd be really helpful if you were able to create a patch for this. http://drupal.org/patch/create
Comment #3
johnvThis is fixed in D7 with #1509542: Node count not correct when moving node in hierarchy from A to B (count of A is not updated)..