Added product active flag, saving filter in Product/Index
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user