Added more filtering to Preorder/Index
This commit is contained in:
@@ -90,11 +90,25 @@ class ProductModel {
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst() {
|
||||
public static function getFirst($filter = false) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
//var_dump($db);exit;
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("Product", "*", "$where ORDER BY producttech_id, name LIMIT 1");
|
||||
|
||||
$sql = "SELECT Product.* FROM `Product`
|
||||
LEFT JOIN Productgroup ON (Productgroup.id = Product.id)
|
||||
LEFT JOIN ProductAttribute ON (ProductAttribute.product_id = Product.id)
|
||||
LEFT JOIN Producttech ON (Product.producttech_id = Producttech.id)
|
||||
LEFT JOIN ProducttechAttribute ON (ProducttechAttribute.producttech_id = Producttech.id)
|
||||
WHERE $where
|
||||
GROUP BY Product.id
|
||||
ORDER BY Productgroup.name,Producttech.name,Product.name LIMIT 1
|
||||
";
|
||||
|
||||
//$res = $db->select("Product", "*", "$where ORDER BY producttech_id, name LIMIT 1");
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
$res = $db->query($sql);
|
||||
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Product($data);
|
||||
@@ -107,7 +121,7 @@ class ProductModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function count($filter) {
|
||||
public static function count($filter = false) {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
|
||||
Reference in New Issue
Block a user