From c9f2f66457a88584792253eb6c7d6ea97cb990b0 Mon Sep 17 00:00:00 2001 From: Jacek Pyziak Date: Sat, 9 Aug 2025 13:55:01 +0200 Subject: [PATCH] =?UTF-8?q?Zaktualizuj=20zapytania=20SQL=20w=20metodzie=20?= =?UTF-8?q?get=5Fproducts=20w=20klasie=20Products,=20aby=20sortowa=C4=87?= =?UTF-8?q?=20wyniki=20wed=C5=82ug=20id=20w=20kolejno=C5=9Bci=20malej?= =?UTF-8?q?=C4=85cej.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/ftp-kr.sync.cache.json | 4 ++-- autoload/factory/class.Products.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.vscode/ftp-kr.sync.cache.json b/.vscode/ftp-kr.sync.cache.json index 1ef27dd..fb68005 100644 --- a/.vscode/ftp-kr.sync.cache.json +++ b/.vscode/ftp-kr.sync.cache.json @@ -41,8 +41,8 @@ }, "class.Products.php": { "type": "-", - "size": 9057, - "lmtime": 1747343773735, + "size": 9191, + "lmtime": 1751638170223, "modified": false }, "class.Site.php": { diff --git a/autoload/factory/class.Products.php b/autoload/factory/class.Products.php index ea861ca..5661023 100644 --- a/autoload/factory/class.Products.php +++ b/autoload/factory/class.Products.php @@ -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 )