Sort products by reference

This commit is contained in:
David Beniamine 2019-11-29 15:59:25 +01:00
parent 425f88082f
commit 828aa9bd93
No known key found for this signature in database
GPG Key ID: DFC3C8C672850E10

View File

@ -46,6 +46,10 @@ if ($action=="getProducts") {
$object = new Categorie($db);
$result=$object->fetch($category);
$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);
}
elseif ($action=="search" && $term != '') {