Added product active flag, saving filter in Product/Index

This commit is contained in:
Frank Schubert
2023-02-27 19:02:23 +01:00
parent 388e8ea164
commit 4be8e91508
7 changed files with 86 additions and 15 deletions

View File

@@ -75,6 +75,21 @@ class ProductModel {
}
public static function getActive() {
$items = [];
$db = FronkDB::singleton();
$res = $db->select("Product", "*", "active = 1 ORDER BY name,producttech_id");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new Product($data);
}
}
return $items;
}
public static function getFirst() {
$db = FronkDB::singleton();
@@ -162,6 +177,15 @@ class ProductModel {
}
}
if(array_key_exists("active", $filter)) {
$active = $filter['active'];
if($active) {
$where .= " AND Product.`active` = 1";
} else {
$where .= " AND Product.`active` = 0";
}
}
if(array_key_exists("productgroup_id", $filter)) {
$productgroup_id = $filter['productgroup_id'];
if(is_numeric($productgroup_id)) {