Download & Extend

Breadcrumb hierarchy is opportunistically determined on node pages

Project:Taxonomy Breadcrumb
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

From my reading of the code and testing it with different paths, it seems the code in _taxonomy_breadcrumb_node_get_lightest_term opportunistically determines the base of the breadcrumb path based on the least value of all of the parent term ids applying to the node. This code assumes the term ids reflect the hierarchy order. Instead, should not the code determine the hierarchy from the actual relationships in the data?

Comments

#1

The attached patch determines the hierarchy from the actual relationships in the data.

AttachmentSize
616266_taxonomy_breadcrumb.patch 6.16 KB

#2

Please consider testing the patch in #372813: Reordering taxonomy terms with drag-and-drop removes taxonomy breadcrumb path. I think it addresses this issue as well, and is probably ready to be committed.

Thanks

#3

Looking at the second patch on comment #25 of #372813: Reordering taxonomy terms with drag-and-drop removes taxonomy breadcrumb path, it appears to rely on the weights of the terms. As mentioned above, since we are trying to display a breadcrumb hierarchy, the actual hierarchical relationships in the data should be utilized. From my tests with taxonomy user interface, I could enter terms, rearrange them (using the drag handles), and rearrange them again (saving after each step), and still have all with weights of zero. In this case, the patch might not produce the hierarchy.

The patch I submitted will work with a "single path of terms to the node." I assumed this case. The patch could get interesting results with the taxonomy relationships In your example (essentially two paths to the node through New York and Alberta). Yet, I believe it is using the correct approach of reflecting the actual hierarchical relationships in the data.

#4

seems this module isn't compatible with Hierarchical Select when "save term linage" option is enabled. If so, when we tag node with selected term, node also taged with all of term's parents. So {term_node} contain multiple terms and _taxonomy_breadcrumb_node_get_lightest_term can't determine the deepest.

here is my sample for determinig that at node page:

$result = db_query("select tn.tid,th.parent from term_node tn join term_data td ON td.tid=tn.tid AND td.vid=%d join term_hierarchy th on th.tid=tn.tid where nid = %d order by parent",CATEGORIES_VID,arg(1));
$terms_linage = array();
while ($term = db_fetch_object($result)){
    $terms_linage[] = $term;
}
$parent = 0;
$quantity = count($terms_linage);
for($i=$quantity;$i>0;$i--){ // max count() iteration to complete
    for($j=$quantity-$i;$j<$quantity;$j++){ // nested loop for process
        if($terms_linage[$j]->parent == $parent){ // child found
            if ($quantity-$i != $j){ // swap if not in it's place allready
                $k = $terms_linage[$j];
                $terms_linage[$j] = $terms_linage[$quantity-$i];
                $terms_linage[$quantity-$i] = $k;
            }
            $parent = $k->parent;
            break;
        }
    }
}

hope it's helpful and isn't out of place.

#5

Status:active» closed (fixed)

closing since I think this discussion has gone stale. A new release will be issued shortly. If this is still an issue, please try the latest code and see if the problem persists.

nobody click here