Sort products by reference
This commit is contained in:
parent
425f88082f
commit
828aa9bd93
@ -46,6 +46,10 @@ if ($action=="getProducts") {
|
|||||||
$object = new Categorie($db);
|
$object = new Categorie($db);
|
||||||
$result=$object->fetch($category);
|
$result=$object->fetch($category);
|
||||||
$prods = $object->getObjectsInCateg("product");
|
$prods = $object->getObjectsInCateg("product");
|
||||||
|
function sort_by_ref($a, $b) {
|
||||||
|
return strcmp($a->ref, $b->ref);
|
||||||
|
}
|
||||||
|
usort($prods, "sort_by_ref");
|
||||||
echo json_encode($prods);
|
echo json_encode($prods);
|
||||||
}
|
}
|
||||||
elseif ($action=="search" && $term != '') {
|
elseif ($action=="search" && $term != '') {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user