From 5621a3b03995903d4be2779b21e93284b5c1c101 Mon Sep 17 00:00:00 2001 From: Sarah Lorenzini Date: Wed, 18 Sep 2013 17:46:49 +0200 Subject: [PATCH] // update tabs stats --- modules/statsforecast/statsforecast.php | 568 +++++++++++++++--------- modules/statslive/statslive.php | 105 +++-- modules/statsvisits/statsvisits.php | 48 +- 3 files changed, 446 insertions(+), 275 deletions(-) diff --git a/modules/statsforecast/statsforecast.php b/modules/statsforecast/statsforecast.php index ddd93c921..e0a24a271 100644 --- a/modules/statsforecast/statsforecast.php +++ b/modules/statsforecast/statsforecast.php @@ -123,30 +123,38 @@ class StatsForecast extends Module $dataTable[$row['fix_date']] = $row; $this->_html .= '
-
-

'.$this->displayName.'

-

'.$this->l('All amounts listed do not include tax.').'

-
- - '.$this->l('Mode:').' +
'.$this->displayName.'
+
'.$this->l('All amounts listed do not include tax.').'
+ +
+ +
+ + +
+
- - - - - - - - - - - '; +
'.$this->l('Visits').''.$this->l('Reg.').''.$this->l('orders').''.$this->l('Items').''.$this->l('% Reg.').''.$this->l('% Orders').''.$this->l('Sales').'
+ + + + + + + + + + + + '; $visitArray = array(); $sql = 'SELECT '.$dateFromGAdd.' as fix_date, COUNT(*) as visits @@ -193,47 +201,46 @@ class StatsForecast extends Module $this->_html .= ' - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + -
'.$this->l('Visits').''.$this->l('Reg.').''.$this->l('orders').''.$this->l('Items').''.$this->l('% Reg.').''.$this->l('% Orders').''.$this->l('Sales').'
'.$this->l('Visits').''.$this->l('Reg.').''.$this->l('orders').''.$this->l('Items').''.$this->l('% Reg.').''.$this->l('% Orders').''.$this->l('Sales').''.$this->l('Visits').''.$this->l('Reg.').''.$this->l('orders').''.$this->l('Items').''.$this->l('% Reg.').''.$this->l('% Orders').''.$this->l('Sales').'
'.$this->l('Total').''.(int)($this->t1).''.(int)($this->t2).''.(int)($this->t3).''.(int)($this->t4).'----'.Tools::displayPrice($this->t8, $currency).''.$this->l('Total').''.(int)($this->t1).''.(int)($this->t2).''.(int)($this->t3).''.(int)($this->t4).'----'.Tools::displayPrice($this->t8, $currency).'
'.$this->l('Average').''.(int)($this->t1 / $intervalAvg).''.(int)($this->t2 / $intervalAvg).''.(int)($this->t3 / $intervalAvg).''.(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).''.$this->l('Average').''.(int)($this->t1 / $intervalAvg).''.(int)($this->t2 / $intervalAvg).''.(int)($this->t3 / $intervalAvg).''.(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).'
'.$this->l('Forecast').''.(int)($this->t1 * $prop30).''.(int)($this->t2 * $prop30).''.(int)($this->t3 * $prop30).''.(int)($this->t4 * $prop30).'----'.Tools::displayPrice($this->t8 * $prop30, $currency).''.$this->l('Forecast').''.(int)($this->t1 * $prop30).''.(int)($this->t2 * $prop30).''.(int)($this->t3 * $prop30).''.(int)($this->t4 * $prop30).'----'.Tools::displayPrice($this->t8 * $prop30, $currency).'
-
'; + '; $ca = $this->getRealCA(); @@ -277,50 +284,94 @@ class StatsForecast extends Module .Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o'); $orders = Db::getInstance()->getValue($sql); - $this->_html .= '
-

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

-
- -
- '.$this->l('Visitors').'
'.$visitors.'
- -
'.round(100 * $customers / max(1, $visitors)).' %
-
'.round(100 * $carts / max(1, $visitors)).' % -
- - '.$this->l('Accounts').'
'.$customers.'
- '.$this->l('Carts').'
'.$carts.' -
- -
'.round(100 * $fullcarts / max(1, $customers)).' %
-
'.round(100 * $fullcarts / max(1, $carts)).' %
-
- '.$this->l('Full carts').'
'.$fullcarts.'
-
'.round(100 * $orders / max(1, $fullcarts)).' %
- '.$this->l('orders').'
'.$orders.'
-
- -
-
- '.$this->l('Registered visitors').' - - '.round(100 * $orders / max(1, $customers), 2).' % - - '.$this->l('orders').' -
-
-
- '.$this->l('Visitors').' - - '.round(100 * $orders / max(1, $visitors), 2).' % - - '.$this->l('orders').' -
-
-

- '.$this->l('Turn your visitors into money:').' -
'.$this->l('Each visitor yields').' '.Tools::displayPrice($ca['ventil']['total'] / max(1, $visitors), $currency).'. -
'.$this->l('Each registered visitor yields').' '.Tools::displayPrice($ca['ventil']['total'] / max(1, $customers), $currency).'. + $this->_html .= ' +

+

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

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

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

+

'.$visitors.'

+
+

+

'.round(100 * $customers / max(1, $visitors)).' %

+
+

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

+

'.$customers.'

+
+

+

'.round(100 * $fullcarts / max(1, $customers)).' %

+
+

'.$this->l('Full carts').'

+

'.$fullcarts.'

+
+

+

'.round(100 * $orders / max(1, $fullcarts)).' %

+
+

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

+

'.$orders.'

+
+

'.$this->l('Registered visitors').'

+
+ + +

'.round(100 * $orders / max(1, $customers), 2).' %

+
+ + +

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

+
+

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

+
+ + +

'.round(100 * $orders / max(1, $visitors), 2).' %

+
+ + +

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

+
+

+

'.round(100 * $carts / max(1, $visitors)).' %

+
+

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

+

'.$carts.'

+
+

+

'.round(100 * $fullcarts / max(1, $carts)).' %

+
+
+
+

'.$this->l('Turn your visitors into money:').'

+

'.$this->l('Each visitor yields').' '.Tools::displayPrice($ca['ventil']['total'] / max(1, $visitors), $currency).'.

+

'.$this->l('Each registered visitor yields').' '.Tools::displayPrice($ca['ventil']['total'] / max(1, $customers), $currency).'.

'; @@ -330,130 +381,211 @@ class StatsForecast extends Module $prop5000 = 5000 / 30 * $interval; $this->_html .= ' -
'; - $this->_html .= ' -
-

'.$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.').'

-
- - '.$this->l('Zone:').' -
- - '; - foreach ($ca['payment'] as $payment) +
+

'.$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.').' +
+
+
+ +
+ + +
+
+ +
'.$this->l('Module').''.$this->l('Count').''.$this->l('Total').''.$this->l('Cart').'
+ + + + + + + + + '; + foreach ($ca['payment'] as $payment) + $this->_html .= ' + + + + + + '; + $this->_html .= ' + +
'.$this->l('Module').''.$this->l('Count').''.$this->l('Total').''.$this->l('Cart').'
'.$payment['payment_method'].''.(int)$payment['nb'].''.Tools::displayPrice($payment['total'], $currency).''.Tools::displayPrice($payment['cart'], $currency).'
+
+
+

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

+
+
+ +
+ + +
+
+
+ + + + + + + + + + + + '; + foreach ($ca['cat'] as $catrow) + $this->_html .= ' + + + + + + + + '; + $this->_html .= ' + +
'.$this->l('Category').''.$this->l('Count').''.$this->l('Sales').''.$this->l('% Count').''.$this->l('% Sales').''.$this->l('Avgerage price').'
'.(empty($catrow['name']) ? $this->l('Unknown') : $catrow['name']).''.$catrow['orderQty'].''.Tools::displayPrice($catrow['orderSum'], $currency).''.number_format((100 * $catrow['orderQty'] / $this->t4), 1, '.', ' ').'%'.((int)$ca['ventil']['total'] ? number_format((100 * $catrow['orderSum'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%'.Tools::displayPrice($catrow['priveAvg'], $currency).'
+
+
+

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

+ + + + + + + + + + '; + foreach ($ca['lang'] as $ophone => $amount) + { + $percent = (int)($ca['langprev'][$ophone]) ? number_format((100 * $amount / $ca['langprev'][$ophone]) - 100, 1, '.', ' ') : '∞'; + $this->_html .= ' + + + + + + + '; + } + $this->_html .= ' + +
'.$this->l('customers').''.$this->l('Sales').''.$this->l('%').''.$this->l('Growth').'
'.$ophone.''.Tools::displayPrice($amount, $currency).''.((int)$ca['ventil']['total'] ? number_format((100 * $amount / $ca['ventil']['total']), 1, '.', ' ').'%' : '-').''.(($percent > 0 OR $percent == '∞') ? '' : ' ').''.(($percent > 0 OR $percent == '∞') ? '+' : '').$percent.'%
+
+
+

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

+ + + + + + + + + + + '; + foreach ($ca['zones'] as $zone) $this->_html .= ' - - - - + + + + + '; $this->_html .= ' -
'.$this->l('Zone').''.$this->l('Count').''.$this->l('Total').''.$this->l('% Count').''.$this->l('% Sales').'
'.$payment['payment_method'].''.(int)$payment['nb'].''.Tools::displayPrice($payment['total'], $currency).''.Tools::displayPrice($payment['cart'], $currency).''.(isset($zone['name']) ? $zone['name'] : $this->l('Undefined')).''.(int)($zone['nb']).''.Tools::displayPrice($zone['total'], $currency).''.($ca['ventil']['nb'] ? number_format((100 * $zone['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'%'.((int)$ca['ventil']['total'] ? number_format((100 * $zone['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%
-
-
-

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

-
- - '.$this->l('Zone:').' -
- - '; - foreach ($ca['cat'] as $catrow) + +
'.$this->l('Category').''.$this->l('Count').''.$this->l('Sales').''.$this->l('% Count').''.$this->l('% Sales').''.$this->l('Avgerage price').'
+
+
+

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

+
+
+ +
+ + +
+
+
+ + + + + + + + + + + '; + foreach ($ca['currencies'] as $currencyRow) + $this->_html .= ' + + + + + + + '; $this->_html .= ' - - - - - - - - '; - $this->_html .= ' -
'.$this->l('Currency').''.$this->l('Count').''.$this->l('Sales (converted)').''.$this->l('% Count').''.$this->l('% Sales').'
'.$currencyRow['name'].''.(int)($currencyRow['nb']).''.Tools::displayPrice($currencyRow['total'], $currency).''.($ca['ventil']['nb'] ? number_format((100 * $currencyRow['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'%'.((int)$ca['ventil']['total'] ? number_format((100 * $currencyRow['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%
'.(empty($catrow['name']) ? $this->l('Unknown') : $catrow['name']).''.$catrow['orderQty'].''.Tools::displayPrice($catrow['orderSum'], $currency).''.number_format((100 * $catrow['orderQty'] / $this->t4), 1, '.', ' ').'%'.((int)$ca['ventil']['total'] ? number_format((100 * $catrow['orderSum'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%'.Tools::displayPrice($catrow['priveAvg'], $currency).'
-
-
-

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

- - '; - foreach ($ca['lang'] as $ophone => $amount) - { - $percent = (int)($ca['langprev'][$ophone]) ? number_format((100 * $amount / $ca['langprev'][$ophone]) - 100, 1, '.', ' ') : '∞'; - $this->_html .= ' - - - - - - - '; - } - $this->_html .= ' -
'.$this->l('customers').''.$this->l('Sales').''.$this->l('%').''.$this->l('Growth').'
'.$ophone.''.Tools::displayPrice($amount, $currency).''.((int)$ca['ventil']['total'] ? number_format((100 * $amount / $ca['ventil']['total']), 1, '.', ' ').'%' : '-').''.(($percent > 0 OR $percent == '∞') ? '' : ' ').''.(($percent > 0 OR $percent == '∞') ? '+' : '').$percent.'%
-
-
-

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

- - '; - foreach ($ca['zones'] as $zone) - $this->_html .= ' - - - - - - - '; - $this->_html .= ' -
'.$this->l('Zone').''.$this->l('Count').''.$this->l('Total').''.$this->l('% Count').''.$this->l('% Sales').'
'.(isset($zone['name']) ? $zone['name'] : $this->l('Undefined')).''.(int)($zone['nb']).''.Tools::displayPrice($zone['total'], $currency).''.($ca['ventil']['nb'] ? number_format((100 * $zone['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'%'.((int)$ca['ventil']['total'] ? number_format((100 * $zone['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%
-
-
-

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

-
- - '.$this->l('Zone:').' -
- - '; - foreach ($ca['currencies'] as $currencyRow) + +
'.$this->l('Currency').''.$this->l('Count').''.$this->l('Sales (converted)').''.$this->l('% Count').''.$this->l('% Sales').'
+
+
+

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

+ + + + + + + + + '; + foreach ($ca['attributes'] as $attribut) + $this->_html .= ' + + + + + '; $this->_html .= ' - - - - - - - '; - $this->_html .= ' -
'.$this->l('Group').''.$this->l('Attribute').''.$this->l('Count').'
'.$attribut['gname'].''.$attribut['aname'].''.(int)($attribut['total']).'
'.$currencyRow['name'].''.(int)($currencyRow['nb']).''.Tools::displayPrice($currencyRow['total'], $currency).''.($ca['ventil']['nb'] ? number_format((100 * $currencyRow['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'%'.((int)$ca['ventil']['total'] ? number_format((100 * $currencyRow['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%
-
-
-

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

- - '; - foreach ($ca['attributes'] as $attribut) - $this->_html .= ' - - - - - '; - $this->_html .= '
'.$this->l('Group').''.$this->l('Attribute').''.$this->l('Count').'
'.$attribut['gname'].''.$attribut['aname'].''.(int)($attribut['total']).'
-
-
'; + + +
'; return $this->_html; } diff --git a/modules/statslive/statslive.php b/modules/statslive/statslive.php index efc222eb5..a4a2e698b 100644 --- a/modules/statslive/statslive.php +++ b/modules/statslive/statslive.php @@ -144,60 +144,81 @@ class StatsLive extends Module $("#calendar").remove(); '; if (!Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS')) - $this->html .= '
'. - $this->l('You must activate the option "pages viewed for each customer" in the "Stats data-mining" module in order to see the pages viewed by your customers.').' -
'; + $this->html .= ' +
'. + $this->l('You must activate the option "pages viewed for each customer" in the "Stats data-mining" module in order to see the pages viewed by your customers.').' +
'; $this->html .= ' -
'.$this->l('Customers online').''; +

'.$this->l('Customers online').'

'; if ($totalCustomers) { $this->html .= $this->l('Total:').' '.(int)$totalCustomers.' - - '; - foreach ($customers as $customer) +
'.$this->l('ID').''.$this->l('Name').''.$this->l('Current Page').''.$this->l('View').'
+ + + + + + + + + '; + foreach ($customers as $customer) + $this->html .= ' + + + + + + '; $this->html .= ' - - - - - - '; - $this->html .= '
'.$this->l('ID').''.$this->l('Name').''.$this->l('Current Page').''.$this->l('View').'
'.$customer['id_customer'].''.$customer['firstname'].' '.$customer['lastname'].''.$customer['page'].' + + + +
'.$customer['id_customer'].''.$customer['firstname'].' '.$customer['lastname'].''.$customer['page'].' - - - -
'; + + '; } else - $this->html .= $this->l('Currently, there are no customers online.'); - $this->html .= '
-
-
'.$this->l('Visitors online').''; + $this->html .= '

'.$this->l('Currently, there are no customers online.').'

+

'.$this->l('Visitors online').'

'; if ($totalVisitors) { $this->html .= $this->l('Total:').' '.(int)($totalVisitors).' -
- - '; - foreach ($visitors as $visitor) - $this->html .= ' - - - - - - '; - $this->html .= '
'.$this->l('Guest').''.$this->l('IP').''.$this->l('Since').''.$this->l('Current page').''.$this->l('Referrer').'
'.$visitor['id_guest'].''.long2ip($visitor['ip_address']).''.substr($visitor['date_add'], 11).''.(isset($visitor['page']) ? $visitor['page'] : $this->l('Undefined')).''.(empty($visitor['http_referer']) ? $this->l('None') : parse_url($visitor['http_referer'], PHP_URL_HOST)).'
'; +
+ + + + + + + + + + + '; + foreach ($visitors as $visitor) + $this->html .= ' + + + + + + '; + $this->html .= ' + +
'.$this->l('Guest').''.$this->l('IP').''.$this->l('Since').''.$this->l('Current page').''.$this->l('Referrer').'
'.$visitor['id_guest'].''.long2ip($visitor['ip_address']).''.substr($visitor['date_add'], 11).''.(isset($visitor['page']) ? $visitor['page'] : $this->l('Undefined')).''.(empty($visitor['http_referer']) ? $this->l('None') : parse_url($visitor['http_referer'], PHP_URL_HOST)).'
+
'; } else - $this->html .= $this->l('There are no visitors online.'); - $this->html .= '
-
-
'.$this->l('Notice').' - '.$this->l('Maintenance IP(s) are excluded from the online visitors.').'
- '.$this->l('Add or remove an IP address.').' -
'; + $this->html .= '

'.$this->l('There are no visitors online.').'

+

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

+

'.$this->l('Maintenance IP(s) are excluded from the online visitors.').'

+ + '.$this->l('Add or remove an IP address.').' + + '; return $this->html; } diff --git a/modules/statsvisits/statsvisits.php b/modules/statsvisits/statsvisits.php index c9f7d244f..caaa34156 100644 --- a/modules/statsvisits/statsvisits.php +++ b/modules/statsvisits/statsvisits.php @@ -84,26 +84,44 @@ class StatsVisits extends ModuleGraph if (Tools::getValue('export')) $this->csvExport(array('layers' => 2, 'type' => 'line', 'option' => 3)); $this->html = ' -

'.$this->displayName.'

-

- '.$this->l('A visit corresponds to an internet user coming to your shop, and until the end of their session, only one visit is counted.').' - '.$this->l('A visitor is an unknown person who has not registered or logged into your store. A visitor can also be considered a person who has visited your shop multiple times.').' -

-
-

'.$this->l('Total visits:').' '.$totalVisits.'

-

'.$this->l('Total visitors:').' '.$totalGuests.'

- '.($totalVisits ? $this->engine($graphParams).'

'.$this->l('CSV Export').'

' : '').' +
+ '.$this->displayName.'
-
-

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

-

'.$this->l('Determine the interest of a visit.').'

- '.$this->l('The visitors\' evolution graph strongly resembles the visits\' graph, but provides additional information:').'
+

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

+
+

'.$this->l('Determine the interest of a visit.').'

+

+ '.$this->l('The visitors\' evolution graph strongly resembles the visits\' graph, but provides additional information:').'
+

  • '.$this->l('If this is the case, congratulations, your website is well planned and pleasing. Glad to see that you\'ve been paying attention.').'
  • '.$this->l('Otherwise, the conclusion is not so simple. The problem can be aesthetic or ergonomic. It is also possible that many visitors have mistakenly visited your URL without possessing a particular interest in your shop. This strange and ever-confusing phenomenon is most likely cause by search engines. If this is the case, you should consider revising your SEO structure.').'
- '.$this->l('This information is mostly qualitative. It is up to you to determine the interest of a disjointed visit.').'
-
'; +

+ '.$this->l('This information is mostly qualitative. It is up to you to determine the interest of a disjointed visit.').' +

+
+
+ '.$this->l('A visit corresponds to an internet user coming to your shop, and until the end of their session, only one visit is counted.').' + '.$this->l('A visitor is an unknown person who has not registered or logged into your store. A visitor can also be considered a person who has visited your shop multiple times.').' +
+
+
+
+ '.($totalVisits ? $this->engine($graphParams).' +
+
+
    +
  • '.$this->l('Total visits:').' '.$totalVisits.'
  • +
  • '.$this->l('Total visitors:').' '.$totalGuests.'
  • +
+
+ + '.$this->l('CSV Export').' + ' : '').' +
+
+
'; return $this->html; }