Zaktualizuj zapytania SQL w metodzie get_products w klasie Products, aby sortować wyniki według id w kolejności malejącej.

This commit is contained in:
2025-08-09 13:55:01 +02:00
parent 522db8d363
commit c9f2f66457
2 changed files with 4 additions and 4 deletions

View File

@@ -41,8 +41,8 @@
},
"class.Products.php": {
"type": "-",
"size": 9057,
"lmtime": 1747343773735,
"size": 9191,
"lmtime": 1751638170223,
"modified": false
},
"class.Site.php": {

View File

@@ -25,9 +25,9 @@ class Products
global $mdb;
if ( $search )
return $mdb -> query( 'SELECT pt.*, p.offer_id, p.min_roas FROM products_temp AS pt INNER JOIN products AS p ON p.id = pt.product_id WHERE client_id = \'' . $client_id . '\' AND ( pt.name LIKE \'%' . $search . '%\' OR offer_id = ' . (int)$search . ' ) ORDER BY ' . $order_name . ' ' . $order_dir . ' LIMIT ' . $start . ', ' . $limit ) -> fetchAll();
return $mdb -> query( 'SELECT pt.*, p.offer_id, p.min_roas FROM products_temp AS pt INNER JOIN products AS p ON p.id = pt.product_id WHERE client_id = \'' . $client_id . '\' AND ( pt.name LIKE \'%' . $search . '%\' OR offer_id = ' . (int)$search . ' ) ORDER BY ' . $order_name . ' ' . $order_dir . ', id DESC LIMIT ' . $start . ', ' . $limit ) -> fetchAll();
else
return $mdb -> query( 'SELECT pt.*, p.offer_id, p.min_roas FROM products_temp AS pt INNER JOIN products AS p ON p.id = pt.product_id WHERE client_id = \'' . $client_id . '\' ORDER BY ' . $order_name . ' ' . $order_dir . ' LIMIT ' . $start . ', ' . $limit ) -> fetchAll();
return $mdb -> query( 'SELECT pt.*, p.offer_id, p.min_roas FROM products_temp AS pt INNER JOIN products AS p ON p.id = pt.product_id WHERE client_id = \'' . $client_id . '\' ORDER BY ' . $order_name . ' ' . $order_dir . ', id DESC LIMIT ' . $start . ', ' . $limit ) -> fetchAll();
}
static public function get_records_total_products( $client_id, $search )