Using 4.5
Heres my original code to change the taxonomy output for the block from last upated to alphabetical.
$result = db_query("SELECT d.tid, d.name, MAX(n.created) AS updated, COUNT(*) AS count FROM {term_data} d INNER JOIN {term_node} USING (tid) INNER JOIN {node} n USING (nid) WHERE n.status = 1 GROUP BY d.tid, d.name ORDER BY title ASC, d.name");
It was all working up until recently where a few terms were going at the top end of the list making them out of order.
For ex. it would go:
Aaaaa
Bbbbb
Eeeeee
Cccccc
Ggggg
Dddddd
I'm assuming it has to do with what exact order i created each term, since all the terms have the same exact details except for the name.
Can anyone help me modify the above code within the block function for taxonomy that grabs the categories.
This is the original code for the block function that grabs each category in the order of last updated.
$result = db_query("SELECT d.tid, d.name, MAX(n.created) AS updated, COUNT(*) AS count FROM {term_data} d INNER JOIN {term_node} USING (tid) INNER JOIN {node} n USING (nid) WHERE n.status = 1 GROUP BY d.tid, d.name ORDER BY updated DESC, d.name");
As you can see I modified the end of the line from ORDER BY updated, to: ORDER BY title.
I have some knowledge of sql commands and php but i'm no expert.
Thanks!
Comments
taxonomy block function code
And for those who are lazy like me but good with freestyling code, heres the whole function.
anyone up for the challenge?
anyone up for the challenge?
please?
Great
I was looking for such hack not later than a few minutes ago :D.
But this should be greater if you could allow this modification regarding of the taxonomy... I mean in some vocabs I need an order by date and in others, an alphabetical order...
But this require to patch a little more taxonomy.module, maybe you can post an issue to taxonomy modile ;)
i think its only that
i think its only that function i need to edit, when u create it u store the name, i just need to figure out the code that'll take throughs names and sort them. prolly more SQL than php.
er, bump?
er, bump?
Sorry ?
Sorry ?
So do you plan to roll out a patch with a way to select for each taxonomy the way to order it ? Well it should be a module...
well no and yesif i did
well no and yes
if i did figure out the code to change the ordering and worked, i guess i could make it into an additional module or just an edited version of taxonomy with that feature to turn on/off
the thing is i havent created a single module by myself just alot of editing work to customize the things i need.
I'll post back today on what i find since i'm gonna lookup the sql commands used.
woot, got alphabetical listing working!
wohoo! I got it working.
Basicly the code i'm posting below will change the category listing block from the regular display by last updated nodes in the category to, alphabetical by the term names. It also takes out the now useless time of last updated. I thought it was gonna be harder. Post here again if you get any errors.