From e7b22ad8d46796ebb58bd659dc22192c12b1edb6 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 22 Apr 2013 11:57:36 +0200 Subject: [PATCH] // Fixed a few UI bugs in the stats --- .../template/controllers/stats/calendar.tpl | 2 +- .../template/controllers/stats/engines.tpl | 2 +- controllers/admin/AdminStatsTabController.php | 6 ++++ modules/gridhtml/gridhtml.php | 8 ++--- .../statsbestcustomers/statsbestcustomers.php | 29 ++++++++++++++----- 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/stats/calendar.tpl b/admin-dev/themes/default/template/controllers/stats/calendar.tpl index 1601b52c3..31e607224 100644 --- a/admin-dev/themes/default/template/controllers/stats/calendar.tpl +++ b/admin-dev/themes/default/template/controllers/stats/calendar.tpl @@ -25,7 +25,7 @@
-
+ diff --git a/admin-dev/themes/default/template/controllers/stats/engines.tpl b/admin-dev/themes/default/template/controllers/stats/engines.tpl index cb8370774..64e13c434 100644 --- a/admin-dev/themes/default/template/controllers/stats/engines.tpl +++ b/admin-dev/themes/default/template/controllers/stats/engines.tpl @@ -25,7 +25,7 @@
- +

{l s='Settings'}

diff --git a/controllers/admin/AdminStatsTabController.php b/controllers/admin/AdminStatsTabController.php index bbe657c9c..8f6895ba7 100644 --- a/controllers/admin/AdminStatsTabController.php +++ b/controllers/admin/AdminStatsTabController.php @@ -79,6 +79,12 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor $context->controller->addJqueryUI('ui.datepicker'); + if ($identifier === null && Tools::getValue('module')) + { + $identifier = 'module'; + $id = Tools::getValue('module'); + } + $tpl->assign(array( 'current' => self::$currentIndex, 'token' => $token, diff --git a/modules/gridhtml/gridhtml.php b/modules/gridhtml/gridhtml.php index f4d4e734d..af2709bc9 100644 --- a/modules/gridhtml/gridhtml.php +++ b/modules/gridhtml/gridhtml.php @@ -67,12 +67,8 @@ class GridHtml extends ModuleGridEngine foreach ($params['columns'] as $column) $html .= ' '.$column['header'].'
- - - - - - + + '; $html .= ' diff --git a/modules/statsbestcustomers/statsbestcustomers.php b/modules/statsbestcustomers/statsbestcustomers.php index 1464481b9..294a885a3 100644 --- a/modules/statsbestcustomers/statsbestcustomers.php +++ b/modules/statsbestcustomers/statsbestcustomers.php @@ -52,24 +52,26 @@ class StatsBestCustomers extends ModuleGrid $this->_emptyMessage = $this->l('Empty recordset returned'); $this->_pagingMessage = sprintf($this->l('Displaying %1$s of %2$s'), '{0} - {1}', '{2}'); + $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); + $this->_columns = array( array( 'id' => 'lastname', 'header' => $this->l('Last Name'), 'dataIndex' => 'lastname', - 'width' => 50 + 'width' => 80 ), array( 'id' => 'firstname', 'header' => $this->l('First Name'), 'dataIndex' => 'firstname', - 'width' => 50 + 'width' => 80 ), array( 'id' => 'email', 'header' => $this->l('Email'), 'dataIndex' => 'email', - 'width' => 120 + 'width' => 140 ), array( 'id' => 'totalVisits', @@ -78,10 +80,16 @@ class StatsBestCustomers extends ModuleGrid 'width' => 80, 'align' => 'right'), array( - 'id' => 'totalMoneySpent', - 'header' => $this->l('Money spent'), - 'dataIndex' => 'totalMoneySpent', + 'id' => 'totalValidOrders', + 'header' => $this->l('Valid orders'), + 'dataIndex' => 'totalValidOrders', 'width' => 80, + 'align' => 'right'), + array( + 'id' => 'totalMoneySpent', + 'header' => $this->l('Money spent').' ('.Tools::safeOutput($currency->iso_code).')', + 'dataIndex' => 'totalMoneySpent', + 'width' => 140, 'align' => 'right') ); @@ -142,7 +150,14 @@ class StatsBestCustomers extends ModuleGrid WHERE o.id_customer = c.id_customer AND o.invoice_date BETWEEN '.$this->getDate().' AND o.valid - ), 0) as totalMoneySpent + ), 0) as totalMoneySpent, + IFNULL(( + SELECT COUNT(*) + FROM `'._DB_PREFIX_.'orders` o + WHERE o.id_customer = c.id_customer + AND o.invoice_date BETWEEN '.$this->getDate().' + AND o.valid + ), 0) as totalValidOrders FROM `'._DB_PREFIX_.'customer` c LEFT JOIN `'._DB_PREFIX_.'guest` g ON c.`id_customer` = g.`id_customer` LEFT JOIN `'._DB_PREFIX_.'connections` co ON g.`id_guest` = co.`id_guest`