From f06eb84d9ff10a852e7974f8d15890a0e939a2ba Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Tue, 29 Oct 2013 14:36:27 +0100 Subject: [PATCH] // Stats cleaning --- modules/gridhtml/gridhtml.php | 2 +- .../statsbestcategories.php | 12 ++- modules/statsforecast/statsforecast.php | 78 +++++++++---------- 3 files changed, 48 insertions(+), 44 deletions(-) diff --git a/modules/gridhtml/gridhtml.php b/modules/gridhtml/gridhtml.php index a8edcc25d..d7e6579d4 100644 --- a/modules/gridhtml/gridhtml.php +++ b/modules/gridhtml/gridhtml.php @@ -101,7 +101,7 @@ class GridHtml extends ModuleGridEngine $.each(values, function(index, row){ var newLine = "";'; foreach ($params['columns'] as $column) - $html .= ' newLine += "" + row["'.$column['dataIndex'].'"] + "";'; + $html .= ' newLine += "" + row["'.$column['dataIndex'].'"] + "";'; if (!isset($params['defaultSortColumn'])) $params['defaultSortColumn'] = false; if (!isset($params['defaultSortDirection'])) diff --git a/modules/statsbestcategories/statsbestcategories.php b/modules/statsbestcategories/statsbestcategories.php index 115c99163..25f2b20f2 100644 --- a/modules/statsbestcategories/statsbestcategories.php +++ b/modules/statsbestcategories/statsbestcategories.php @@ -57,7 +57,7 @@ class StatsBestCategories extends ModuleGrid 'id' => 'name', 'header' => $this->l('Name'), 'dataIndex' => 'name', - 'align' => 'center' + 'align' => 'left' ), array( 'id' => 'totalQuantitySold', @@ -69,7 +69,7 @@ class StatsBestCategories extends ModuleGrid 'id' => 'totalPriceSold', 'header' => $this->l('Total Price'), 'dataIndex' => 'totalPriceSold', - 'align' => 'center' + 'align' => 'right' ), array( 'id' => 'totalPageViewed', @@ -105,7 +105,7 @@ class StatsBestCategories extends ModuleGrid $this->_html = '
- '.$this->displayName.' + '.$this->displayName.'
'.$this->engine($engineParams).' @@ -116,6 +116,7 @@ class StatsBestCategories extends ModuleGrid public function getData() { + $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $dateBetween = $this->getDate(); $id_lang = $this->getLang(); @@ -197,7 +198,10 @@ class StatsBestCategories extends ModuleGrid } if (($this->_start === 0 || Validate::IsUnsignedInt($this->_start)) && Validate::IsUnsignedInt($this->_limit)) $this->_query .= ' LIMIT '.$this->_start.', '.($this->_limit); - $this->_values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query); + $values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query); + foreach ($values as &$value) + $value['totalPriceSold'] = Tools::displayPrice($value['totalPriceSold'], $currency); + $this->_values = $values; $this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()'); } } \ No newline at end of file diff --git a/modules/statsforecast/statsforecast.php b/modules/statsforecast/statsforecast.php index e0a24a271..477387ec5 100644 --- a/modules/statsforecast/statsforecast.php +++ b/modules/statsforecast/statsforecast.php @@ -123,34 +123,34 @@ class StatsForecast extends Module $dataTable[$row['fix_date']] = $row; $this->_html .= '
-
'.$this->displayName.'
+
'.$this->displayName.'
'.$this->l('All amounts listed do not include tax.').'
-
+
- + - + - + @@ -189,7 +189,7 @@ class StatsForecast extends Module - + '; $this->t1 += $visitsToday; @@ -203,10 +203,10 @@ class StatsForecast extends Module - + - + @@ -218,7 +218,7 @@ class StatsForecast extends Module - + @@ -228,7 +228,7 @@ class StatsForecast extends Module - + @@ -238,7 +238,7 @@ class StatsForecast extends Module - +
'.$this->l('Visits').''.$this->l('Reg.').''.$this->l('Registrations').' '.$this->l('orders').' '.$this->l('Items').''.$this->l('% Reg.').''.$this->l('% Registrations').' '.$this->l('% Orders').' '.$this->l('Sales').'
'.(int)($row['countProducts']).' '.($visitsToday ? round(100 * (int)($row['registrations']) / $visitsToday, 2).' %' : '-').' '.($visitsToday ? round(100 * (int)($row['countOrders']) / $visitsToday, 2).' %' : '-').''.Tools::displayPrice($row['totalSales'], $currency).''.Tools::displayPrice($row['totalSales'], $currency).'
'.$this->l('Visits').''.$this->l('Reg.').''.$this->l('Registrations').' '.$this->l('orders').' '.$this->l('Items').''.$this->l('% Reg.').''.$this->l('% Registrations').' '.$this->l('% Orders').' '.$this->l('Sales').'
'.(int)($this->t4).' -- --'.Tools::displayPrice($this->t8, $currency).''.Tools::displayPrice($this->t8, $currency).'
'.$this->l('Average').''.(int)($this->t4 / $intervalAvg).' '.($this->t1 ? round(100 * $this->t2 / $this->t1, 2) .' %' : '-').' '.($this->t1 ? round(100 * $this->t3 / $this->t1, 2) .' %' : '-').''.Tools::displayPrice($this->t8 / $intervalAvg, $currency).''.Tools::displayPrice($this->t8 / $intervalAvg, $currency).'
'.$this->l('Forecast').''.(int)($this->t4 * $prop30).' -- --'.Tools::displayPrice($this->t8 * $prop30, $currency).''.Tools::displayPrice($this->t8 * $prop30, $currency).'
'; @@ -286,7 +286,7 @@ class StatsForecast extends Module $this->_html .= '
-

'.$this->l('Conversion').'

+

'.$this->l('Conversion').'

@@ -382,7 +382,7 @@ class StatsForecast extends Module $this->_html .= '
-

'.$this->l('Payment distribution').'

+

'.$this->l('Payment distribution').'

' .$this->l('The amounts are with taxes, so you can get an estimation of the commission due to the payment method.').'
@@ -391,7 +391,7 @@ class StatsForecast extends Module -
+
- + - + '; @@ -417,21 +417,21 @@ class StatsForecast extends Module - - + + '; $this->_html .= '
'.$this->l('Module').''.$this->l('Count').''.$this->l('Transactions').' '.$this->l('Total').''.$this->l('Cart').''.$this->l('Average Cart Value').'
'.$payment['payment_method'].' '.(int)$payment['nb'].''.Tools::displayPrice($payment['total'], $currency).''.Tools::displayPrice($payment['cart'], $currency).''.Tools::displayPrice($payment['total'], $currency).''.Tools::displayPrice($payment['cart'], $currency).'
-

'.$this->l('Category distribution').'

+

'.$this->l('Category distribution').'

-
+