From 601bfa628be340ab93eee7dddd1c9b55cb23b155 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Wed, 7 Aug 2013 18:10:39 +0200 Subject: [PATCH 01/23] [-] FO :ProductSale::getBestSales() by modified date renders SQL error, thanks @SebSept --- classes/ProductSale.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/ProductSale.php b/classes/ProductSale.php index cc1922ef0..2f8166a4d 100644 --- a/classes/ProductSale.php +++ b/classes/ProductSale.php @@ -66,7 +66,10 @@ class ProductSaleCore if ($page_number < 0) $page_number = 0; if ($nb_products < 1) $nb_products = 10; $final_order_by = $order_by; + $order_table = ''; if (is_null($order_by) || $order_by == 'position' || $order_by == 'price') $order_by = 'sales'; + if ($order_by == 'date_add' || $order_by == 'date_upd') + $order_table = 'product_shop'; if (is_null($order_way) || $order_by == 'sales') $order_way = 'DESC'; $groups = FrontController::getCurrentCustomerGroups(); $sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1'); @@ -108,7 +111,7 @@ class ProductSaleCore WHERE cg.`id_group` '.$sql_groups.' ) GROUP BY product_shop.id_product - ORDER BY '.$prefix.'`'.pSQL($order_by).'` '.pSQL($order_way).' + ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).' LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); From 0550ad51350631c1710c880e447eaf9283359a6f Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 8 Aug 2013 09:29:13 +0200 Subject: [PATCH 02/23] // Fixed smarty parse error on live edit --- themes/live_edit.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/live_edit.tpl b/themes/live_edit.tpl index 52f28163b..fe6497ede 100644 --- a/themes/live_edit.tpl +++ b/themes/live_edit.tpl @@ -24,11 +24,11 @@ *}