From 93cbad2a0553ac18d2d26cc8d8a5155f1ce65f78 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 25 Nov 2013 14:29:49 +0100 Subject: [PATCH] [*] BO : replaced age by total spent in the customer list --- controllers/admin/AdminCustomersController.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 6cd78c84e..133cf38d6 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -60,8 +60,11 @@ class AdminCustomersControllerCore extends AdminController $titles_array[$gender->id_gender] = $gender->name; $this->_select = ' - a.date_add, gl.name as title, - IF (YEAR(`birthday`) = 0, "-", (YEAR(CURRENT_DATE)-YEAR(`birthday`)) - (RIGHT(CURRENT_DATE, 5) < RIGHT(birthday, 5))) AS `age`, ( + a.date_add, gl.name as title, ( + SELECT SUM(total_paid_tax_excl / conversion_rate) FROM '._DB_PREFIX_.'orders o + WHERE o.id_customer = a.id_customer + AND active = 1 + ) as total_spent, ( SELECT c.date_add FROM '._DB_PREFIX_.'guest g LEFT JOIN '._DB_PREFIX_.'connections c ON c.id_guest = g.id_guest WHERE g.id_customer = a.id_customer @@ -92,10 +95,12 @@ class AdminCustomersControllerCore extends AdminController 'email' => array( 'title' => $this->l('Email address') ), - 'age' => array( - 'title' => $this->l('Age'), + 'total_spent' => array( + 'title' => $this->l('Sales'), + 'type' => 'price', 'search' => false, - 'align' => 'center' + 'havingFilter' => true, + 'align' => 'right' ), 'active' => array( 'title' => $this->l('Enabled'),