diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 206552a6a..6ca676e30 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -167,6 +167,7 @@ class AdminCustomersControllerCore extends AdminController 'date_add' => array( 'title' => $this->l('Registration'), 'type' => 'date', + 'filter_key' => 'a!date_add', 'align' => 'text-right' ), 'connect' => array( @@ -216,12 +217,6 @@ class AdminCustomersControllerCore extends AdminController $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); } - if (Tools::getValue('frequent_customers')) { - $this->context->cookie->{'customerscustomerFilter_total_orders'} = json_encode(array(Configuration::get('PS_KPI_FREQUENT_CUSTOMER_NB_ORDERS'), '')); - $this->context->cookie->{'customerscustomerFilter_o!date_add'} = json_encode(array(date('Y-m-d', strtotime('-365 day')), date('Y-m-d'))); - $this->redirect_after = $this->context->link->getAdminLink('AdminCustomers'); - } - parent::postProcess(); } @@ -702,7 +697,7 @@ class AdminCustomersControllerCore extends AdminController $helper->color = 'color2'; $helper->title = $this->l('Total Frequent Customers', null, null, false); $helper->subtitle = $this->l('1 year', null, null, false); - $helper->href = $this->context->link->getAdminLink('AdminCustomers').'&frequent_customers=1'; + $helper->href = $this->context->link->getAdminLink('AdminCustomers').'&submitFiltercustomer=1&customerFilter_total_orders%5B0%5D='.Configuration::get('PS_KPI_FREQUENT_CUSTOMER_NB_ORDERS').'&customerFilter_o%21date_add%5B0%5D='.date('Y-m-d', strtotime('-365 day')).'&customerFilter_o%21date_add%5B1%5D='.date('Y-m-d'); $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_frequent_customers'; $helper->tooltip = $this->l('The total number of frequent customers in given period of time.', null, null, false); $kpis[] = $helper; diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 33d50d0f8..84bf64435 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -1845,7 +1845,7 @@ class AdminStatsControllerCore extends AdminStatsTabController WHERE hbd.`id_order` = o.`id_order` LIMIT 1 ) AS id_hotel FROM `'._DB_PREFIX_.'orders` o - WHERE o.`valid` = 1 AND o.`invoice_date` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59" + WHERE o.`valid` = 1 AND o.`invoice_add` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59" GROUP BY o.`id_customer` HAVING 1 '.(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel) : '').' ) AS t