// Fixed a few UI bugs in the stats

This commit is contained in:
Damien Metzger committed 2013-04-22 11:57:36 +02:00
1 parent 6b8c3d8612
commit e7b22ad8d4
5 files changed
+32 -15

No files matched your search

@@ -25,7 +25,7 @@
<div id="statsContainer"> <div id="statsContainer">
<div id="calendar"> <div id="calendar">
<form action="{$current}&token={$token}{if $action && $table}&{$action}{$table}{/if}{if $identifier && $id}&{$identifier}={$id}{/if}" method="post" id="calendar_form" name="calendar_form"> <form action="{$current}&token={$token}{if $action && $table}&{$action|escape}{$table|escape}{/if}{if $identifier && $id}&{$identifier|escape}={$id|escape}{/if}" method="post" id="calendar_form" name="calendar_form">
<input type="submit" name="submitDateDay" class="button submitDateDay" value="{$translations.Day}"> <input type="submit" name="submitDateDay" class="button submitDateDay" value="{$translations.Day}">
<input type="submit" name="submitDateMonth" class="button submitDateMonth" value="{$translations.Month}"> <input type="submit" name="submitDateMonth" class="button submitDateMonth" value="{$translations.Month}">
<input type="submit" name="submitDateYear" class="button submitDateYear" value="{$translations.Year}"> <input type="submit" name="submitDateYear" class="button submitDateYear" value="{$translations.Year}">
@@ -25,7 +25,7 @@
<br/> <br/>
<div class="blocEngine"> <div class="blocEngine">
<form action="{$current}&token={$token}" method="post" id="settings_form" name="settings_form"> <form action="{$smarty.server.REQUEST_URI|escape}" method="post" id="settings_form" name="settings_form">
<h3 class="icon-{l s='Settings'}">{l s='Settings'}</h3> <h3 class="icon-{l s='Settings'}">{l s='Settings'}</h3>
<div class="rowForm"> <div class="rowForm">
@@ -79,6 +79,12 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
$context->controller->addJqueryUI('ui.datepicker'); $context->controller->addJqueryUI('ui.datepicker');
if ($identifier === null && Tools::getValue('module'))
{
$identifier = 'module';
$id = Tools::getValue('module');
}
$tpl->assign(array( $tpl->assign(array(
'current' => self::$currentIndex, 'current' => self::$currentIndex,
'token' => $token, 'token' => $token,
+2 -6
View File
@@ -67,12 +67,8 @@ class GridHtml extends ModuleGridEngine
foreach ($params['columns'] as $column) foreach ($params['columns'] as $column)
$html .= '<th style="width:'.$column['width'].'px;cursor:pointer"> $html .= '<th style="width:'.$column['width'].'px;cursor:pointer">
'.$column['header'].'<br /> '.$column['header'].'<br />
<a href="javascript:getGridData(\''.$grider.'&sort='.$column['dataIndex'].'&dir=ASC\');"> <a href="javascript:getGridData(\''.$grider.'&sort='.$column['dataIndex'].'&dir=ASC\');"><img src="../img/admin/up.gif" /></a>
<img src="../img/admin/up.gif" /> <a href="javascript:getGridData(\''.$grider.'&sort='.$column['dataIndex'].'&dir=DESC\');"><img src="../img/admin/down.gif" /></a>
</a>
<a href="javascript:getGridData(\''.$grider.'&sort='.$column['dataIndex'].'&dir=DESC\');">
<img src="../img/admin/down.gif" />
</a>
</th>'; </th>';
$html .= '</tr></thead> $html .= '</tr></thead>
<tbody></tbody> <tbody></tbody>
@@ -52,24 +52,26 @@ class StatsBestCustomers extends ModuleGrid
$this->_emptyMessage = $this->l('Empty recordset returned'); $this->_emptyMessage = $this->l('Empty recordset returned');
$this->_pagingMessage = sprintf($this->l('Displaying %1$s of %2$s'), '{0} - {1}', '{2}'); $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( $this->_columns = array(
array( array(
'id' => 'lastname', 'id' => 'lastname',
'header' => $this->l('Last Name'), 'header' => $this->l('Last Name'),
'dataIndex' => 'lastname', 'dataIndex' => 'lastname',
'width' => 50 'width' => 80
), ),
array( array(
'id' => 'firstname', 'id' => 'firstname',
'header' => $this->l('First Name'), 'header' => $this->l('First Name'),
'dataIndex' => 'firstname', 'dataIndex' => 'firstname',
'width' => 50 'width' => 80
), ),
array( array(
'id' => 'email', 'id' => 'email',
'header' => $this->l('Email'), 'header' => $this->l('Email'),
'dataIndex' => 'email', 'dataIndex' => 'email',
'width' => 120 'width' => 140
), ),
array( array(
'id' => 'totalVisits', 'id' => 'totalVisits',
@@ -78,10 +80,16 @@ class StatsBestCustomers extends ModuleGrid
'width' => 80, 'width' => 80,
'align' => 'right'), 'align' => 'right'),
array( array(
'id' => 'totalMoneySpent', 'id' => 'totalValidOrders',
'header' => $this->l('Money spent'), 'header' => $this->l('Valid orders'),
'dataIndex' => 'totalMoneySpent', 'dataIndex' => 'totalValidOrders',
'width' => 80, 'width' => 80,
'align' => 'right'),
array(
'id' => 'totalMoneySpent',
'header' => $this->l('Money spent').' ('.Tools::safeOutput($currency->iso_code).')',
'dataIndex' => 'totalMoneySpent',
'width' => 140,
'align' => 'right') 'align' => 'right')
); );
@@ -142,7 +150,14 @@ class StatsBestCustomers extends ModuleGrid
WHERE o.id_customer = c.id_customer WHERE o.id_customer = c.id_customer
AND o.invoice_date BETWEEN '.$this->getDate().' AND o.invoice_date BETWEEN '.$this->getDate().'
AND o.valid 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 FROM `'._DB_PREFIX_.'customer` c
LEFT JOIN `'._DB_PREFIX_.'guest` g ON c.`id_customer` = g.`id_customer` 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` LEFT JOIN `'._DB_PREFIX_.'connections` co ON g.`id_guest` = co.`id_guest`