Index: content_taxonomy.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/content_taxonomy/content_taxonomy.module,v
retrieving revision 1.2.2.16
diff -u -p -r1.2.2.16 content_taxonomy.module
--- content_taxonomy.module	18 May 2008 20:30:36 -0000	1.2.2.16
+++ content_taxonomy.module	16 Oct 2008 12:20:01 -0000
@@ -218,9 +218,19 @@ function content_taxonomy_field_formatte
  */
 function content_taxonomy_terms_by_field($node, $vid, $parent = NULL, $depth) {
   if (is_numeric($parent) && $depth == 1) {
-    $result = db_query("SELECT n.tid FROM {term_hierarchy} h, {term_node} n WHERE
-      n.nid = %d AND n.tid = h.tid AND h.parent = %d", $node->nid, $parent);
-    
+
+// modify query to sort by term weight
+    $result = db_query("SELECT n.tid
+      FROM {term_hierarchy} h
+      JOIN {term_node} n
+      ON n.tid = h.tid
+      AND n.nid = %d
+      JOIN {term_data} td
+      ON td.tid = n.tid
+      WHERE h.parent = %d
+      ORDER BY td.weight",
+      $node->nid, $parent);
+
     while ($data = db_fetch_array($result)) {
       $term = taxonomy_get_term($data["tid"]);
       $additions[$term->tid] = $term;
