Index: menutrails.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/menutrails/menutrails.module,v
retrieving revision 1.4.2.21
diff -u -p -r1.4.2.21 menutrails.module
--- menutrails.module	17 Aug 2009 16:37:53 -0000	1.4.2.21
+++ menutrails.module	3 Sep 2009 00:28:58 -0000
@@ -128,9 +128,12 @@ function menutrails_node_location($node)
     $href        = $type_trails[$node->type] ? $type_trails[$node->type] : FALSE;
     $term_trails = variable_get('menutrails_terms', array());
     if (!empty($node->taxonomy)) {
-      foreach ($node->taxonomy as $term) {
-        if (isset($term_trails[$term->tid])) {
-          $href = $term_trails[$term->tid];
+      // Reverse the taxonomy list so that term weight is honored
+      foreach (array_reverse($node->taxonomy) as $term) {
+        foreach (array_reverse(taxonomy_get_parents_all($term->tid)) as $term_parent) {
+          if (! empty($term_trails[$term_parent->tid])) {
+            $href = $term_trails[$term_parent->tid];
+          }
         }
       }
     }
@@ -224,6 +227,15 @@ function menutrails_settings_form() {
     '#prefix' => '<p>',
     '#suffix' => '</p>',
   );
+  if (module_exists('taxonomy')) {
+    $form['order_term'] = array(
+      '#type' => 'markup',
+      '#weight' => '-1',
+      '#value' => t('Taxonomy terms inherit menu settings from their parents, when no menu item is selected.  If a node has multiple taxonomy terms assigned, the term with the lowest weight takes priority.'),
+      '#prefix' => '<p>',
+      '#suffix' => '</p>',
+    );
+  }
   $form = array_merge($form, module_invoke_all('menutrails_settings', $options));
 
   return system_settings_form($form);
