// Fixed a few UI bugs in the stats

This commit is contained in:
Damien Metzger
2013-04-22 11:57:36 +02:00
parent fd46c87786
commit 141772725b
5 changed files with 32 additions and 15 deletions

View File

@@ -25,7 +25,7 @@
<div id="statsContainer">
<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="submitDateMonth" class="button submitDateMonth" value="{$translations.Month}">
<input type="submit" name="submitDateYear" class="button submitDateYear" value="{$translations.Year}">

View File

@@ -25,7 +25,7 @@
<br/>
<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>
<div class="rowForm">

View File

@@ -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,

View File

@@ -67,12 +67,8 @@ class GridHtml extends ModuleGridEngine
foreach ($params['columns'] as $column)
$html .= '<th style="width:'.$column['width'].'px;cursor:pointer">
'.$column['header'].'<br />
<a href="javascript:getGridData(\''.$grider.'&sort='.$column['dataIndex'].'&dir=ASC\');">
<img src="../img/admin/up.gif" />
</a>
<a href="javascript:getGridData(\''.$grider.'&sort='.$column['dataIndex'].'&dir=DESC\');">
<img src="../img/admin/down.gif" />
</a>
<a href="javascript:getGridData(\''.$grider.'&sort='.$column['dataIndex'].'&dir=ASC\');"><img src="../img/admin/up.gif" /></a>
<a href="javascript:getGridData(\''.$grider.'&sort='.$column['dataIndex'].'&dir=DESC\');"><img src="../img/admin/down.gif" /></a>
</th>';
$html .= '</tr></thead>
<tbody></tbody>

View File

@@ -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`