Sort Drupal taxonomy terms by custom weight

Submitted by Anonymous (not verified) on Mon, 04/11/2011 - 16:24

I have got a problem with Drupals taxonomy sorting alghoritm. I got a taxonomy group for authors. I created a block with tagedelic "tags in authors". The problem there was that tagedelic couldnt put in right place author-names starting with letters like é, í, ò etc.

To solve it. I exported all terms and edited them in Notepad++. I sort terms by alpha, gave them an automated line number. And combined line number with Drupals weight range (scala +49 to -49).

update term_data set weight = -49+\1/3 where tid=\2 /* \3 */ ;

\1 is line number.

update term_data set weight = -49+00000195/3 where tid=132 /* Riccardo Petrella */;

update term_data set weight = -49+00000001/3 where tid=1 /* Noam Chomsky */;

Add new comment