I'm using the Taxonomy_context module to display a term, with its sub-terms, then the nodes below each sub-term. However, I'm perplexed about the order in which the nodes get displayed.
What I want, is to display the nodes ordered by title. What I get, is the nodes ordered by create date.
I thought, easy enough, just hack the module to sort the way I want. Trouble is a can't find where!!!
I thought, here is the place (only place I can find where taxonomy_context outputs nodes:
function taxonomy_context_show_nodes($tid) {
static $context;
if (!isset($context)) {
$context = taxonomy_context_get_context();
}
$output = "";
$sql = "SELECT DISTINCT(n.nid), n.title, n.body, n.type, " .
"n.created, n.changed, n.uid, n.sticky, u.name FROM {node} n " .
"LEFT JOIN {term_node} r ON n.nid = r.nid LEFT JOIN {users} u ON n.uid = u.uid " . node_access_join_sql() .
" WHERE r.tid = %d AND n.status = '1' " . node_access_where_sql() .
(variable_get("taxonomy_context_use_promote", 1) ? " AND n.promote = '1' " : "") .
" ORDER BY sticky DESC, n.created DESC";
$result = db_query($sql, $tid);
while ($node = db_fetch_object($result)) {
if(!strpos('<?', $node->body)) {
$params = array("title" => node_teaser(strip_tags($node->body)));
}
if ($node->nid == $context->nid) {
$params["class"] = "active";
}
$link = l($node->title, "node/". $node->nid, $params);
$output .= "<li class=\"leaf\">" . $link . "</li>";
}
return $output;
}
But when I change "ORDER BY sticky DESC, created DESC" to "ORDER BY sticky DESC, n.title DESC" nothing happens. Am I looking in the right place?
I would be really grateful for any light anybody can shed on this as I am stumped.