diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-05-21 12:15:54 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-05-21 12:15:54 +0000 |
commit | a31b1b38765e3f91270e7339821721f6e80fa2b0 (patch) | |
tree | 2ca4756d3924250ef1ad01b9bba32e1c4417ef19 | |
parent | 2a744f8950653468c995d436cbf0a139481b26f5 (diff) | |
download | brdo-a31b1b38765e3f91270e7339821721f6e80fa2b0.tar.gz brdo-a31b1b38765e3f91270e7339821721f6e80fa2b0.tar.bz2 |
- Patch #7684 by MrRoot/grohk: order taxonomy terms by vocabulary weight, then term weight.
-rw-r--r-- | modules/taxonomy.module | 4 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/modules/taxonomy.module b/modules/taxonomy.module index 722638573..abca53066 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -542,13 +542,13 @@ function taxonomy_node_get_terms_by_vocabulary($nid, $vid, $key = 'tid') { } /** - * Find all terms associated to the given node. + * Find all terms associated to the given node, ordered by vocabulary and term weight. */ function taxonomy_node_get_terms($nid, $key = 'tid') { static $terms; if (!isset($terms[$nid])) { - $result = db_query('SELECT t.* FROM {term_data} t, {term_node} r WHERE r.tid = t.tid AND r.nid = %d ORDER BY weight, name', $nid); + $result = db_query('SELECT t.* FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name', $nid); $terms[$nid] = array(); while ($term = db_fetch_object($result)) { $terms[$nid][$term->$key] = $term; diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 722638573..abca53066 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -542,13 +542,13 @@ function taxonomy_node_get_terms_by_vocabulary($nid, $vid, $key = 'tid') { } /** - * Find all terms associated to the given node. + * Find all terms associated to the given node, ordered by vocabulary and term weight. */ function taxonomy_node_get_terms($nid, $key = 'tid') { static $terms; if (!isset($terms[$nid])) { - $result = db_query('SELECT t.* FROM {term_data} t, {term_node} r WHERE r.tid = t.tid AND r.nid = %d ORDER BY weight, name', $nid); + $result = db_query('SELECT t.* FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name', $nid); $terms[$nid] = array(); while ($term = db_fetch_object($result)) { $terms[$nid][$term->$key] = $term; |