Fixed: Sort by price in module catelog page
This commit is contained in:
@@ -256,15 +256,23 @@ class AdminModulesCatalogControllerCore extends AdminController
|
||||
if ($criteria == 'name') {
|
||||
return strnatcasecmp($a->displayName, $b->displayName);
|
||||
} else if ($criteria == 'price_increasing') {
|
||||
if (isset($a->price) && isset($b->price))
|
||||
return $a->price > $b->price;
|
||||
else if (isset($b->price) && $b->price)
|
||||
return true;
|
||||
$priceA = $priceB = 0;
|
||||
if (isset($a->price)) {
|
||||
$priceA = $a->price;
|
||||
}
|
||||
if (isset($b->price)) {
|
||||
$priceB = $b->price;
|
||||
}
|
||||
return $priceA > $priceB;
|
||||
} else if ($criteria == 'price_decreasing') {
|
||||
if (isset($a->price) && isset($b->price))
|
||||
return $a->price < $b->price;
|
||||
else if (isset($b->price) && $b->price)
|
||||
return true;
|
||||
$priceA = $priceB = 0;
|
||||
if (isset($a->price)) {
|
||||
$priceA = $a->price;
|
||||
}
|
||||
if (isset($b->price)) {
|
||||
$priceB = $b->price;
|
||||
}
|
||||
return $priceA < $priceB;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user