Do not know if it is a bug but I cannot sort two times.

First I sort by a value (ubercart stock level) with following sort code:
return $row1->stock < $row2->stock ? -1 : (int)$row1->stock > $row2->stock;
Fine...
Then (AND) I need to sort alphabeticaly based on title. I added the sort criteria on title, but it has no effect... my view is only sorting on first criteria (stock)

Comments

mahmost’s picture

if I get you right then you need to put the alphabetical sort code within the stock sorting code .. something like this :

if ($row1->stock < $row2->stock) {
  return -1;
}
if ($row1->stock > $row2->stock) {
  return (int)$row1->stock > $row2->stock;
}
if ($row1->stock == $row2->stock) {
  // alphabetical sort code here
}
liam morland’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Drupal 6 is no longer supported. If this applies to a later version, please re-open and update the version.