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`