// update tabs stats

This commit is contained in:
Sarah Lorenzini
2013-09-18 17:47:42 +02:00
parent 154658befd
commit 5621a3b039
3 changed files with 446 additions and 275 deletions
+350 -218
View File
@@ -123,30 +123,38 @@ class StatsForecast extends Module
$dataTable[$row['fix_date']] = $row;
$this->_html .= '<div>
<div class="blocStats">
<h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2>
<p>'.$this->l('All amounts listed do not include tax.').'</p>
<form id="granularity" action="'.Tools::safeOutput($ru).'#granularity" method="post">
<input type="hidden" name="submitGranularity" value="1" />
'.$this->l('Mode:').' <select name="stats_granularity" onchange="this.form.submit();" style="width:100px">
<option value="10">'.$this->l('Day').'</option>
<option value="42" '.($this->context->cookie->stats_granularity == '42' ? 'selected="selected"' : '').'>'.$this->l('Week').'</option>
<option value="7" '.($this->context->cookie->stats_granularity == '7' ? 'selected="selected"' : '').'>'.$this->l('Month').'</option>
<option value="4" '.($this->context->cookie->stats_granularity == '4' ? 'selected="selected"' : '').'>'.$this->l('Year').'</option>
</select>
<div class="panel-heading">'.$this->displayName.'</div>
<div class="alert alert-info">'.$this->l('All amounts listed do not include tax.').'</div>
<form id="granularity" action="'.Tools::safeOutput($ru).'#granularity" method="post" class="form-horizontal">
<div class="row row-margin-bottom">
<label class="control-label col-lg-3">
'.$this->l('Mode:').'
</label>
<div class="col-lg-6">
<input type="hidden" name="submitGranularity" value="1" />
<select name="stats_granularity" onchange="this.form.submit();">
<option value="10">'.$this->l('Day').'</option>
<option value="42" '.($this->context->cookie->stats_granularity == '42' ? 'selected="selected"' : '').'>'.$this->l('Week').'</option>
<option value="7" '.($this->context->cookie->stats_granularity == '7' ? 'selected="selected"' : '').'>'.$this->l('Month').'</option>
<option value="4" '.($this->context->cookie->stats_granularity == '4' ? 'selected="selected"' : '').'>'.$this->l('Year').'</option>
</select>
</div>
</div>
</form>
<table class="table" border="0" cellspacing="0" cellspacing="0">
<tr>
<th style="width:70px;text-align:center"></th>
<th style="text-align:center">'.$this->l('Visits').'</th>
<th style="text-align:center">'.$this->l('Reg.').'</th>
<th style="text-align:center">'.$this->l('orders').'</th>
<th style="text-align:center">'.$this->l('Items').'</th>
<th style="text-align:center">'.$this->l('% Reg.').'</th>
<th style="text-align:center">'.$this->l('% Orders').'</th>
<th style="width:100px;text-align:center">'.$this->l('Sales').'</th>
</tr>';
<table class="table">
<thead>
<tr>
<th></th>
<th class="center"><span class="title_box active">'.$this->l('Visits').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Reg.').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('orders').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Items').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('% Reg.').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('% Orders').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Sales').'</span></th>
</tr>
</thead>';
$visitArray = array();
$sql = 'SELECT '.$dateFromGAdd.' as fix_date, COUNT(*) as visits
@@ -193,47 +201,46 @@ class StatsForecast extends Module
$this->_html .= '
<tr>
<th style="width:70px;text-align:center"></th>
<th style="text-align:center">'.$this->l('Visits').'</th>
<th style="text-align:center">'.$this->l('Reg.').'</th>
<th style="text-align:center">'.$this->l('orders').'</th>
<th style="text-align:center">'.$this->l('Items').'</th>
<th style="text-align:center">'.$this->l('% Reg.').'</th>
<th style="text-align:center">'.$this->l('% Orders').'</th>
<th style="width:100px;text-align:center">'.$this->l('Sales').'</th>
<th></th>
<th class="center"><span class="title_box active">'.$this->l('Visits').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Reg.').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('orders').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Items').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('% Reg.').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('% Orders').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Sales').'</span></th>
</tr>
<tr>
<th>'.$this->l('Total').'</th>
<td style="font-weight: 700" align="center">'.(int)($this->t1).'</td>
<td style="font-weight: 700" align="center">'.(int)($this->t2).'</td>
<td style="font-weight: 700" align="center">'.(int)($this->t3).'</td>
<td style="font-weight: 700" align="center">'.(int)($this->t4).'</td>
<td style="font-weight: 700" align="center">--</td>
<td style="font-weight: 700" align="center">--</td>
<td style="font-weight: 700" align="right">'.Tools::displayPrice($this->t8, $currency).'</td>
<td>'.$this->l('Total').'</td>
<td class="center">'.(int)($this->t1).'</td>
<td class="center">'.(int)($this->t2).'</td>
<td class="center">'.(int)($this->t3).'</td>
<td class="center">'.(int)($this->t4).'</td>
<td class="center">--</td>
<td class="center">--</td>
<td class="center">'.Tools::displayPrice($this->t8, $currency).'</td>
</tr>
<tr>
<th>'.$this->l('Average').'</th>
<td style="font-weight: 700" align="center">'.(int)($this->t1 / $intervalAvg).'</td>
<td style="font-weight: 700" align="center">'.(int)($this->t2 / $intervalAvg).'</td>
<td style="font-weight: 700" align="center">'.(int)($this->t3 / $intervalAvg).'</td>
<td style="font-weight: 700" align="center">'.(int)($this->t4 / $intervalAvg).'</td>
<td style="font-weight: 700" align="center">'.($this->t1 ? round(100 * $this->t2 / $this->t1, 2) .' %' : '-').'</td>
<td style="font-weight: 700" align="center">'.($this->t1 ? round(100 * $this->t3 / $this->t1, 2) .' %' : '-').'</td>
<td style="font-weight: 700" align="right">'.Tools::displayPrice($this->t8 / $intervalAvg, $currency).'</td>
<td>'.$this->l('Average').'</td>
<td class="center">'.(int)($this->t1 / $intervalAvg).'</td>
<td class="center">'.(int)($this->t2 / $intervalAvg).'</td>
<td class="center">'.(int)($this->t3 / $intervalAvg).'</td>
<td class="center">'.(int)($this->t4 / $intervalAvg).'</td>
<td class="center">'.($this->t1 ? round(100 * $this->t2 / $this->t1, 2) .' %' : '-').'</td>
<td class="center">'.($this->t1 ? round(100 * $this->t3 / $this->t1, 2) .' %' : '-').'</td>
<td class="center">'.Tools::displayPrice($this->t8 / $intervalAvg, $currency).'</td>
</tr>
<tr>
<th>'.$this->l('Forecast').'</th>
<td style="font-weight: 700" align="center">'.(int)($this->t1 * $prop30).'</td>
<td style="font-weight: 700" align="center">'.(int)($this->t2 * $prop30).'</td>
<td style="font-weight: 700" align="center">'.(int)($this->t3 * $prop30).'</td>
<td style="font-weight: 700" align="center">'.(int)($this->t4 * $prop30).'</td>
<td style="font-weight: 700" align="center">--</td>
<td style="font-weight: 700" align="center">--</td>
<td style="font-weight: 700" align="right">'.Tools::displayPrice($this->t8 * $prop30, $currency).'</td>
<td>'.$this->l('Forecast').'</td>
<td class="center">'.(int)($this->t1 * $prop30).'</td>
<td class="center">'.(int)($this->t2 * $prop30).'</td>
<td class="center">'.(int)($this->t3 * $prop30).'</td>
<td class="center">'.(int)($this->t4 * $prop30).'</td>
<td class="center">--</td>
<td class="center"class="center">--</td>
<td class="center">'.Tools::displayPrice($this->t8 * $prop30, $currency).'</td>
</tr>
</table>
</div>';
</table>';
$ca = $this->getRealCA();
@@ -277,50 +284,94 @@ class StatsForecast extends Module
.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o');
$orders = Db::getInstance()->getValue($sql);
$this->_html .= '<br />
<div class="blocStats"><h2 class="icon-conversion"><span></span>'.$this->l('Conversion').'</h2>
<br/>
<div class="blocConversion">
<span style="float:left;text-align:center;margin-right:10px;padding-top:15px; width:100px;">'.$this->l('Visitors').'<br />'.$visitors.'</span>
<span style="float:left;text-align:center;margin-right:10px;">
<img src="../modules/'.$this->name.'/next.png"><br />'.round(100 * $customers / max(1, $visitors)).' %<br />
<img src="../modules/'.$this->name.'/next.png"><br />'.round(100 * $carts / max(1, $visitors)).' %
</span>
<span style="float:left;text-align:center;margin-right:10px">
'.$this->l('Accounts').'<br />'.$customers.'<br />
'.$this->l('Carts').'<br />'.$carts.'
</span>
<span style="float:left;text-align:center;margin-right:10px">
<img src="../modules/'.$this->name.'/next.png"><br />'.round(100 * $fullcarts / max(1, $customers)).' %<br />
<img src="../modules/'.$this->name.'/next.png"><br />'.round(100 * $fullcarts / max(1, $carts)).' %<br />
</span>
<span style="float:left;text-align:center;margin-right:10px;padding-top:15px">'.$this->l('Full carts').'<br />'.$fullcarts.'</span>
<span style="float:left;text-align:center;margin-right:10px;padding-top:15px"><img src="../modules/'.$this->name.'/next.png"><br />'.round(100 * $orders / max(1, $fullcarts)).' %</span>
<span style="float:left;text-align:center;margin-right:10px;padding-top:15px">'.$this->l('orders').'<br />'.$orders.'</span>
</div>
<div class="separation"></div>
<div class="blocConversion">
<span style="float:left;text-align:center;margin-right:10px; width:100px;">'.$this->l('Registered visitors').'</span>
<span style="float:left;text-align:center;margin-right:10px">
<img src="../modules/'.$this->name.'/next.png"> '.round(100 * $orders / max(1, $customers), 2).' % <img src="../modules/'.$this->name.'/next.png">
</span>
<span style="float:left;text-align:center;margin-right:10px">'.$this->l('orders').'</span>
</div>
<div class="separation"></div>
<div class="blocConversion">
<span style="float:left;text-align:center;margin-right:10px; width:100px;">'.$this->l('Visitors').'</span>
<span style="float:left;text-align:center;margin-right:10px">
<img src="../modules/'.$this->name.'/next.png"> '.round(100 * $orders / max(1, $visitors), 2).' % <img src="../modules/'.$this->name.'/next.png">
</span>
<span style="float:left;text-align:center;margin-right:10px">'.$this->l('orders').'</span>
</div>
<div class="separation"></div>
<p>
'.$this->l('Turn your visitors into money:').'
<br />'.$this->l('Each visitor yields').' <b style="color:#000;">'.Tools::displayPrice($ca['ventil']['total'] / max(1, $visitors), $currency).'.</b>
<br />'.$this->l('Each registered visitor yields').' <b style="color:#000;">'.Tools::displayPrice($ca['ventil']['total'] / max(1, $customers), $currency).'</b>.
$this->_html .= '
<div class="row row-margin-bottom">
<h4>'.$this->l('Conversion').'</h4>
</div>
<div class="row row-margin-bottom">
<table class="table">
<tbody>
<tr>
<td rowspan="2" class="center" valign="middle">
<p>'.$this->l('Visitors').'</p>
<p>'.$visitors.'</p>
</td>
<td class="center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $customers / max(1, $visitors)).' %</p>
</td>
<td class="center">
<p>'.$this->l('Accounts').'</p>
<p>'.$customers.'</p>
</td>
<td class="center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $fullcarts / max(1, $customers)).' %</p>
</td>
<td rowspan="2" class="center">
<p>'.$this->l('Full carts').'</p>
<p>'.$fullcarts.'</p>
</td>
<td rowspan="2" class="center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $orders / max(1, $fullcarts)).' %</p>
</td>
<td rowspan="2" class="center">
<p>'.$this->l('orders').'</p>
<p>'.$orders.'</p>
</td>
<td rowspan="2" class="center">
<p>'.$this->l('Registered visitors').'</p>
</td>
<td rowspan="2" class="center">
<i class="icon-chevron-right"></i>
</td>
<td rowspan="2" class="center">
<p>'.round(100 * $orders / max(1, $customers), 2).' %</p>
</td>
<td rowspan="2" class="center">
<i class="icon-chevron-right"></i>
</td>
<td rowspan="2" class="center">
<p>'.$this->l('orders').'</p>
</td>
<td rowspan="2" class="center">
<p>'.$this->l('Visitors').'</p>
</td>
<td rowspan="2" class="center">
<i class="icon-chevron-right"></i>
</td>
<td rowspan="2" class="center">
<p>'.round(100 * $orders / max(1, $visitors), 2).' %</p>
</td>
<td rowspan="2" class="center">
<i class="icon-chevron-right"></i>
</td>
<td rowspan="2" class="center">
<p>'.$this->l('orders').'</p>
</td>
</tr>
<tr>
<td class="center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $carts / max(1, $visitors)).' %</p>
</td>
<td class="center">
<p>'.$this->l('Carts').'</p>
<p>'.$carts.'</p>
</td>
<td class="center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $fullcarts / max(1, $carts)).' %</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="alert alert-info">
<p>'.$this->l('Turn your visitors into money:').'</p>
<p>'.$this->l('Each visitor yields').' <b>'.Tools::displayPrice($ca['ventil']['total'] / max(1, $visitors), $currency).'.</b></p>
<p>'.$this->l('Each registered visitor yields').' <b>'.Tools::displayPrice($ca['ventil']['total'] / max(1, $customers), $currency).'</b>.</p>
</p>
</div>';
@@ -330,130 +381,211 @@ class StatsForecast extends Module
$prop5000 = 5000 / 30 * $interval;
$this->_html .= '
<br />';
$this->_html .= '
<div class="blocStats">
<h2 class="icon-payment"><span></span>'.$this->l('Payment distribution').'</h2>
<p>'.$this->l('The amounts are <b>with</b> taxes, so you can get an estimation of the commission due to the payment method.').'</p>
<form id="cat" action="'.$ru.'#payment" method="post" >
<input type="hidden" name="submitIdZone" value="1" />
'.$this->l('Zone:').' <select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->l('-- No filter --').'</option>';
foreach (Zone::getZones() as $zone)
$this->_html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
$this->_html .= '</select>
</form>
<table class="table" border="0" cellspacing="0" cellspacing="0">
<tr><th>'.$this->l('Module').'</th><th>'.$this->l('Count').'</th><th>'.$this->l('Total').'</th><th>'.$this->l('Cart').'</th></tr>';
foreach ($ca['payment'] as $payment)
<div class="row row-margin-bottom">
<h4>'.$this->l('Payment distribution').'</h4>
<div class="alert alert-info">'
.$this->l('The amounts are with taxes, so you can get an estimation of the commission due to the payment method.').'
</div>
<form id="cat" action="'.$ru.'#payment" method="post" class="form-horizontal">
<div class="row row-margin-bottom">
<label class="control-label col-lg-3">
'.$this->l('Zone:').'
</label>
<div class="col-lg-6">
<input type="hidden" name="submitIdZone" value="1" />
<select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->l('-- No filter --').'</option>';
foreach (Zone::getZones() as $zone)
$this->_html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
$this->_html .= '
</select>
</div>
</div>
</form>
<table class="table">
<thead>
<tr>
<th class="center"><span class="title_box active">'.$this->l('Module').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Count').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Total').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Cart').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['payment'] as $payment)
$this->_html .= '
<tr>
<td class="center">'.$payment['payment_method'].'</td>
<td class="center">'.(int)$payment['nb'].'</td>
<td class="center">'.Tools::displayPrice($payment['total'], $currency).'</td>
<td class="center">'.Tools::displayPrice($payment['cart'], $currency).'</td>
</tr>';
$this->_html .= '
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4>'.$this->l('Category distribution').'</h4>
<form id="cat" action="'.$ru.'#cat" method="post" class="form-horizontal">
<div class="row row-margin-bottom">
<label class="control-label col-lg-3">
'.$this->l('Zone:').'
</label>
<div class="col-lg-6">
<input type="hidden" name="submitIdZone" value="1" />
<select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->l('-- No filter --').'</option>';
foreach (Zone::getZones() as $zone)
$this->_html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
$this->_html .= '
</select>
</div>
</div>
</form>
<table class="table">
<thead>
<tr>
<th class="center"><span class="title_box active">'.$this->l('Category').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Count').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Sales').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('% Count').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('% Sales').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Avgerage price').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['cat'] as $catrow)
$this->_html .= '
<tr>
<td class="center">'.(empty($catrow['name']) ? $this->l('Unknown') : $catrow['name']).'</td>
<td class="center">'.$catrow['orderQty'].'</td>
<td class="center">'.Tools::displayPrice($catrow['orderSum'], $currency).'</td>
<td class="center">'.number_format((100 * $catrow['orderQty'] / $this->t4), 1, '.', ' ').'%</td>
<td class="center">'.((int)$ca['ventil']['total'] ? number_format((100 * $catrow['orderSum'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%</td>
<td class="center">'.Tools::displayPrice($catrow['priveAvg'], $currency).'</td>
</tr>';
$this->_html .= '
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4>'.$this->l('Language distribution').'</h4>
<table class="table">
<thead>
<tr>
<th class="center"><span class="title_box active">'.$this->l('customers').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Sales').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('%').'</span></th>
<th class="center" colspan="2"><span class="title_box active">'.$this->l('Growth').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['lang'] as $ophone => $amount)
{
$percent = (int)($ca['langprev'][$ophone]) ? number_format((100 * $amount / $ca['langprev'][$ophone]) - 100, 1, '.', ' ') : '&#x221e;';
$this->_html .= '
<tr '.(($percent < 0) ? 'class="alt_row"' : '').'>
<td class="center">'.$ophone.'</td>
<td class="center">'.Tools::displayPrice($amount, $currency).'</td>
<td class="center">'.((int)$ca['ventil']['total'] ? number_format((100 * $amount / $ca['ventil']['total']), 1, '.', ' ').'%' : '-').'</td>
<td class="center">'.(($percent > 0 OR $percent == '&#x221e;') ? '<img src="../img/admin/arrow_up.png" />' : '<img src="../img/admin/arrow_down.png" /> ').'</td>
<td class="center">'.(($percent > 0 OR $percent == '&#x221e;') ? '+' : '').$percent.'%</td>
</tr>';
}
$this->_html .= '
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4>'.$this->l('Zone distribution').'</h4>
<table class="table">
<thead>
<tr>
<th class="center"><span class="title_box active">'.$this->l('Zone').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Count').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Total').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('% Count').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('% Sales').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['zones'] as $zone)
$this->_html .= '
<tr>
<td>'.$payment['payment_method'].'</td>
<td style="text-align:center;padding:4px">'.(int)$payment['nb'].'</td>
<td style="text-align:center;padding:4px">'.Tools::displayPrice($payment['total'], $currency).'</td>
<td style="text-align:center;padding:4px">'.Tools::displayPrice($payment['cart'], $currency).'</td>
<td class="center">'.(isset($zone['name']) ? $zone['name'] : $this->l('Undefined')).'</td>
<td class="center">'.(int)($zone['nb']).'</td>
<td class="center">'.Tools::displayPrice($zone['total'], $currency).'</td>
<td class="center">'.($ca['ventil']['nb'] ? number_format((100 * $zone['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'%</td>
<td class="center">'.((int)$ca['ventil']['total'] ? number_format((100 * $zone['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%</td>
</tr>';
$this->_html .= '
</table>
</div>
<br />
<div class="blocStats"><h2 class="icon-category"><span></span>'.$this->l('Category distribution').'</h2>
<form id="cat" action="'.$ru.'#cat" method="post" >
<input type="hidden" name="submitIdZone" value="1" />
'.$this->l('Zone:').' <select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->l('-- No filter --').'</option>';
foreach (Zone::getZones() as $zone)
$this->_html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
$this->_html .= ' </select>
</form>
<table class="table" border="0" cellspacing="0" cellspacing="0">
<tr><th style="width:50px">'.$this->l('Category').'</th><th>'.$this->l('Count').'</th><th>'.$this->l('Sales').'</th><th>'.$this->l('% Count').'</th><th>'.$this->l('% Sales').'</th><th>'.$this->l('Avgerage price').'</th></tr>';
foreach ($ca['cat'] as $catrow)
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4>'.$this->l('Currency distribution').'</h4>
<form id="cat" action="'.$ru.'#currencies" method="post" class="form-horizontal">
<div class="row row-margin-bottom">
<label class="control-label col-lg-3">
'.$this->l('Zone:').'
</label>
<div class="col-lg-6">
<input type="hidden" name="submitIdZone" value="1" />
<select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->l('-- No filter --').'</option>';
foreach (Zone::getZones() as $zone)
$this->_html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
$this->_html .= '
</select>
</div>
</div>
</form>
<table class="table">
<thead>
<tr>
<th class="center"><span class="title_box active">'.$this->l('Currency').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Count').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Sales (converted)').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('% Count').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('% Sales').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['currencies'] as $currencyRow)
$this->_html .= '
<tr>
<td class="center">'.$currencyRow['name'].'</td>
<td class="center">'.(int)($currencyRow['nb']).'</td>
<td class="center">'.Tools::displayPrice($currencyRow['total'], $currency).'</td>
<td class="center">'.($ca['ventil']['nb'] ? number_format((100 * $currencyRow['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'%</td>
<td class="center">'.((int)$ca['ventil']['total'] ? number_format((100 * $currencyRow['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%</td>
</tr>';
$this->_html .= '
<tr>
<td>'.(empty($catrow['name']) ? $this->l('Unknown') : $catrow['name']).'</td>
<td align="right">'.$catrow['orderQty'].'</td>
<td align="right">'.Tools::displayPrice($catrow['orderSum'], $currency).'</td>
<td align="right">'.number_format((100 * $catrow['orderQty'] / $this->t4), 1, '.', ' ').'%</td>
<td align="right">'.((int)$ca['ventil']['total'] ? number_format((100 * $catrow['orderSum'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%</td>
<td align="right">'.Tools::displayPrice($catrow['priveAvg'], $currency).'</td>
</tr>';
$this->_html .= '
</table>
</div>
<br />
<div class="blocStats"><h2 class="icon-language"><span></span>'.$this->l('Language distribution').'</h2>
<table class="table" border="0" cellspacing="0" cellspacing="0">
<tr><th>'.$this->l('customers').'</th><th>'.$this->l('Sales').'</th><th>'.$this->l('%').'</th><th colspan="2">'.$this->l('Growth').'</th></tr>';
foreach ($ca['lang'] as $ophone => $amount)
{
$percent = (int)($ca['langprev'][$ophone]) ? number_format((100 * $amount / $ca['langprev'][$ophone]) - 100, 1, '.', ' ') : '&#x221e;';
$this->_html .= '
<tr '.(($percent < 0) ? 'class="alt_row"' : '').'>
<td>'.$ophone.'</td>
<td align="right">'.Tools::displayPrice($amount, $currency).'</td>
<td align="right">'.((int)$ca['ventil']['total'] ? number_format((100 * $amount / $ca['ventil']['total']), 1, '.', ' ').'%' : '-').'</td>
<td>'.(($percent > 0 OR $percent == '&#x221e;') ? '<img src="../img/admin/arrow_up.png" />' : '<img src="../img/admin/arrow_down.png" /> ').'</td>
<td align="right">'.(($percent > 0 OR $percent == '&#x221e;') ? '+' : '').$percent.'%</td>
</tr>';
}
$this->_html .= '
</table>
</div>
<br />
<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->l('Zone distribution').'</h2>
<table class="table" border="0" cellspacing="0" cellspacing="0">
<tr><th>'.$this->l('Zone').'</th><th>'.$this->l('Count').'</th><th>'.$this->l('Total').'</th><th>'.$this->l('% Count').'</th><th>'.$this->l('% Sales').'</th></tr>';
foreach ($ca['zones'] as $zone)
$this->_html .= '
<tr>
<td>'.(isset($zone['name']) ? $zone['name'] : $this->l('Undefined')).'</td>
<td align="right">'.(int)($zone['nb']).'</td>
<td align="right">'.Tools::displayPrice($zone['total'], $currency).'</td>
<td align="right">'.($ca['ventil']['nb'] ? number_format((100 * $zone['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'%</td>
<td align="right">'.((int)$ca['ventil']['total'] ? number_format((100 * $zone['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%</td>
</tr>';
$this->_html .= '
</table>
</div>
<br />
<div class="blocStats"><h2 class="icon-currency"><span></span>'.$this->l('Currency distribution').'</h2>
<form id="cat" action="'.$ru.'#currencies" method="post" >
<input type="hidden" name="submitIdZone" value="1" />
'.$this->l('Zone:').' <select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->l('-- No filter --').'</option>';
foreach (Zone::getZones() as $zone)
$this->_html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
$this->_html .= '</select>
</form>
<table class="table" border="0" cellspacing="0" cellspacing="0">
<tr><th>'.$this->l('Currency').'</th><th>'.$this->l('Count').'</th><th>'.$this->l('Sales (converted)').'</th><th>'.$this->l('% Count').'</th><th>'.$this->l('% Sales').'</th></tr>';
foreach ($ca['currencies'] as $currencyRow)
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4>'.$this->l('Attribute distribution').'</h4>
<table class="table">
<thead>
<tr>
<th class="center"><span class="title_box active">'.$this->l('Group').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Attribute').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Count').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['attributes'] as $attribut)
$this->_html .= '
<tr>
<td class="center">'.$attribut['gname'].'</td>
<td class="center">'.$attribut['aname'].'</td>
<td class="center">'.(int)($attribut['total']).'</td>
</tr>';
$this->_html .= '
<tr>
<td>'.$currencyRow['name'].'</td>
<td align="right">'.(int)($currencyRow['nb']).'</td>
<td align="right">'.Tools::displayPrice($currencyRow['total'], $currency).'</td>
<td align="right">'.($ca['ventil']['nb'] ? number_format((100 * $currencyRow['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'%</td>
<td align="right">'.((int)$ca['ventil']['total'] ? number_format((100 * $currencyRow['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%</td>
</tr>';
$this->_html .= '
</table>
</div>
<br />
<div class="blocStats"><h2 class="icon-attribute"><span></span>'.$this->l('Attribute distribution').'</h2>
<table class="table" border="0" cellspacing="0" cellspacing="0">
<tr><th>'.$this->l('Group').'</th><th>'.$this->l('Attribute').'</th><th>'.$this->l('Count').'</th></tr>';
foreach ($ca['attributes'] as $attribut)
$this->_html .= '
<tr>
<td>'.$attribut['gname'].'</td>
<td>'.$attribut['aname'].'</td>
<td align="right">'.(int)($attribut['total']).'</td>
</tr>';
$this->_html .= '</table>
</div>
</div>';
</tbody>
</table>
</div>';
return $this->_html;
}
+63 -42
View File
@@ -144,60 +144,81 @@ class StatsLive extends Module
$("#calendar").remove();
</script>';
if (!Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS'))
$this->html .= '<div class="warn">'.
$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.').'
</div>';
$this->html .= '
<div class="alert alert-info">'.
$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.').'
</div>';
$this->html .= '
<fieldset><legend><img src="../modules/'.$this->name.'/logo.gif" /> '.$this->l('Customers online').'</legend>';
<h4> '.$this->l('Customers online').'</h4>';
if ($totalCustomers)
{
$this->html .= $this->l('Total:').' '.(int)$totalCustomers.'
<table cellpadding="0" cellspacing="0" class="table space">
<tr><th>'.$this->l('ID').'</th><th>'.$this->l('Name').'</th><th>'.$this->l('Current Page').'</th><th>'.$this->l('View').'</th></tr>';
foreach ($customers as $customer)
<table class="table">
<thead>
<tr>
<th class="center"><span class="title_box active">'.$this->l('ID').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Name').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Current Page').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('View').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($customers as $customer)
$this->html .= '
<tr'.($irow++ % 2 ? ' class="alt_row"' : '').'>
<td class="center">'.$customer['id_customer'].'</td>
<td class="center">'.$customer['firstname'].' '.$customer['lastname'].'</td>
<td class="center">'.$customer['page'].'</td>
<td class="center">
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)Tab::getIdFromClassName('AdminCustomers').(int)$this->context->employee->id).'"
target="_blank">
<img src="../modules/'.$this->name.'/logo.gif" />
</a>
</td>
</tr>';
$this->html .= '
<tr'.($irow++ % 2 ? ' class="alt_row"' : '').'>
<td>'.$customer['id_customer'].'</td>
<td style="width: 200px;">'.$customer['firstname'].' '.$customer['lastname'].'</td>
<td style="width: 200px;">'.$customer['page'].'</td>
<td style="text-align: right; width: 25px;">
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)Tab::getIdFromClassName('AdminCustomers').(int)$this->context->employee->id).'"
target="_blank">
<img src="../modules/'.$this->name.'/logo.gif" />
</a>
</td>
</tr>';
$this->html .= '</table>';
</tbody>
</table>';
}
else
$this->html .= $this->l('Currently, there are no customers online.');
$this->html .= '</fieldset>
<br />
<fieldset><legend><img src="../modules/'.$this->name.'/logo.gif" /> '.$this->l('Visitors online').'</legend>';
$this->html .= '<p class="alert alert-warning">'.$this->l('Currently, there are no customers online.').'</p>
<h4> '.$this->l('Visitors online').'</h4>';
if ($totalVisitors)
{
$this->html .= $this->l('Total:').' '.(int)($totalVisitors).'
<div style="overflow-y: scroll; height: 600px;">
<table cellpadding="0" cellspacing="0" class="table space">
<tr><th>'.$this->l('Guest').'</th><th>'.$this->l('IP').'</th><th>'.$this->l('Since').'</th><th>'.$this->l('Current page').'</th><th>'.$this->l('Referrer').'</th></tr>';
foreach ($visitors as $visitor)
$this->html .= '<tr'.($irow++ % 2 ? ' class="alt_row"' : '').'>
<td>'.$visitor['id_guest'].'</td>
<td style="width: 80px;">'.long2ip($visitor['ip_address']).'</td>
<td style="width: 100px;">'.substr($visitor['date_add'], 11).'</td>
<td style="width: 200px;">'.(isset($visitor['page']) ? $visitor['page'] : $this->l('Undefined')).'</td>
<td style="width: 200px;">'.(empty($visitor['http_referer']) ? $this->l('None') : parse_url($visitor['http_referer'], PHP_URL_HOST)).'</td>
</tr>';
$this->html .= '</table></div>';
<div>
<table class="table">
<thead>
<tr>
<th class="center"><span class="title_box active">'.$this->l('Guest').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('IP').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Since').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Current page').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Referrer').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($visitors as $visitor)
$this->html .= '<tr'.($irow++ % 2 ? ' class="alt_row"' : '').'>
<td class="center">'.$visitor['id_guest'].'</td>
<td class="center">'.long2ip($visitor['ip_address']).'</td>
<td class="center">'.substr($visitor['date_add'], 11).'</td>
<td class="center">'.(isset($visitor['page']) ? $visitor['page'] : $this->l('Undefined')).'</td>
<td class="center">'.(empty($visitor['http_referer']) ? $this->l('None') : parse_url($visitor['http_referer'], PHP_URL_HOST)).'</td>
</tr>';
$this->html .= '
</tbody>
</table>
</div>';
}
else
$this->html .= $this->l('There are no visitors online.');
$this->html .= '</fieldset>
<br />
<fieldset><legend>'.$this->l('Notice').'</legend>
'.$this->l('Maintenance IP(s) are excluded from the online visitors.').'<br />
<a href="index.php?controller=AdminMaintenance&token='.Tools::getAdminTokenLite('AdminMaintenance').'">'.$this->l('Add or remove an IP address.').'</a>
</fieldset>';
$this->html .= '<p class="alert alert-warning">'.$this->l('There are no visitors online.').'</p>
<h4>'.$this->l('Notice').'</h4>
<p class="alert alert-info">'.$this->l('Maintenance IP(s) are excluded from the online visitors.').'</p>
<a class="btn btn-default" href="index.php?controller=AdminMaintenance&token='.Tools::getAdminTokenLite('AdminMaintenance').'">
<i class="icon-share-alt"></i> '.$this->l('Add or remove an IP address.').'
</a>
';
return $this->html;
}
+33 -15
View File
@@ -84,26 +84,44 @@ class StatsVisits extends ModuleGraph
if (Tools::getValue('export'))
$this->csvExport(array('layers' => 2, 'type' => 'line', 'option' => 3));
$this->html = '
<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2>
<p>
<img src="../img/admin/down.gif" />'.$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.').'
</p>
<div style="margin-top:20px"></div>
<p>'.$this->l('Total visits:').' <span class="totalStats">'.$totalVisits.'</span></p>
<p>'.$this->l('Total visitors:').' <span class="totalStats">'.$totalGuests.'</span></p>
'.($totalVisits ? $this->engine($graphParams).'<p><a class="button export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1"><span>'.$this->l('CSV Export').'</span></a></p>' : '').'
<div class="panel-heading">
'.$this->displayName.'
</div>
<br />
<div class="blocStats"><h2 class="icon-guide"><span></span>'.$this->l('Guide').'</h2>
<h2>'.$this->l('Determine the interest of a visit.').'</h2>
'.$this->l('The visitors\' evolution graph strongly resembles the visits\' graph, but provides additional information:').'<br />
<h4>'.$this->l('Guide').'</h4>
<div class="alert alert-warning">
<h4>'.$this->l('Determine the interest of a visit.').'</h4>
<p>
'.$this->l('The visitors\' evolution graph strongly resembles the visits\' graph, but provides additional information:').'<br />
</p>
<ul>
<li>'.$this->l('If this is the case, congratulations, your website is well planned and pleasing. Glad to see that you\'ve been paying attention.').'</li>
<li>'.$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.').'</li>
</ul>
'.$this->l('This information is mostly qualitative. It is up to you to determine the interest of a disjointed visit.').'<br />
</div>';
<p>
'.$this->l('This information is mostly qualitative. It is up to you to determine the interest of a disjointed visit.').'
</p>
</div>
<div class="alert alert-info">
'.$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.').'
</div>
<div class="row row-margin-bottom">
<div class="col-lg-12">
<div class="col-lg-8">
'.($totalVisits ? $this->engine($graphParams).'
</div>
<div class="col-lg-4">
<ul class="list-unstyled">
<li>'.$this->l('Total visits:').' <span class="totalStats">'.$totalVisits.'</span></li>
<li>'.$this->l('Total visitors:').' <span class="totalStats">'.$totalGuests.'</span></li>
</ul>
<hr/>
<a class="btn btn-default export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1">
<i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
</a> ' : '').'
</div>
</div>
</div>';
return $this->html;
}