When nodes have multiple taxonomy terms attached, are orderable in multiple categories, changing the order doesn't work.
This turns out to be because the term id is not taken into account when fetching the weights (in the nodeorder_node_load function), causing the weights of the nodes associated with others terms to overwrite the correct weight.

I rewrote the nodeorder_node_load function in nodeorder.module as following to fix this :

function nodeorder_node_load($nodes, $types) {
  if (arg(0) == 'taxonomy' && arg(1) == 'term' && arg(2)) $tid = arg(2);
  else $tid = '';
  $query = db_select('taxonomy_index', 't')
    ->condition('nid', array_keys($nodes), 'IN');
  if ($tid) $query->condition('tid', $tid);
  $result = $query
    ->fields('t', array('weight', 'nid'))
    ->execute();

  foreach ($result as $record) {
    $nodes[$record->nid]->weight = $record->weight;
  }
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mfernea’s picture

I have the same issue and I also think that nodeorder_node_load should be modified. The patch is based on the code posted by syngi. I think that the function should do nothing if the node load doesn't happen in a page related to a term.

  • dieuwe committed abbc244 on 7.x-1.x authored by mfernea
    Issue #1883038, by syngi and mfernea: Ordering doesn't work when node...
dieuwe’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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