Drupal core is sorting taxonomy terms 1.) first numerically ascending by weight and 2.) second alphabetically ascending by term name (!!), since when drag'n'drop-sorting a term list, Drupal doesn't increment the term weight when the manually set order is in accordance with the alphabetical order of the term's (original untranslated) name.
Long story short:

Problem:

This module is missing the secondary sort in 2.) and therefore doesn't work as expected in many cases.

Solution:

The primary solution is easy, we just need to add the term's names to the sorting as secondary sort criteria. The patch below contains this fix.

The devil's in the detail however: Term's which are managed by entity_translation.module and have their term names translated with the title.module's name field replacement, we need to get to the original term name, since using the translated one would lead to sorting inconsistencies over different languages. To make this possible, the freshly created patch in http://drupal.org/node/1445848#comment-5623024 for title.module has to be applied before applying this one.

Comments

danielnolde’s picture

Status: Active » Needs review
StatusFileSize
new2.07 KB

The attached patch contains the fix.

danielnolde’s picture

Oh, and to apply this patch, you'll need to first apply the patch form http://drupal.org/node/1445844#comment-5622986 to correct a function name typo. But trust me, the all this patching marathon is worth it, since it makes this module work ;)

plach’s picture

FYI, the Title patch has been committed.

ianthomas_uk’s picture

This module obviously needs to use the same logic as the taxonomy module to sort the facets, but is there a better way to do this using more centralised code? Does facetapi_taxonomy_sort_sort_taxonomy belong in the taxonomy module instead?

In the mean time, if anyone runs into this problem and doesn't want to patch the module themselves, they should be about to work around it by sorting by display value after taxonomy weight while configuring the facet.

thepanz’s picture

Issue summary: View changes

I will review the patch and merge it soon! Thanks!

  • thePanz committed a1e08ce on 7.x-1.x
    Issue #1445876 by danielnolde, thePanz: Sort should include term name to...
thepanz’s picture

Status: Needs review » Fixed

Patch committed with few minor corrections!
Thanks @danielnolde!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.