Products now get sorted in alphabetical name order in most (all?) views
This commit is contained in:
parent
9db001a635
commit
62b8c853f5
@ -105,6 +105,7 @@ class Inventory {
|
||||
foreach($this->seen_products as $prodid) {
|
||||
$out[] = new Product($prodid);
|
||||
}
|
||||
usort($out, ['Product', 'compare']);
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -146,6 +147,7 @@ class Inventory {
|
||||
$out[] = $product;
|
||||
}
|
||||
}
|
||||
usort($out, ['Product', 'compare']);
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
@ -133,6 +133,8 @@ abstract class Page extends Responder {
|
||||
}
|
||||
|
||||
final protected function build_product_table($products) {
|
||||
usort($products, ['Product', 'compare']);
|
||||
|
||||
$rows = '';
|
||||
foreach($products as $product) {
|
||||
$rows .= $this->build_product_row($product);
|
||||
@ -305,6 +307,7 @@ abstract class Page extends Responder {
|
||||
$unseen[] = $product;
|
||||
}
|
||||
}
|
||||
usort($unseen, ['Product', 'compare']);
|
||||
} else {
|
||||
$unseen = $inventory->get_unseen_products();
|
||||
$total_count = count($unseen) + count($seen);
|
||||
|
@ -42,6 +42,11 @@ class Product extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public static function sort($prod1, $prod2) {
|
||||
return strcmp(strtolower($prod1->get_name()),
|
||||
strtolower($prod2->get_name()));
|
||||
}
|
||||
|
||||
public function __construct($clue, $type = 'id') {
|
||||
parent::__construct();
|
||||
$search = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user