From 115adba9d84985d61fd9e2b05524e396d075c778 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 4 Jul 2024 17:22:48 +0530 Subject: [PATCH] improved the new customer KPI filter and bestselling KPIs --- .../admin/AdminCustomersController.php | 19 +------------------ controllers/admin/AdminStatsController.php | 1 + 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 1746db3a7..be5ad06ff 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -230,23 +230,6 @@ class AdminCustomersControllerCore extends AdminController )); } - $prefix = $this->getCookieFilterPrefix(); - if (Tools::getValue('filterOnlyNewCustomer')) { - if (($dateFrom = Tools::getValue('date_from')) - && ($dateTo = Tools::getValue('date_to')) - && strtotime($dateTo) >= strtotime($dateFrom) - ) { - $this->processResetFilters(); - $this->context->cookie->{'submitFilter'.$this->table} = true; - //Updating the date format of the filter dates to the desired format. - $dateFrom = date('Y-m-d', strtotime($dateFrom)); - $dateTo = date('Y-m-d', strtotime($dateTo)); - $this->context->cookie->{$prefix.$this->table.'Filter_date_add'} = json_encode(array($dateFrom, $dateTo)); - } - - $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); - } - if (!$this->can_add_customer && !$this->display) { $this->informations[] = $this->l('You have to select a shop if you want to create a customer.'); } @@ -758,7 +741,7 @@ class AdminCustomersControllerCore extends AdminController $nbDaysNewCustomers = Validate::isUnsignedInt(Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS')) ? Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS') : 30; $date_from = date('Y-m-d', strtotime('-'.$nbDaysNewCustomers.' day')); $date_to = date('Y-m-d'); - $helper->href = $this->context->link->getAdminLink('AdminCustomers').'&filterOnlyNewCustomer=1&date_from='.$date_from.'&date_to='.$date_to; + $helper->href = $this->context->link->getAdminLink('AdminCustomers').'&customerFilter_date_add[]='.$date_from.'&customerFilter_date_add[]='.$date_to; $helper->subtitle = sprintf($this->l('%d Days', null, null, false), (int) $nbDaysNewCustomers); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_new_customers'; $helper->tooltip = $this->l('The total number of new customers who registered in given period of time.', null, null, false); diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index ce7df4d7d..b2ef1e69b 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -585,6 +585,7 @@ class AdminStatsControllerCore extends AdminStatsTabController WHERE p.`active` = 1 AND p.`booking_product` = 1 '. (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hrt') : '').' GROUP By p.`id_product` + HAVING total_booked > 0 ORDER BY total_booked DESC'; return Db::getInstance()->getValue($sql);