// update tabs stats

This commit is contained in:
Sarah Lorenzini
2013-09-17 17:49:49 +02:00
parent 8f10a0e32f
commit bdb797a66c
18 changed files with 691 additions and 458 deletions
+18 -13
View File
@@ -62,19 +62,24 @@ class GridHtml extends ModuleGridEngine
if (!isset($params['emptyMsg'])) if (!isset($params['emptyMsg']))
$params['emptyMsg'] = 'Empty'; $params['emptyMsg'] = 'Empty';
$html = '<div style="width:'.$params['width'].'px;height:'.$params['height'].'px;overflow:scroll"> $html = '
<table class="table" cellpadding="0" cellspacing="0" id="grid_1"><thead><tr>'; <table class="table" id="grid_1">
foreach ($params['columns'] as $column) <thead>
$html .= '<th style="width:'.$column['width'].'px;cursor:pointer"> <tr>';
'.$column['header'].'<br /> foreach ($params['columns'] as $column)
<a href="javascript:getGridData(\''.$grider.'&sort='.$column['dataIndex'].'&dir=ASC\');"><img src="../img/admin/up.gif" /></a> $html .= '<th class="center">
<a href="javascript:getGridData(\''.$grider.'&sort='.$column['dataIndex'].'&dir=DESC\');"><img src="../img/admin/down.gif" /></a> <span class="title_box active">'.$column['header'].'</span>
</th>'; </th>';
$html .= '</tr></thead> $html .= '
</tr>
</thead>
<tbody></tbody> <tbody></tbody>
<tfoot><tr><th colspan="'.count($params['columns']).'"></th></tr></tfoot> <tfoot>
<tr>
<th colspan="'.count($params['columns']).'"></th>
</tr>
</tfoot>
</table> </table>
</div>
<script type="text/javascript"> <script type="text/javascript">
function getGridData(url) function getGridData(url)
{ {
@@ -96,7 +101,7 @@ class GridHtml extends ModuleGridEngine
$.each(values, function(index, row){ $.each(values, function(index, row){
var newLine = "<tr>";'; var newLine = "<tr>";';
foreach ($params['columns'] as $column) foreach ($params['columns'] as $column)
$html .= ' newLine += "<td'.(isset($column['align']) ? ' style=\"text-align:'.$column['align'].'\"' : '').'>" + row["'.$column['dataIndex'].'"] + "</td>";'; $html .= ' newLine += "<td'.(isset($column['align']) ? ' class=\"'.$column['align'].'\"' : '').'>" + row["'.$column['dataIndex'].'"] + "</td>";';
if (!isset($params['defaultSortColumn'])) if (!isset($params['defaultSortColumn']))
$params['defaultSortColumn'] = false; $params['defaultSortColumn'] = false;
if (!isset($params['defaultSortDirection'])) if (!isset($params['defaultSortDirection']))
@@ -104,7 +109,7 @@ class GridHtml extends ModuleGridEngine
$html .= ' $("#grid_1 tbody").append(newLine); $html .= ' $("#grid_1 tbody").append(newLine);
}); });
else else
$("#grid_1 tbody").append("<tr><td style=\"text-align:center\" colspan=\"" + '.count($params['columns']).' + "\">'.$params['emptyMsg'].'</td></tr>"); $("#grid_1 tbody").append("<tr><td class=\"center\" colspan=\"" + '.count($params['columns']).' + "\">'.$params['emptyMsg'].'</td></tr>");
}); });
} }
+46 -32
View File
@@ -96,30 +96,54 @@ class Pagesnotfound extends Module
if (Tools::isSubmit('submitTruncatePNF')) if (Tools::isSubmit('submitTruncatePNF'))
{ {
Db::getInstance()->execute('TRUNCATE `'._DB_PREFIX_.'pagenotfound`'); Db::getInstance()->execute('TRUNCATE `'._DB_PREFIX_.'pagenotfound`');
$this->_html .= '<div class="conf confirm"> '.$this->l('The pages not found cache has been emptied.').'</div>'; $this->_html .= '<div class="alert alert-warning"> '.$this->l('The pages not found cache has been emptied.').'</div>';
} }
else if (Tools::isSubmit('submitDeletePNF')) else if (Tools::isSubmit('submitDeletePNF'))
{ {
Db::getInstance()->execute(' Db::getInstance()->execute('
DELETE FROM `'._DB_PREFIX_.'pagenotfound` DELETE FROM `'._DB_PREFIX_.'pagenotfound`
WHERE date_add BETWEEN '.ModuleGraph::getDateBetween()); WHERE date_add BETWEEN '.ModuleGraph::getDateBetween());
$this->_html .= '<div class="conf confirm"> '.$this->l('Pages not found have been deleted.').'</div>'; $this->_html .= '<div class="alert alert-warning"> '.$this->l('Pages not found have been deleted.').'</div>';
} }
$this->_html .= '<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2>'; $this->_html .= '
<div class="panel-heading">
'.$this->displayName.'
</div>
<h4>'.$this->l('Guide').'</h4>
<div class="alert alert-warning">
<h4>'.$this->l('404 errors').'</h4>
<p>'
.$this->l('A 404 error is an HTTP error code which means that the file requested by the user cannot be found.
In your case it means that one of your visitors entered a wrong URL in the address bar or that you or another website has a dead link.
When it is available, the referrer is shown so you can find the page which contains the dead link.
If not, it means generally that it is a direct access, so someone may have bookmarked a link which doesn\'t exist anymore.').'
</p>
<p>&nbsp;</p>
<h4>'.$this->l('How to catch these errors?').'</h4>
<p>'
.$this->l('If your webhost supports .htaccess files, you can create one in the root directory of PrestaShop and insert the following line inside:').'
<i>ErrorDocument 404 '.__PS_BASE_URI__.'404.php</i>. '.
$this->l('A user requesting a page which doesn\'t exist will be redirected to the following page.').' <i>'.__PS_BASE_URI__.'404.php</i>. '.
$this->l('This module logs access to this page.').'
</p>
</div>';
if (!file_exists(dirname(__FILE__).'/../../.htaccess')) if (!file_exists(dirname(__FILE__).'/../../.htaccess'))
$this->_html .= '<br/><div class="warning warn">'.$this->l('You must use a .htaccess file to redirect 404 errors to the page "404.php"').'</div>'; $this->_html .= '<div class="alert alert-warning">'.$this->l('You must use a .htaccess file to redirect 404 errors to the page "404.php"').'</div>';
$pages = $this->getPages(); $pages = $this->getPages();
if (count($pages)) if (count($pages))
{ {
$this->_html .= ' $this->_html .= '
<table class="table" cellpadding="0" cellspacing="0"> <table class="table">
<tr> <thead>
<th width="200">'.$this->l('Page').'</th> <tr>
<th width="500">'.$this->l('Referrer').'</th> <th><span class="title_box active">'.$this->l('Page').'</span></th>
<th>'.$this->l('Counter').'</th> <th><span class="title_box active">'.$this->l('Referrer').'</span></th>
</tr>'; <th><span class="title_box active">'.$this->l('Counter').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($pages as $ru => $hrs) foreach ($pages as $ru => $hrs)
foreach ($hrs as $hr => $counter) foreach ($hrs as $hr => $counter)
if ($hr != 'nb') if ($hr != 'nb')
@@ -127,36 +151,26 @@ class Pagesnotfound extends Module
<tr> <tr>
<td><a href="'.$ru.'-admin404">'.wordwrap($ru, 30, '<br />', true).'</a></td> <td><a href="'.$ru.'-admin404">'.wordwrap($ru, 30, '<br />', true).'</a></td>
<td><a href="'.Tools::getProtocol().$hr.'">'.wordwrap($hr, 40, '<br />', true).'</a></td> <td><a href="'.Tools::getProtocol().$hr.'">'.wordwrap($hr, 40, '<br />', true).'</a></td>
<td align="right">'.$counter.'</td> <td>'.$counter.'</td>
</tr>'; </tr>';
$this->_html .= ' $this->_html .= '
</tbody>
</table>'; </table>';
} }
else else
$this->_html .= '<div class="conf confirm"> '.$this->l('No pages registered').'</div>'; $this->_html .= '<div class="alert alert-warning"> '.$this->l('No pages registered').'</div>';
$this->_html .= '</div>';
if (count($pages)) if (count($pages))
$this->_html .= '<div class="clear">&nbsp;</div> $this->_html .= '
<div class="blocStats"><h2 class="icon-'.$this->name.'">'.$this->l('Empty database').'</h2> <h4>'.$this->l('Empty database').'</h4>
<form action="'.Tools::htmlEntitiesUtf8($_SERVER['REQUEST_URI']).'" method="post"> <form action="'.Tools::htmlEntitiesUtf8($_SERVER['REQUEST_URI']).'" method="post">
<input type="submit" class="button" name="submitDeletePNF" value="'.$this->l('Empty ALL pages not found for this period').'"> <button type="submit" class="btn btn-default" name="submitDeletePNF">
<input type="submit" class="button" name="submitTruncatePNF" value="'.$this->l('Empty ALL pages not found').'"> <i class="icon-remove"></i> '.$this->l('Empty ALL pages not found for this period').'
</form> </button>
</div>'; <button type="submit" class="btn btn-default" name="submitTruncatePNF">
$this->_html .= '<br /> <i class="icon-remove"></i> '.$this->l('Empty ALL pages not found').'
<div class="blocStats"><h2 class="icon-guide"><span></span>'.$this->l('Guide').'</h2> </button>
<h2>'.$this->l('404 errors').'</h2> </form>';
<p>'.$this->l('A 404 error is an HTTP error code which means that the file requested by the user cannot be found.
In your case it means that one of your visitors entered a wrong URL in the address bar or that you or another website has a dead link.
When it is available, the referrer is shown so you can find the page which contains the dead link.
If not, it means generally that it is a direct access, so someone may have bookmarked a link which doesn\'t exist anymore.').'</p>
<h3>'.$this->l('How to catch these errors?').'</h3>
<p>'.$this->l('If your webhost supports .htaccess files, you can create one in the root directory of PrestaShop and insert the following line inside:').'
<i>ErrorDocument 404 '.__PS_BASE_URI__.'404.php</i>. '.
$this->l('A user requesting a page which doesn\'t exist will be redirected to the following page.').' <i>'.__PS_BASE_URI__.'404.php</i>. '.
$this->l('This module logs access to this page.').'</p><br />
</div>';
return $this->_html; return $this->_html;
} }
+54 -29
View File
@@ -104,52 +104,77 @@ class SEKeywords extends ModuleGraph
$this->csvExport(array('type' => 'pie')); $this->csvExport(array('type' => 'pie'));
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query.ModuleGraph::getDateBetween().$this->_query2); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query.ModuleGraph::getDateBetween().$this->_query2);
$total = count($result); $total = count($result);
$this->html = '<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2> $this->html = '
<div class="panel-heading">'
.$this->displayName.'
</div>
<h4>'.$this->l('Guide').'</h4>
<div class="alert alert-warning">
<h4>'.$this->l('Identify external search engine keywords').'</h4>
<p>'
.$this->l('One of the most common ways of finding a website through a search engine.').
$this->l('Identifying the most popular keywords entered by your new visitors allows you to see the products you should put in front if you want to achieve SEO. ').'
</p>
<p>&nbsp;</p>
<h4>'.$this->l('How does it work?').'</h4>
<p>'
.$this->l('When a visitor comes to your website, the server notes their previous location. This module parses the URL and finds the keywords in it.').
sprintf($this->l('Currently, it manages the following search engines: %1$s and %2$s.'),
'<b>Google, AOL, Yandex, Ask, NHL, Yahoo, Baidu, Lycos, Exalead, Live, Voila</b>',
'<b>Altavista</b>'
).$this->l('Soon, it will be possible to dynamically add new search engines and contribute to this module.').'
</p>
</div>
<p>'.($total == 1 ? sprintf($this->l('%d keyword matches your query.'), $total) : sprintf($this->l('%d keywords match your query.'), $total)).'</p>'; <p>'.($total == 1 ? sprintf($this->l('%d keyword matches your query.'), $total) : sprintf($this->l('%d keywords match your query.'), $total)).'</p>';
$form = '<form action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post"> $form = '
'.$this->l('Filter by keyword').' <input type="text" name="SEK_FILTER_KW" value="'.Tools::htmlentitiesUTF8(Configuration::get('SEK_FILTER_KW')).'" /> <form action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post" class="form-horizontal">
'.$this->l('And min occurrences').' <input type="text" name="SEK_MIN_OCCURENCES" value="'.(int)Configuration::get('SEK_MIN_OCCURENCES').'" /> <div class="row row-margin-bottom">
<input type="submit" class="button" name="submitSEK" value="'.$this->l('Apply ').'" /> <label class="control-label col-lg-3">'.$this->l('Filter by keyword').'</label>
</form>'; <div class="col-lg-9">
<input type="text" name="SEK_FILTER_KW" value="'.Tools::htmlentitiesUTF8(Configuration::get('SEK_FILTER_KW')).'" />
</div>
</div>
<div class="row row-margin-bottom">
<label class="control-label col-lg-3">'.$this->l('And min occurrences').'</label>
<div class="col-lg-9">
<input type="text" name="SEK_MIN_OCCURENCES" value="'.(int)Configuration::get('SEK_MIN_OCCURENCES').'" />
</div>
</div>
<div class="row row-margin-bottom">
<div class="col-lg-9 col-lg-offset-3">
<button type="submit" class="btn btn-default" name="submitSEK">
<i class="icon-ok"></i> '.$this->l('Apply').'
</button>
</div>
</div>
</form>';
if ($result && $total) if ($result && $total)
{ {
$table = ' $table = '
<div style="overflow-y: scroll; height: 600px;"> <table class="table">
<table class="table" border="0" cellspacing="0" cellspacing="0"> <thead>
<thead> <tr>
<tr><th style="width:400px;">'.$this->l('Keywords').'</th> <th><span class="title_box active">'.$this->l('Keywords').'</span></th>
<th style="width:50px; text-align: right">'.$this->l('Occurrences').'</th></tr> <th><span class="title_box active">'.$this->l('Occurrences').'</span></th>
</thead><tbody>'; </tr>
</thead>
<tbody>';
foreach ($result as $index => $row) foreach ($result as $index => $row)
{ {
$keyword =& $row['keyword']; $keyword =& $row['keyword'];
$occurences =& $row['occurences']; $occurences =& $row['occurences'];
$table .= '<tr><td>'.$keyword.'</td><td style="text-align: right">'.$occurences.'</td></tr>'; $table .= '<tr><td>'.$keyword.'</td><td>'.$occurences.'</td></tr>';
} }
$table .= '</tbody></table></div>'; $table .= '</tbody></table>';
$this->html .= '<div>'.$this->engine(array('type' => 'pie')).'</div> $this->html .= '<div>'.$this->engine(array('type' => 'pie')).'</div>
<br/> <a class="btn btn-default" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=language"><<i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'</a>
<p><a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=language"><img src="../img/admin/asterisk.gif" /> '.$this->l('CSV Export').'</a></p><br/>
'.$form.'<br/>'.$table; '.$form.'<br/>'.$table;
} }
else else
$this->html .= '<p>'.$form.'<strong>'.$this->l('No keywords').'</strong></p>'; $this->html .= '<p>'.$form.'<strong>'.$this->l('No keywords').'</strong></p>';
$this->html .= '</div><br/>
<div class="blocStats"><h2 class="icon-guide"><span></span>'.$this->l('Guide').'</h2>
<h2>'.$this->l('Identify external search engine keywords').'</h2>
<p>'.$this->l('One of the most common ways of finding a website through a search engine.').
$this->l('Identifying the most popular keywords entered by your new visitors allows you to see the products you should put in front if you want to achieve SEO. ').'
</p><br />
<h3>'.$this->l('How does it work?').'</h2>
<p>'.$this->l('When a visitor comes to your website, the server notes their previous location. This module parses the URL and finds the keywords in it.').
sprintf($this->l('Currently, it manages the following search engines: %1$s and %2$s.'),
'<b>Google, AOL, Yandex, Ask, NHL, Yahoo, Baidu, Lycos, Exalead, Live, Voila</b>',
'<b>Altavista</b>'
).$this->l('Soon, it will be possible to dynamically add new search engines and contribute to this module.').'</p><br />
</div>';
return $this->html; return $this->html;
} }
@@ -57,29 +57,25 @@ class StatsBestCategories extends ModuleGrid
'id' => 'name', 'id' => 'name',
'header' => $this->l('Name'), 'header' => $this->l('Name'),
'dataIndex' => 'name', 'dataIndex' => 'name',
'align' => 'left', 'align' => 'center'
'width' => 140
), ),
array( array(
'id' => 'totalQuantitySold', 'id' => 'totalQuantitySold',
'header' => $this->l('Total Quantity Sold'), 'header' => $this->l('Total Quantity Sold'),
'dataIndex' => 'totalQuantitySold', 'dataIndex' => 'totalQuantitySold',
'width' => 20, 'align' => 'center'
'align' => 'right'
), ),
array( array(
'id' => 'totalPriceSold', 'id' => 'totalPriceSold',
'header' => $this->l('Total Price'), 'header' => $this->l('Total Price'),
'dataIndex' => 'totalPriceSold', 'dataIndex' => 'totalPriceSold',
'width' => 30, 'align' => 'center'
'align' => 'right'
), ),
array( array(
'id' => 'totalPageViewed', 'id' => 'totalPageViewed',
'header' => $this->l('Total Viewed'), 'header' => $this->l('Total Viewed'),
'dataIndex' => 'totalPageViewed', 'dataIndex' => 'totalPageViewed',
'width' => 30, 'align' => 'center'
'align' => 'right'
) )
); );
@@ -108,10 +104,13 @@ class StatsBestCategories extends ModuleGrid
$this->csvExport($engineParams); $this->csvExport($engineParams);
$this->_html = ' $this->_html = '
<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2> <div class="panel-heading">
'.$this->displayName.'
</div>
'.$this->engine($engineParams).' '.$this->engine($engineParams).'
<br /><a class="button export-csv" href="'.htmlentities($_SERVER['REQUEST_URI']).'&export=1"><span>'.$this->l('CSV Export').'</span></a> <a class="btn btn-default export-csv" href="'.htmlentities($_SERVER['REQUEST_URI']).'&export=1">
</div>'; <i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
</a>';
return $this->_html; return $this->_html;
} }
@@ -59,38 +59,38 @@ class StatsBestCustomers extends ModuleGrid
'id' => 'lastname', 'id' => 'lastname',
'header' => $this->l('Last Name'), 'header' => $this->l('Last Name'),
'dataIndex' => 'lastname', 'dataIndex' => 'lastname',
'width' => 80 'align' => 'center'
), ),
array( array(
'id' => 'firstname', 'id' => 'firstname',
'header' => $this->l('First Name'), 'header' => $this->l('First Name'),
'dataIndex' => 'firstname', 'dataIndex' => 'firstname',
'width' => 80 'align' => 'center'
), ),
array( array(
'id' => 'email', 'id' => 'email',
'header' => $this->l('Email'), 'header' => $this->l('Email'),
'dataIndex' => 'email', 'dataIndex' => 'email',
'width' => 140 'align' => 'center'
), ),
array( array(
'id' => 'totalVisits', 'id' => 'totalVisits',
'header' => $this->l('Visits'), 'header' => $this->l('Visits'),
'dataIndex' => 'totalVisits', 'dataIndex' => 'totalVisits',
'width' => 80, 'align' => 'center'
'align' => 'right'), ),
array( array(
'id' => 'totalValidOrders', 'id' => 'totalValidOrders',
'header' => $this->l('Valid orders'), 'header' => $this->l('Valid orders'),
'dataIndex' => 'totalValidOrders', 'dataIndex' => 'totalValidOrders',
'width' => 80, 'align' => 'center'
'align' => 'right'), ),
array( array(
'id' => 'totalMoneySpent', 'id' => 'totalMoneySpent',
'header' => $this->l('Money spent').' ('.Tools::safeOutput($currency->iso_code).')', 'header' => $this->l('Money spent').' ('.Tools::safeOutput($currency->iso_code).')',
'dataIndex' => 'totalMoneySpent', 'dataIndex' => 'totalMoneySpent',
'width' => 140, 'align' => 'center'
'align' => 'right') )
); );
$this->displayName = $this->l('Best customers'); $this->displayName = $this->l('Best customers');
@@ -116,23 +116,27 @@ class StatsBestCustomers extends ModuleGrid
if (Tools::getValue('export')) if (Tools::getValue('export'))
$this->csvExport($engineParams); $this->csvExport($engineParams);
$this->_html = ' $this->_html = '
<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2> <div class="panel-heading">
'.$this->engine($engineParams).' '.$this->displayName.'
<p><a class="button export-csv" href="'.htmlentities($_SERVER['REQUEST_URI']).'&export=1"><span>'.$this->l('CSV Export').'</span></a></p> </div>
</div><br /> <h4>'.$this->l('Guide').'</h4>
<div class="blocStats"><h2 class="icon-guide"><span></span>'.$this->l('Guide').'</h2> <div class="alert alert-warning">
<h2 >'.$this->l('Develop clients\' loyalty').'</h2> <h4>'.$this->l('Develop clients\' loyalty').'</h4>
<p class="space"> <p>
'.$this->l('Keeping a client is more profitable than gaining a new one. That is one of the many reasons it is necessary to cultivate customer loyalty.').' <br /> '.$this->l('Keeping a client is more profitable than gaining a new one. That is one of the many reasons it is necessary to cultivate customer loyalty.').' <br />
'.$this->l('Word of mouth is also a means for getting new, satisfied clients. A dissatisfied customer can hurt your e-reputation and obstruct future sales goals.').'<br /> '.$this->l('Word of mouth is also a means for getting new, satisfied clients. A dissatisfied customer can hurt your e-reputation and obstruct future sales goals.').'<br />
'.$this->l('In order to achieve this goal, you can organize:').' '.$this->l('In order to achieve this goal, you can organize:').'
<ul> <ul>
<li>'.$this->l('Punctual operations: commercial rewards (personalized special offers, product or service offered), non commercial rewards (priority handling of an order or a product), pecuniary rewards (bonds, discount coupons, payback).').'</li> <li>'.$this->l('Punctual operations: commercial rewards (personalized special offers, product or service offered), non commercial rewards (priority handling of an order or a product), pecuniary rewards (bonds, discount coupons, payback).').'</li>
<li>'.$this->l('Sustainable operations: loyalty points or cards, which not only justify communication between merchant and client, but also offer advantages to clients (private offers, discounts).').'</li> <li>'.$this->l('Sustainable operations: loyalty points or cards, which not only justify communication between merchant and client, but also offer advantages to clients (private offers, discounts).').'</li>
</ul> </ul>
'.$this->l('These operations encourage clients to buy products and visit your e-store regularly.').' '.$this->l('These operations encourage clients to buy products and visit your e-store regularly.').'
</p> </p>
</div>'; </div>
'.$this->engine($engineParams).'
<a class="btn btn-default export-csv" href="'.htmlentities($_SERVER['REQUEST_URI']).'&export=1">
<i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
</a>';
return $this->_html; return $this->_html;
} }
+14 -19
View File
@@ -57,57 +57,49 @@ class StatsBestProducts extends ModuleGrid
'id' => 'reference', 'id' => 'reference',
'header' => $this->l('Ref.'), 'header' => $this->l('Ref.'),
'dataIndex' => 'reference', 'dataIndex' => 'reference',
'align' => 'left', 'align' => 'center'
'width' => 50
), ),
array( array(
'id' => 'name', 'id' => 'name',
'header' => $this->l('Name'), 'header' => $this->l('Name'),
'dataIndex' => 'name', 'dataIndex' => 'name',
'align' => 'left', 'align' => 'center'
'width' => 100
), ),
array( array(
'id' => 'totalQuantitySold', 'id' => 'totalQuantitySold',
'header' => $this->l('Quantity sold'), 'header' => $this->l('Quantity sold'),
'dataIndex' => 'totalQuantitySold', 'dataIndex' => 'totalQuantitySold',
'width' => 50, 'align' => 'center'
'align' => 'right'
), ),
array( array(
'id' => 'avgPriceSold', 'id' => 'avgPriceSold',
'header' => $this->l('Price sold'), 'header' => $this->l('Price sold'),
'dataIndex' => 'avgPriceSold', 'dataIndex' => 'avgPriceSold',
'width' => 50, 'align' => 'center'
'align' => 'right'
), ),
array( array(
'id' => 'totalPriceSold', 'id' => 'totalPriceSold',
'header' => $this->l('Sales'), 'header' => $this->l('Sales'),
'dataIndex' => 'totalPriceSold', 'dataIndex' => 'totalPriceSold',
'width' => 50, 'align' => 'center'
'align' => 'right'
), ),
array( array(
'id' => 'averageQuantitySold', 'id' => 'averageQuantitySold',
'header' => $this->l('Quantity sold in a day.'), 'header' => $this->l('Quantity sold in a day.'),
'dataIndex' => 'averageQuantitySold', 'dataIndex' => 'averageQuantitySold',
'width' => 60, 'align' => 'center'
'align' => 'right'
), ),
array( array(
'id' => 'totalPageViewed', 'id' => 'totalPageViewed',
'header' => $this->l('Page views'), 'header' => $this->l('Page views'),
'dataIndex' => 'totalPageViewed', 'dataIndex' => 'totalPageViewed',
'width' => 60, 'align' => 'center'
'align' => 'right'
), ),
array( array(
'id' => 'quantity', 'id' => 'quantity',
'header' => $this->l('Available quantity for sale.'), 'header' => $this->l('Available quantity for sale.'),
'dataIndex' => 'quantity', 'dataIndex' => 'quantity',
'width' => 150, 'align' => 'center'
'align' => 'right'
) )
); );
@@ -136,10 +128,13 @@ class StatsBestProducts extends ModuleGrid
$this->csvExport($engineParams); $this->csvExport($engineParams);
$this->_html = ' $this->_html = '
<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2> <div class="panel-heading">
'.$this->displayName.'
</div>
'.$this->engine($engineParams).' '.$this->engine($engineParams).'
<p><a class="button export-csv" href="'.htmlentities($_SERVER['REQUEST_URI']).'&export=1"><span>'.$this->l('CSV Export').'</span></a></p> <a class="btn btn-default export-csv" href="'.htmlentities($_SERVER['REQUEST_URI']).'&export=1">
</fieldset>'; <i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
</a>';
return $this->_html; return $this->_html;
} }
@@ -57,22 +57,19 @@ class StatsBestSuppliers extends ModuleGrid
'id' => 'name', 'id' => 'name',
'header' => $this->l('Name'), 'header' => $this->l('Name'),
'dataIndex' => 'name', 'dataIndex' => 'name',
'align' => 'left', 'align' => 'center'
'width' => 200
), ),
array( array(
'id' => 'quantity', 'id' => 'quantity',
'header' => $this->l('Quantity sold'), 'header' => $this->l('Quantity sold'),
'dataIndex' => 'quantity', 'dataIndex' => 'quantity',
'width' => 60, 'align' => 'center'
'align' => 'right'
), ),
array( array(
'id' => 'sales', 'id' => 'sales',
'header' => $this->l('Total paid'), 'header' => $this->l('Total paid'),
'dataIndex' => 'sales', 'dataIndex' => 'sales',
'width' => 60, 'align' => 'center'
'align' => 'right'
) )
); );
@@ -100,10 +97,13 @@ class StatsBestSuppliers extends ModuleGrid
if (Tools::getValue('export') == 1) if (Tools::getValue('export') == 1)
$this->csvExport($engineParams); $this->csvExport($engineParams);
$this->_html = ' $this->_html = '
<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2> <div class="panel-heading">
'.$this->displayName.'
</div>
'.$this->engine($engineParams).' '.$this->engine($engineParams).'
<p><a class="button export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1"><span>'.$this->l('CSV Export').'</span></a></p> <a class="btn btn-default export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1">
</div>'; <i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
</a>';
return $this->_html; return $this->_html;
} }
+10 -11
View File
@@ -57,29 +57,25 @@ class StatsBestVouchers extends ModuleGrid
'id' => 'code', 'id' => 'code',
'header' => $this->l('Code'), 'header' => $this->l('Code'),
'dataIndex' => 'code', 'dataIndex' => 'code',
'align' => 'left', 'align' => 'center'
'width' => 300
), ),
array( array(
'id' => 'name', 'id' => 'name',
'header' => $this->l('Name'), 'header' => $this->l('Name'),
'dataIndex' => 'name', 'dataIndex' => 'name',
'align' => 'left', 'align' => 'center'
'width' => 300
), ),
array( array(
'id' => 'ca', 'id' => 'ca',
'header' => $this->l('Sales'), 'header' => $this->l('Sales'),
'dataIndex' => 'ca', 'dataIndex' => 'ca',
'width' => 30, 'align' => 'center'
'align' => 'right'
), ),
array( array(
'id' => 'total', 'id' => 'total',
'header' => $this->l('Total used'), 'header' => $this->l('Total used'),
'dataIndex' => 'total', 'dataIndex' => 'total',
'width' => 30, 'align' => 'center'
'align' => 'right'
) )
); );
@@ -108,10 +104,13 @@ class StatsBestVouchers extends ModuleGrid
$this->csvExport($engineParams); $this->csvExport($engineParams);
$this->_html = ' $this->_html = '
<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2> <div class="panel-heading">
'.$this->displayName.'
</div>
'.$this->engine($engineParams).' '.$this->engine($engineParams).'
<br /><a class="button export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1"><span>'.$this->l('CSV Export').'</span></a> <a class="btn btn-default export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1">
</div>'; <i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
</a>';
return $this->_html; return $this->_html;
} }
+32 -11
View File
@@ -66,18 +66,39 @@ class StatsCarrier extends ModuleGraph
if (Tools::getValue('export')) if (Tools::getValue('export'))
$this->csvExport(array('type' => 'pie', 'option' => Tools::getValue('id_order_state'))); $this->csvExport(array('type' => 'pie', 'option' => Tools::getValue('id_order_state')));
$this->_html = ' $this->_html = '
<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2> <div class="panel-heading">
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" style="float: right;"> '.$this->displayName.'
<select name="id_order_state"> </div>
<option value="0"'.((!Tools::getValue('id_order_state')) ? ' selected="selected"' : '').'>'.$this->l('All').'</option>'; <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" class="form-horizontal alert">
foreach ($states as $state) <div class="row">
$this->_html .= '<option value="'.$state['id_order_state'].'"'.(($state['id_order_state'] == Tools::getValue('id_order_state')) ? ' selected="selected"' : '').'>'.$state['name'].'</option>'; <div class="col-lg-5 col-lg-offset-6">
$this->_html .= '</select> <select name="id_order_state">
<input type="submit" name="submitState" value="'.$this->l('Filter').'" class="button" /> <option value="0"'.((!Tools::getValue('id_order_state')) ? ' selected="selected"' : '').'>'.$this->l('All').'</option>';
foreach ($states as $state)
$this->_html .= '<option value="'.$state['id_order_state'].'"'.(($state['id_order_state'] == Tools::getValue('id_order_state')) ? ' selected="selected"' : '').'>'.$state['name'].'</option>';
$this->_html .= '</select>
</div>
<div class="col-lg-1">
<input type="submit" name="submitState" value="'.$this->l('Filter').'" class="btn btn-default pull-right" />
</div>
</div>
</form> </form>
<p><img src="../img/admin/down.gif" />'.$this->l('This graph represents the carrier distribution for your orders. You can also narrow the focus of the graph to display distribution for a particular state.').'</p>
'.($result['total'] ? $this->engine(array('type' => 'pie', 'option' => Tools::getValue('id_order_state'))).'<br /><br /> <a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=language"><img src="../img/admin/asterisk.gif" />'.$this->l('CSV Export').'</a>' : $this->l('No valid orders have been received for this period.')).' <div class="alert alert-info">
</div>'; '.$this->l('This graph represents the carrier distribution for your orders. You can also narrow the focus of the graph to display distribution for a particular state.').'
</div>
<div class="row row-margin-bottom">
<div class="col-lg-12">
<div class="col-lg-8">
'.($result['total'] ? $this->engine(array('type' => 'pie', 'option' => Tools::getValue('id_order_state'))).'
</div>
<div class="col-lg-4">
<a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=language" class="btn btn-default">
<i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
</a>' : $this->l('No valid orders have been received for this period.')).'
</div>
</div>
</div>';
return $this->_html; return $this->_html;
} }
+68 -44
View File
@@ -172,66 +172,90 @@ class StatsCatalog extends Module
$html = ' $html = '
<script type="text/javascript" language="javascript">$(\'#calendar\').slideToggle();</script> <script type="text/javascript" language="javascript">$(\'#calendar\').slideToggle();</script>
<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2> <div class="panel-heading">
<div class="margin-form"> '.$this->displayName.'
<form action="" method="post" id="categoriesForm">
<label>
'.$this->l('Choose a category').'
</label>
<select name="id_category" onchange="$(\'#categoriesForm\').submit();">
<option value="0">'.$this->l('All').'</option>';
foreach ($categories as $category)
$html .= '<option value="'.$category['id_category'].'"'.($id_category == $category['id_category'] ? ' selected="selected"' : '').'>'.
$category['name'].'
</option>';
$html .= '
</select>
</form>
</div> </div>
<table> <form action="" method="post" id="categoriesForm" class="form-horizontal">
'.$this->returnLine($this->l('Products available:'), (int)$total).' <div class="row row-margin-bottom">
'.$this->returnLine($this->l('Average price (base price):'), Tools::displayPrice($averagePrice, $this->context->currency)).' <label class="control-label col-lg-3">
'.$this->returnLine($this->l('Product pages viewed:'), (int)$totalPageViewed).' '.$this->l('Choose a category').'
'.$this->returnLine($this->l('Products bought:'), (int)$totalBought).' </label>
'.$this->returnLine($this->l('Average number of page visits:'), number_format((float)$averageViewed, 2, '.', '')).' <div class="col-lg-6">
'.$this->returnLine($this->l('Average number of purchases:'), number_format((float)$averagePurchase, 2, '.', '')).' <select name="id_category" onchange="$(\'#categoriesForm\').submit();">
'.$this->returnLine($this->l('Images available:'), (int)$totalPictures).' <option value="0">'.$this->l('All').'</option>';
'.$this->returnLine($this->l('Average number of images:'), number_format((float)$averagePictures, 2, '.', '')).' foreach ($categories as $category)
'.$this->returnLine($this->l('Products never viewed:'), (int)$totalNV.' / '.(int)$total).' $html .= '<option value="'.$category['id_category'].'"'.($id_category == $category['id_category'] ? ' selected="selected"' : '').'>'.
'.$this->returnLine('<a style="cursor : pointer" onclick="$(\'#pnb\').slideToggle();">'.$this->l('Products never purchased:').'</a>', (int)$totalNB.' / '.(int)$total).' $category['name'].'
'.$this->returnLine($this->l('Conversion rate*:'), $conversion).' </option>';
</table> $html .= '
<div style="margin-top: 20px;"> </select>
<span style="color:red;font-weight:bold">*</span> </div>
'.$this->l('Define the average conversion rate for the product page (It is possible to purchase a product without viewing the product page, so this rate can be greater than 1).').' </div>
</div> </form>
</div>'; <ul class="list-group">
<li class="list-group-item">'.$this->returnLine($this->l('Products available:'), '<span class="badge">'.(int)$total).'</span></li>
<li class="list-group-item">'.$this->returnLine($this->l('Average price (base price):'), '<span class="badge">'.Tools::displayPrice($averagePrice, $this->context->currency)).'</span></li>
<li class="list-group-item">'.$this->returnLine($this->l('Product pages viewed:'), '<span class="badge">'.(int)$totalPageViewed).'</span></li>
<li class="list-group-item">'.$this->returnLine($this->l('Products bought:'), '<span class="badge">'.(int)$totalBought).'</span></li>
<li class="list-group-item">'.$this->returnLine($this->l('Average number of page visits:'), '<span class="badge">'.number_format((float)$averageViewed, 2, '.', '')).'</span></li>
<li class="list-group-item">'.$this->returnLine($this->l('Average number of purchases:'), '<span class="badge">'.number_format((float)$averagePurchase, 2, '.', '')).'</span></li>
<li class="list-group-item">'.$this->returnLine($this->l('Images available:'), '<span class="badge">'.(int)$totalPictures).'</span></li>
<li class="list-group-item">'.$this->returnLine($this->l('Average number of images:'), '<span class="badge">'.number_format((float)$averagePictures, 2, '.', '')).'</span></li>
<li class="list-group-item">'.$this->returnLine($this->l('Products never viewed:'), '<span class="badge">'.(int)$totalNV.' / '.(int)$total).'</span></li>
<li class="list-group-item">'.$this->returnLine('<a style="cursor : pointer" onclick="$(\'#pnb\').slideToggle();">'.$this->l('Products never purchased:').'</a>', '<span class="badge">'.(int)$totalNB.' / '.(int)$total).'</span></li>
<li class="list-group-item">'.$this->returnLine($this->l('Conversion rate*:'), '<span class="badge">'.$conversion).'</span></li>
</ul>
<div class="row row-margin-bottom">
<p>
<i class="icon-asterisk"></i>'.$this->l('Define the average conversion rate for the product page (It is possible to purchase a product without viewing the product page, so this rate can be greater than 1).').'
</p>
</div>';
if (count($productsNB) && count($productsNB) < 50) if (count($productsNB) && count($productsNB) < 50)
{ {
$html .= '<br /> $html .= '
<div class="blocStats"><h2 class="icon-basket-delete"><span></span>'.$this->l('Products never purchased').'</h2> <div class="panel-heading">'.$this->l('Products never purchased').'</div>
<table cellpadding="0" cellspacing="0" class="table"> <table class="table">
<tr><th>'.$this->l('ID').'</th><th>'.$this->l('Name').'</th><th>'.$this->l('Edit / View').'</th></tr>'; <thead>
<tr>
<th><span class="title_box active">'.$this->l('ID').'</span></th>
<th><span class="title_box active">'.$this->l('Name').'</span></th>
<th><span class="title_box active">'.$this->l('Edit / View').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($productsNB as $product) foreach ($productsNB as $product)
$html .= ' $html .= '
<tr'.($irow++ % 2 ? ' class="alt_row"' : '').'> <tr'.($irow++ % 2 ? ' class="alt_row"' : '').'>
<td>'.$product['id_product'].'</td> <td>'.$product['id_product'].'</td>
<td style="width: 400px;">'.$product['name'].'</td> <td>'.$product['name'].'</td>
<td style="text-align: right"> <td class="left">
<a href="index.php?tab=AdminProducts&id_product='.$product['id_product'].'&addproduct&token='.$productToken.'" target="_blank"><img src="../modules/'.$this->name.'/page_edit.png" /></a> <div class="btn-group btn-group-action">
<a href="'.$this->context->link->getProductLink($product['id_product'], $product['link_rewrite']).'" target="_blank"><img src="../modules/'.$this->name.'/application_home.png" /></a> <a class="btn btn-default" href="index.php?tab=AdminProducts&id_product='.$product['id_product'].'&addproduct&token='.$productToken.'" target="_blank">
<i class="icon-edit"></i> '.$this->l('Edit').'
</a>
<button data-toggle="dropdown" class="btn btn-default dropdown-toggle" type="button">
<span class="caret">&nbsp;</span>
</button>
<ul class="dropdown-menu">
<li>
<a href="'.$this->context->link->getProductLink($product['id_product'], $product['link_rewrite']).'" target="_blank">
<i class="icon-eye-open"></i> '.$this->l('See').'
</a>
</li>
</ul>
</div>
</td> </td>
</tr>'; </tr>';
$html .= ' $html .= '
</table> </tbody>
</div>'; </table>';
} }
return $html; return $html;
} }
private function returnLine($label, $data) private function returnLine($label, $data)
{ {
return '<tr><td>'.$label.'</td><td style="color:green;font-weight:bold;padding-left:20px;">'.$data.'</td></tr>'; return '<tr><td>'.$label.'</td><td>'.$data.'</td></tr>';
} }
} }
+114 -92
View File
@@ -155,61 +155,80 @@ class StatsCheckUp extends Module
); );
$this->html = ' $this->html = '
<style type="text/css"> <div class="panel-heading">'
form.checkup input[type=text] {width:30px} .$this->displayName.'
form.checkup div {margin-top:20px}
table.checkup th {text-align:center}
table.checkup td {padding:5px 10px}
table.checkup2 td {text-align:right}
</style>
<div class="blocStats">
<form action="'.AdminController::$currentIndex.'&token='.Tools::safeOutput(Tools::getValue('token')).'&module='.$this->name.'" method="post" class="checkup">
<table class="table checkup" border="0" cellspacing="0" cellspacing="0">
<tr>
<th></th>
<th>'.$arrayColors[0].' '.$this->l('Not enough').'</th>
<th>'.$arrayColors[2].' '.$this->l('Alright').'</th>
</tr>';
foreach ($arrayConf as $conf => $translations)
$this->html .= '<tr>
<th>'.$translations['name'].'</th>
<td>'.$this->l('Less than').'
<input type="text" name="CHECKUP_'.$conf.'_LT"
value="'.Tools::safeOutput(Tools::getValue('CHECKUP_'.$conf.'_LT', Configuration::get('CHECKUP_'.$conf.'_LT'))).'" /> '.$translations['text'].'
</td>
<td>'.$this->l('Greater than').'
<input type="text" name="CHECKUP_'.$conf.'_GT"
value="'.Tools::safeOutput(Tools::getValue('CHECKUP_'.$conf.'_GT', Configuration::get('CHECKUP_'.$conf.'_GT'))).'" /> '.$translations['text'].'
</td>
</tr>';
$this->html .= '</table>
<div><input type="submit" name="submitCheckup" class="button" value="'.$this->l(' Save ').'" /></div>
</form>
</div> </div>
<br /> <form action="'.AdminController::$currentIndex.'&token='.Tools::safeOutput(Tools::getValue('token')).'&module='.$this->name.'" method="post" class="checkup form-horizontal">
<div class="blocStats"> <table class="table checkup">
<form action="'.AdminController::$currentIndex.'&token='.Tools::safeOutput(Tools::getValue('token')).'&module='.$this->name.'" method="post"> <thead>
'.$this->l('Order by').' <tr>
<select name="submitCheckupOrder" onchange="this.form.submit();" style="width:100px"> <th></th>
<option value="1">'.$this->l('ID').'</option> <th><span class="title_box active">'.$arrayColors[0].' '.$this->l('Not enough').'</span></th>
<option value="2" '.($this->context->cookie->checkup_order == 2 ? 'selected="selected"' : '').'>'.$this->l('Name').'</option> <th><span class="title_box active">'.$arrayColors[2].' '.$this->l('Alright').'</span></th>
<option value="3" '.($this->context->cookie->checkup_order == 3 ? 'selected="selected"' : '').'>'.$this->l('Sales').'</option> </tr>
</select> </thead>';
foreach ($arrayConf as $conf => $translations)
$this->html .= '
<tbody>
<tr>
<td>
<label class="control-label col-lg-12">'.$translations['name'].'</label>
</td>
<td>
<div class="row">
<div class="col-lg-11 input-group">
<span class="input-group-addon">'.$this->l('Less than').'</span>
<input type="text" name="CHECKUP_'.$conf.'_LT" value="'.Tools::safeOutput(Tools::getValue('CHECKUP_'.$conf.'_LT', Configuration::get('CHECKUP_'.$conf.'_LT'))).'" />
<span class="input-group-addon">'.$translations['text'].'</span>
</div>
</div>
</td>
<td>
<div class="row">
<div class="col-lg-12 input-group">
<span class="input-group-addon">'.$this->l('Greater than').'</span>
<input type="text" name="CHECKUP_'.$conf.'_GT" value="'.Tools::safeOutput(Tools::getValue('CHECKUP_'.$conf.'_GT', Configuration::get('CHECKUP_'.$conf.'_GT'))).'" />
<span class="input-group-addon">'.$translations['text'].'</span>
</div>
</div>
</td>
</tr>
</tbody>';
$this->html .= '</table>
<button type="submit" name="submitCheckup" class="btn btn-default pull-right">
<i class="icon-save"></i> '.$this->l('Save').'
</button>
</form> </form>
<br /> <form action="'.AdminController::$currentIndex.'&token='.Tools::safeOutput(Tools::getValue('token')).'&module='.$this->name.'" method="post" class="form-horizontal alert">
<table class="table checkup2" border="0" cellspacing="0" cellspacing="0"> <div class="row">
<tr> <div class="col-lg-12">
<th>'.$this->l('ID').'</th> <label class="control-label pull-left">'.$this->l('Order by').'</label>
<th>'.$this->l('Item').'</th> <div class="col-lg-3">
<th>'.$this->l('Active').'</th>'; <select name="submitCheckupOrder" onchange="this.form.submit();">
foreach ($languages as $language) <option value="1">'.$this->l('ID').'</option>
$this->html .= '<th>'.$this->l('Desc.').' ('.strtoupper($language['iso_code']).')</th>'; <option value="2" '.($this->context->cookie->checkup_order == 2 ? 'selected="selected"' : '').'>'.$this->l('Name').'</option>
$this->html .= ' <option value="3" '.($this->context->cookie->checkup_order == 3 ? 'selected="selected"' : '').'>'.$this->l('Sales').'</option>
<th>'.$this->l('Images').'</th> </select>
<th>'.$this->l('Sales').'</th> </div>
<th>'.$this->l('Available quantity for sale').'</th> </div>
<th>'.$this->l('Global').'</th> </div>
</tr>'; </form>
<table class="table checkup2">
<thead>
<tr>
<th><span class="title_box active">'.$this->l('ID').'</span></th>
<th><span class="title_box active">'.$this->l('Item').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Active').'</span></th>';
foreach ($languages as $language)
$this->html .= '<th><span class="title_box active">'.$this->l('Desc.').' ('.strtoupper($language['iso_code']).')</span></th>';
$this->html .= '
<th class="center"><span class="title_box active">'.$this->l('Images').'</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('Available quantity for sale').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Global').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($result as $row) foreach ($result as $row)
{ {
$totals['products']++; $totals['products']++;
@@ -238,23 +257,26 @@ class StatsCheckUp extends Module
$scores['average'] = array_sum($scores) / $divisor; $scores['average'] = array_sum($scores) / $divisor;
$scores['average'] = ($scores['average'] < 1 ? 0 : ($scores['average'] > 1.5 ? 2 : 1)); $scores['average'] = ($scores['average'] < 1 ? 0 : ($scores['average'] > 1.5 ? 2 : 1));
$this->html .= '<tr>
<td>'.$row['id_product'].'</td>
<td style="text-align:left"><a href="index.php?tab=AdminProducts&updateproduct&id_product='.$row['id_product'].'&token='.$tokenProducts.'">'.Tools::substr($row['name'], 0, 42).'</a></td>
<td>'.$arrayColors[$scores['active']].'</td>';
foreach ($languages as $language)
if (isset($row['desclength_'.$language['iso_code']]))
$this->html .= '<td>'.(int)$row['desclength_'.$language['iso_code']].' '.$arrayColors[$scores['description_'.$language['iso_code']]].'</td>';
else
$this->html .= '<td>0 '.$arrayColors[0].'</td>';
$this->html .= ' $this->html .= '
<td>'.(int)$row['nbImages'].' '.$arrayColors[$scores['images']].'</td> <tr>
<td>'.(int)$row['nbSales'].' '.$arrayColors[$scores['sales']].'</td> <td>'.$row['id_product'].'</td>
<td>'.(int)$row['stock'].' '.$arrayColors[$scores['stock']].'</td> <td><a href="index.php?tab=AdminProducts&updateproduct&id_product='.$row['id_product'].'&token='.$tokenProducts.'">'.Tools::substr($row['name'], 0, 42).'</a></td>
<td>'.$arrayColors[$scores['average']].'</td> <td class="center">'.$arrayColors[$scores['active']].'</td>';
</tr>'; foreach ($languages as $language)
if (isset($row['desclength_'.$language['iso_code']]))
$this->html .= '<td class="center">'.(int)$row['desclength_'.$language['iso_code']].' '.$arrayColors[$scores['description_'.$language['iso_code']]].'</td>';
else
$this->html .= '<td>0 '.$arrayColors[0].'</td>';
$this->html .= '
<td class="center">'.(int)$row['nbImages'].' '.$arrayColors[$scores['images']].'</td>
<td class="center">'.(int)$row['nbSales'].' '.$arrayColors[$scores['sales']].'</td>
<td class="center">'.(int)$row['stock'].' '.$arrayColors[$scores['stock']].'</td>
<td class="center">'.$arrayColors[$scores['average']].'</td>
</tr>';
} }
$this->html .= '</tbody>';
$totals['active'] = $totals['active'] / $totals['products']; $totals['active'] = $totals['active'] / $totals['products'];
$totals['active'] = ($totals['active'] < 1 ? 0 : ($totals['active'] > 1.5 ? 2 : 1)); $totals['active'] = ($totals['active'] < 1 ? 0 : ($totals['active'] > 1.5 ? 2 : 1));
$totals['images'] = $totals['images'] / $totals['products']; $totals['images'] = $totals['images'] / $totals['products'];
@@ -272,31 +294,31 @@ class StatsCheckUp extends Module
$totals['average'] = ($totals['average'] < 1 ? 0 : ($totals['average'] > 1.5 ? 2 : 1)); $totals['average'] = ($totals['average'] < 1 ? 0 : ($totals['average'] > 1.5 ? 2 : 1));
$this->html .= ' $this->html .= '
<tr> <tfoot>
<th colspan="2"></th> <tr>
<th>'.$this->l('Active').'</th>'; <th colspan="2"></th>
foreach ($languages as $language) <th class="center"><span class="title_box active">'.$this->l('Active').'</span></th>';
$this->html .= '<th>'.$this->l('Desc.').' ('.strtoupper($language['iso_code']).')</th>'; foreach ($languages as $language)
$this->html .= ' $this->html .= '<th class="center"><span class="title_box active">'.$this->l('Desc.').' ('.strtoupper($language['iso_code']).')</span></th>';
<th>'.$this->l('Images').'</th> $this->html .= '
<th>'.$this->l('Sales').'</th> <th class="center"><span class="title_box active">'.$this->l('Images').'</span></th>
<th>'.$this->l('Available quantity for sale').'</th> <th class="center"><span class="title_box active">'.$this->l('Sales').'</span></th>
<th>'.$this->l('Global').'</th> <th class="center"><span class="title_box active">'.$this->l('Available quantity for sale').'</span></th>
</tr> <th class="center"><span class="title_box active">'.$this->l('Global').'</span></th>
<tr> </tr>
<td colspan="2"></td> <tr>
<td>'.$arrayColors[$totals['active']].'</td>'; <td colspan="2"></td>
foreach ($languages as $language) <td class="center">'.$arrayColors[$totals['active']].'</td>';
$this->html .= '<td>'.$arrayColors[$totals['description_'.$language['iso_code']]].'</td>'; foreach ($languages as $language)
$this->html .= ' $this->html .= '<td class="center">'.$arrayColors[$totals['description_'.$language['iso_code']]].'</td>';
<td>'.$arrayColors[$totals['images']].'</td> $this->html .= '
<td>'.$arrayColors[$totals['sales']].'</td> <td class="center">'.$arrayColors[$totals['images']].'</td>
<td>'.$arrayColors[$totals['stock']].'</td> <td class="center">'.$arrayColors[$totals['sales']].'</td>
<td>'.$arrayColors[$totals['average']].'</td> <td class="center">'.$arrayColors[$totals['stock']].'</td>
</tr> <td class="center">'.$arrayColors[$totals['average']].'</td>
</table> </tr>
</div> </tfoot>
<div class="clear">&nbsp;</div>'; </table>';
return $this->html; return $this->html;
} }
+43 -23
View File
@@ -121,35 +121,55 @@ class StatsEquipment extends ModuleGraph
$equipment = $this->getEquipment(); $equipment = $this->getEquipment();
$this->html = ' $this->html = '
<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2> <div class="panel-heading">'
<p><img src="../img/admin/down.gif" />'.$this->l('Determine the percentage of web browsers used by customers.').'</p> .$this->displayName.'
'.$this->engine(array('type' => 'pie', 'option' => 'wb')).'<br /><br /> </div>
<p><a class="button export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=browser"><span>'.$this->l('CSV Export').'</span></a></p> <h4>'.$this->l('Guide').'</h4>
<p><img src="../img/admin/down.gif" />'.$this->l('Determine the percentage of operating systems used by customers.').'</p> <div class="alert alert-warning">
'.$this->engine(array('type' => 'pie', 'option' => 'os')).' <h4>'.$this->l('Ensure that your website is accessible to all.').'</h4>
<p><a class="button export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=os"><span>'.$this->l('CSV Export').'</span></a></p>'; <p>
'.$this->l('When managing Websites, it is important to keep track of software used by visitors in order to be sure that the site displays the same way for everyone.
PrestaShop was built in order to be compatible with most recent Web browsers and computer operating systems (OS).
However, because you may end up adding advanced features to your Website or even modify the core PrestaShop code, these additions may not be accessible by everyone.
That is why it is a good idea to keep tabs on the percentage of users for each type of software before adding or changing something that only a limited number of users will be able to access.').'
</p>
</div>
<div class="row row-margin-bottom">
<div class="col-lg-12">
<div class="col-lg-8">
'.$this->engine(array('type' => 'pie', 'option' => 'wb')).'
</div>
<div class="col-lg-4">
<p>'.$this->l('Determine the percentage of web browsers used by customers.').'</p>
<hr/>
<a class="btn btn-default export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=browser">
<i class="icon-cloud-upload"></i>'.$this->l('CSV Export').'
</a>
</div>
</div>
</div>
<div class="row row-margin-bottom">
<div class="col-lg-12">
<div class="col-lg-8">
'.$this->engine(array('type' => 'pie', 'option' => 'os')).'
</div>
<div class="col-lg-4">
<p>'.$this->l('Determine the percentage of operating systems used by customers.').'</p>
<hr/>
<a class="btn btn-default export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=os">
<i class="icon-cloud-upload"></i>'.$this->l('CSV Export').'
</a>
</div>
</div>
</div>';
if ($equipment) if ($equipment)
{ {
$this->html .= '<table class="table space" border="0" cellspacing="0" cellpadding="0"> $this->html .= '<table class="table">
<tr><th style="width: 200px">'.$this->l('Plugins').'</th><th></th></tr>'; <tr><th><span class="title_box active">'.$this->l('Plugins').'</th></span><th></th></tr>';
foreach ($equipment as $name => $value) foreach ($equipment as $name => $value)
$this->html .= '<tr><td>'.$name.'</td><td>'.number_format(100 * $value, 2).'%</td></tr>'; $this->html .= '<tr><td>'.$name.'</td><td>'.number_format(100 * $value, 2).'%</td></tr>';
$this->html .= '</table>'; $this->html .= '</table>';
} }
$this->html .= '
</div>
<br />
<div class="blocStats"><h2 class="icon-guide"><span></span>'.$this->l('Guide').'</h2>
<h2>'.$this->l('Ensure that your website is accessible to all.').'</h2>
<p>
'.$this->l('When managing Websites, it is important to keep track of software used by visitors in order to be sure that the site displays the same way for everyone.
PrestaShop was built in order to be compatible with most recent Web browsers and computer operating systems (OS).
However, because you may end up adding advanced features to your Website or even modify the core PrestaShop code, these additions may not be accessible by everyone.
That is why it is a good idea to keep tabs on the percentage of users for each type of software before adding or changing something that only a limited number of users will be able to access.').'
</p><br />
</div>';
return $this->html; return $this->html;
} }
+20 -7
View File
@@ -61,13 +61,26 @@ class StatsNewsletter extends ModuleGraph
if (Tools::getValue('export')) if (Tools::getValue('export'))
$this->csvExport(array('type' => 'line', 'layers' => 3)); $this->csvExport(array('type' => 'line', 'layers' => 3));
$this->_html = ' $this->_html = '
<div class="blocStats"> <div class="panel-heading">
<h2><img src="../modules/'.$this->name.'/logo.gif" /> '.$this->displayName.'</h2> '.$this->displayName.'
<p>'.$this->l('Customer registrations:').' '.(int)$totals['customers'].'</p> </div>
<p>'.$this->l('Visitor registrations: ').' '.(int)$totals['visitors'].'</p> <div class="row row-margin-bottom">
<p>'.$this->l('Both:').' '.(int)$totals['both'].'</p> <div class="col-lg-12">
<div>'.$this->engine(array('type' => 'line', 'layers' => 3)).'</div> <div class="col-lg-8">
<p><a class="button export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1"><span>'.$this->l('CSV Export').'</span></a></p> '.$this->engine(array('type' => 'line', 'layers' => 3)).'
</div>
<div class="col-lg-4">
<ul class="list-unstyled">
<li>'.$this->l('Customer registrations:').' '.(int)$totals['customers'].'</li>
<li>'.$this->l('Visitor registrations: ').' '.(int)$totals['visitors'].'</li>
<li>'.$this->l('Both:').' '.(int)$totals['both'].'</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>'; </div>';
} }
else else
+45 -28
View File
@@ -83,40 +83,57 @@ class StatsOrigin extends ModuleGraph
if (Tools::getValue('export')) if (Tools::getValue('export'))
if (Tools::getValue('exportType') == 'top') if (Tools::getValue('exportType') == 'top')
$this->csvExport(array('type' => 'pie')); $this->csvExport(array('type' => 'pie'));
$this->_html = '<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->l('Origin').'</h2>'; $this->_html = '<div class="panel-heading">'.$this->l('Origin').'</div>';
if (count($websites)) if (count($websites))
{ {
$this->_html .= ' $this->_html .= '
<p><img src="../img/admin/down.gif" />'.$this->l('Here we break down the 10 most popular referral websites that call customers to your e-store.').'</p> <div class="alert alert-info">
<div>'.$this->engine(array('type' => 'pie')).'</div><br /> '.$this->l('Here we break down the 10 most popular referral websites that call customers to your e-store.').'
<p><a class="button export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=top"><span>'.$this->l('CSV Export').'</span></a></p><br /> </div>
<h4>'.$this->l('Guide').'</h4>
<table class="table " border="0" cellspacing="0" cellspacing="0"> <div class="alert alert-warning">
<tr> <h4>'.$this->l('What is a referral website?').'</h4>
<th style="width:400px;">'.$this->l('Origin').'</th> <p>
<th style="width:50px; text-align: right">'.$this->l('Total').'</th> '.$this->l('When visiting a webpage, the referrer is the URL of the previous webpage from which a link was followed.').'<br />
</tr>'; '.$this->l('A referrer enables you to know which keywords visitors use in search engines when browsing for your online store.').'<br /><br />
'.$this->l('A referrer can be:').'
</p>
<ul>
<li>'.$this->l('Someone who posts a link to your shop.').'</li>
<li>'.$this->l('A partner who has agreed to a link exchange in order to attract new customers.').'</li>
</ul>
</div>
<div class="row row-margin-bottom">
<div class="col-lg-12">
<div class="col-lg-8">
'.$this->engine(array('type' => 'pie')).'
</div>
<div class="col-lg-4">
<a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=top" class="btn btn-default">
<i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
</a>
</div>
</div>
</div>
<table class="table">
<thead>
<tr>
<th><span class="title_box active">'.$this->l('Origin').'</span></th>
<th><span class="title_box active">'.$this->l('Total').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($websites as $website => $total) foreach ($websites as $website => $total)
$this->_html .= '<tr> $this->_html .= '
<td>'.(!strstr($website, ' ') ? '<a href="'.Tools::getProtocol().$website.'">' : '').$website.(!strstr($website, ' ') ? '</a>' : '').'</td><td style="text-align: right">'.$total.'</td> <tr>
</tr>'; <td>'.(!strstr($website, ' ') ? '<a href="'.Tools::getProtocol().$website.'">' : '').$website.(!strstr($website, ' ') ? '</a>' : '').'</td><td>'.$total.'</td>
$this->_html .= '</table></div>'; </tr>';
$this->_html .= '
</tbody>
</table>';
} }
else else
$this->_html .= '<p><strong>'.$this->l('Direct links only').'</strong></p>'; $this->_html .= '<p>'.$this->l('Direct links only').'</p>';
$this->_html .= '</div><br />
<div class="blocStats"><h2 class="icon-guide"><span></span>'.$this->l('Guide').'</h2>
<h2>'.$this->l('What is a referral website?').'</h2>
<p>
'.$this->l('When visiting a webpage, the referrer is the URL of the previous webpage from which a link was followed.').'<br />
'.$this->l('A referrer enables you to know which keywords visitors use in search engines when browsing for your online store.').'<br /><br />
'.$this->l('A referrer can be:').'
<ul>
<li class="bullet">'.$this->l('Someone who posts a link to your shop.').'</li>
<li class="bullet">'.$this->l('A partner who has agreed to a link exchange in order to attract new customers.').'</li>
</ul>
</p>
</div>';
return $this->_html; return $this->_html;
} }
@@ -54,7 +54,27 @@ class StatsPersonalInfos extends ModuleGraph
public function hookAdminStatsModules($params) public function hookAdminStatsModules($params)
{ {
$this->html = '<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2>'; $this->html = '
<div class="panel-heading">
'.$this->displayName.'
</div>
<h4>'.$this->l('Guide').'</h4>
<div class="alert alert-warning">
<h4>'.$this->l('Target your audience.').'</h4>
<p>
'.$this->l('In order for each message to have an impact, you need to know who it is being addressed to. ').'
'.$this->l('Defining your target audience is essential when choosing the right tools to win them over.').'
'.$this->l('It is best to limit action to a group -- or groups -- of clients.').'
'.$this->l('Storing registered customer information allows you to accurately define customer profile so you can adapt your special deals and promotions.').'
</p>
<p>
'.$this->l('Increase your sales by').'
<ul>
<li class="bullet">'.$this->l('launching targeted advertisement campaigns.').'</li>
<li class="bullet">'.$this->l('Contact a group of clients by email or newsletter.').'</li>
</ul>
</p>
</div>';
if (count(Customer::getCustomers())) if (count(Customer::getCustomers()))
{ {
if (Tools::getValue('export')) if (Tools::getValue('export'))
@@ -70,44 +90,79 @@ class StatsPersonalInfos extends ModuleGraph
$this->csvExport(array('type' => 'pie', 'option' => 'language')); $this->csvExport(array('type' => 'pie', 'option' => 'language'));
$this->html .= ' $this->html .= '
<p><img src="../img/admin/down.gif" />'.$this->l('Gender distribution allows you to determine the percentage of men and women shoppers in your store. ').'</p> <div class="row row-margin-bottom">
<div>'.$this->engine(array('type' => 'pie', 'option' => 'gender')).'</div><br /> <div class="col-lg-12">
<p><a class="button export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=gender"><span>'.$this->l('CSV Export').'</span></a></p> <div class="col-lg-8">
<br class="clear" /><br /> '.$this->engine(array('type' => 'pie', 'option' => 'gender')).'
<p><img src="../img/admin/down.gif" />'.$this->l('Age ranges allow you to better understand target demographics. ').'</p> </div>
<div>'.$this->engine(array('type' => 'pie', 'option' => 'age')).'</div><br /> <div class="col-lg-4">
<p><a class="button export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=age"><span>'.$this->l('CSV Export').'</span></a></p><br /><br /> <p>'.$this->l('Gender distribution allows you to determine the percentage of men and women shoppers in your store. ').'</p>
<p><img src="../img/admin/down.gif" />'.$this->l('Country distribution allows you to analyze which part of the world your customers are shopping from.').'</p> <hr/>
<div>'.$this->engine(array('type' => 'pie', 'option' => 'country')).'</div><br /> <a class="btn btn-default export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=gender">
<p><a class="button export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=country"><span>'.$this->l('CSV Export').'</span></a></p><br /><br /> <i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
<p><img src="../img/admin/down.gif" />'.$this->l('Currency range allows you to determine which currency your customers are using.').'</p> </a>
<div>'.$this->engine(array('type' => 'pie', 'option' => 'currency')).'</div><br /> </div>
<p><a class="button export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=currency"><span>'.$this->l('CSV Export').'</span></a></p><br /><br /> </div>
<p><img src="../img/admin/down.gif" />'.$this->l('Language distribution allows you to analyze the browsing language used by your customers. ').'</p> </div>
<div>'.$this->engine(array('type' => 'pie', 'option' => 'language')).'</div><br /> <div class="row row-margin-bottom">
<p><a class="button export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=language"><span>'.$this->l('CSV Export').'</span></a></p> <div class="col-lg-12">
</center>'; <div class="col-lg-8">
'.$this->engine(array('type' => 'pie', 'option' => 'age')).'
</div>
<div class="col-lg-4">
<p>'.$this->l('Age ranges allow you to better understand target demographics. ').'</p>
<hr/>
<a class="btn btn-default export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=age">
<i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
</a>
</div>
</div>
</div>
<div class="row row-margin-bottom">
<div class="col-lg-12">
<div class="col-lg-8">
'.$this->engine(array('type' => 'pie', 'option' => 'country')).'
</div>
<div class="col-lg-4">
<p>'.$this->l('Country distribution allows you to analyze which part of the world your customers are shopping from.').'</p>
<hr/>
<a class="btn btn-default export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=country">
<i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
</a>
</div>
</div>
</div>
<div class="row row-margin-bottom">
<div class="col-lg-12">
<div class="col-lg-8">
'.$this->engine(array('type' => 'pie', 'option' => 'currency')).'
</div>
<div class="col-lg-4">
<p>'.$this->l('Currency range allows you to determine which currency your customers are using.').'</p>
<hr/>
<a class="btn btn-default export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=currency">
<i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
</a>
</div>
</div>
</div>
<div class="row row-margin-bottom">
<div class="col-lg-12">
<div class="col-lg-8">
'.$this->engine(array('type' => 'pie', 'option' => 'language')).'
</div>
<div class="col-lg-4">
<p>'.$this->l('Language distribution allows you to analyze the browsing language used by your customers. ').'</p>
<hr/>
<a class="btn btn-default export-csv" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=language">
<i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
</a>
</div>
</div>
</div>';
} }
else else
$this->html .= '<p>'.$this->l('No customers have registered yet.').'</p>'; $this->html .= '<p>'.$this->l('No customers have registered yet.').'</p>';
$this->html .= '
</div><br />
<div class="blocStats"><h2 class="icon-guide"><span></span>'.$this->l('Guide').'</h2>
<h2>'.$this->l('Target your audience.').'</h2>
<p>
'.$this->l('In order for each message to have an impact, you need to know who it is being addressed to. ').'
'.$this->l('Defining your target audience is essential when choosing the right tools to win them over.').'
'.$this->l('It is best to limit action to a group -- or groups -- of clients.').'
'.$this->l('Storing registered customer information allows you to accurately define customer profile so you can adapt your special deals and promotions.').'
</p><br />
<p>
'.$this->l('Increase your sales by').'
<ul>
<li class="bullet">'.$this->l('launching targeted advertisement campaigns.').'</li>
<li class="bullet">'.$this->l('Contact a group of clients by email or newsletter.').'</li>
</ul>
</p><br />
</div>';
return $this->html; return $this->html;
} }
+2 -2
View File
@@ -184,7 +184,7 @@ class StatsProduct extends ModuleGraph
$totalSales = $this->getTotalSales($product->id); $totalSales = $this->getTotalSales($product->id);
$totalViewed = $this->getTotalViewed($product->id); $totalViewed = $this->getTotalViewed($product->id);
$this->html .= '<h4>'.$product->name.' - '.$this->l('Details').'</h4> $this->html .= '<h4>'.$product->name.' - '.$this->l('Details').'</h4>
<div class="row"> <div class="row row-margin-bottom">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="col-lg-8"> <div class="col-lg-8">
'.$this->engine(array('layers' => 2, 'type' => 'line', 'option' => '1-'.$id_product)).' '.$this->engine(array('layers' => 2, 'type' => 'line', 'option' => '1-'.$id_product)).'
@@ -292,7 +292,7 @@ class StatsProduct extends ModuleGraph
$categories = Category::getCategories((int)$this->context->language->id, true, false); $categories = Category::getCategories((int)$this->context->language->id, true, false);
$this->html .= ' $this->html .= '
<form action="" method="post" id="categoriesForm" class="form-horizontal"> <form action="" method="post" id="categoriesForm" class="form-horizontal">
<div class="row row-margin-form"> <div class="row row-margin-bottom">
<label class="control-label col-lg-3" for="id_category"> <label class="control-label col-lg-3" for="id_category">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="'.$this->l('Click on a product to access its statistics!').'"> <span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="'.$this->l('Click on a product to access its statistics!').'">
'.$this->l('Choose a category').' '.$this->l('Choose a category').'
+21 -16
View File
@@ -97,35 +97,40 @@ class StatsSearch extends ModuleGraph
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query.ModuleGraph::getDateBetween().$this->_query2); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query.ModuleGraph::getDateBetween().$this->_query2);
$this->_html = ' $this->_html = '
<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2>'; <div class="panel-heading">
$table = '<div style="overflow-y: scroll; height: 600px;"> '.$this->displayName.'
<table class="table" border="0" cellspacing="0" cellspacing="0"> </div>';
<thead> $table = '
<tr> <table class="table">
<th style="width:400px;">'.$this->l('Keywords').'</th> <thead>
<th style="width:50px; text-align: right">'.$this->l('Occurrences').'</th> <tr>
<th style="width:50px; text-align: right">'.$this->l('Results').'</th> <th><span class="title_box active">'.$this->l('Keywords').'</span></th>
</tr> <th><span class="title_box active">'.$this->l('Occurrences').'</span></th>
</thead><tbody>'; <th><span class="title_box active">'.$this->l('Results').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($result as $row) foreach ($result as $row)
{ {
if (Tools::strlen($row['keywords']) >= Configuration::get('PS_SEARCH_MINWORDLEN')) if (Tools::strlen($row['keywords']) >= Configuration::get('PS_SEARCH_MINWORDLEN'))
$table .= '<tr> $table .= '<tr>
<td>'.$row['keywords'].'</td> <td>'.$row['keywords'].'</td>
<td style="text-align: right">'.$row['occurences'].'</td> <td>'.$row['occurences'].'</td>
<td style="text-align: right">'.$row['total'].'</td> <td>'.$row['total'].'</td>
</tr>'; </tr>';
} }
$table .= '</tbody></table></div>'; $table .= '
</tbody>
</table>';
if (count($result)) if (count($result))
$this->_html .= '<div>'.$this->engine(array('type' => 'pie')).'</div> $this->_html .= '<div>'.$this->engine(array('type' => 'pie')).'</div>
<p><a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1"><img src="../img/admin/asterisk.gif" />'.$this->l('CSV Export').'</a></p> <a class="btn btn-default" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1">
<br class="clear" />'.$table; <i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
</a>'.$table;
else else
$this->_html .= '<p>'.$this->l('No keywords searched more than once have been found.').'</p>'; $this->_html .= '<p>'.$this->l('No keywords searched more than once have been found.').'</p>';
$this->_html .= '</div>';
return $this->_html; return $this->_html;
} }
+64 -49
View File
@@ -84,62 +84,77 @@ class StatsStock extends Module
$this->html .= ' $this->html .= '
<script type="text/javascript">$(\'#calendar\').slideToggle();</script> <script type="text/javascript">$(\'#calendar\').slideToggle();</script>
<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->l('Evaluation of available quantities for sale.').'</h2> <div class="panel-heading">'
<form action="'.$ru.'" method="post"> .$this->l('Evaluation of available quantities for sale.').
<input type="hidden" name="submitCategory" value="1" /> '</div>
'.$this->l('Category').' : <select name="statsstock_id_category" onchange="this.form.submit();"> <form action="'.$ru.'" method="post" class="form-horizontal">
<option value="0">-- '.$this->l('All').' --</option>'; <div class="row row-margin-bottom">
foreach (Category::getSimpleCategories($this->context->language->id) as $category) <label class="control-label col-lg-3">'.$this->l('Category').'</label>
$this->html .= '<option value="'.(int)$category['id_category'].'" '. <div class="col-lg-6">
($this->context->cookie->statsstock_id_category == $category['id_category'] ? 'selected="selected"' : '').'>'. <select name="statsstock_id_category" onchange="this.form.submit();">
$category['name'].' <option value="0">-- '.$this->l('All').' --</option>';
</option>'; foreach (Category::getSimpleCategories($this->context->language->id) as $category)
$this->html .= '</select> $this->html .= '<option value="'.(int)$category['id_category'].'" '.
</form><br />'; ($this->context->cookie->statsstock_id_category == $category['id_category'] ? 'selected="selected"' : '').'>'.
$category['name'].'
</option>';
$this->html .= '
</select>
<input type="hidden" name="submitCategory" value="1" />
</div>
</div>
</form>';
if (!count($products)) if (!count($products))
$this->html .= $this->l('Your catalog is empty.'); $this->html .= '<p>'.$this->l('Your catalog is empty.').'</p>';
else else
{ {
$rollup = array('quantity' => 0, 'wholesale_price' => 0, 'stockvalue' => 0); $rollup = array('quantity' => 0, 'wholesale_price' => 0, 'stockvalue' => 0);
$this->html .= '<table class="table" cellspacing="0" cellpadding="0">
<tr>
<th>'.$this->l('ID').'</th>
<th>'.$this->l('Ref.').'</th>
<th style="width:350px">'.$this->l('Item').'</th>
<th>'.$this->l('Available quantity for sale').'</th>
<th>'.$this->l('Price*').'</th>
<th>'.$this->l('Value').'</th>
</tr>';
foreach ($products as $product)
{
$rollup['quantity'] += $product['quantity'];
$rollup['wholesale_price'] += $product['wholesale_price'];
$rollup['stockvalue'] += $product['stockvalue'];
$this->html .= '<tr>
<td>'.$product['id_product'].'</td>
<td>'.$product['reference'].'</td>
<td>'.$product['name'].'</td>
<td>'.$product['quantity'].'</td>
<td>'.Tools::displayPrice($product['wholesale_price'], $currency).'</td>
<td>'.Tools::displayPrice($product['stockvalue'], $currency).'</td>
</tr>';
}
$this->html .= ' $this->html .= '
<tr> <table class="table">
<th colspan="3"></th> <thead>
<th>'.$this->l('Total quantities').'</th> <tr>
<th>'.$this->l('Avg price').'</th> <th><span class="title_box active">'.$this->l('ID').'</span></th>
<th>'.$this->l('Total value').'</th> <th><span class="title_box active">'.$this->l('Ref.').'</span></th>
</tr> <th><span class="title_box active">'.$this->l('Item').'</span></th>
<tr> <th><span class="title_box active">'.$this->l('Available quantity for sale').'</span></th>
<td colspan="3"></td> <th><span class="title_box active">'.$this->l('Price*').'</span></th>
<td>'.$rollup['quantity'].'</td> <th><span class="title_box active">'.$this->l('Value').'</span></th>
<td>'.Tools::displayPrice($rollup['wholesale_price'] / count($products), $currency).'</td> </tr>
<td>'.Tools::displayPrice($rollup['stockvalue'], $currency).'</td> </thead>
</tr> <tbody>';
foreach ($products as $product)
{
$rollup['quantity'] += $product['quantity'];
$rollup['wholesale_price'] += $product['wholesale_price'];
$rollup['stockvalue'] += $product['stockvalue'];
$this->html .= '<tr>
<td>'.$product['id_product'].'</td>
<td>'.$product['reference'].'</td>
<td>'.$product['name'].'</td>
<td>'.$product['quantity'].'</td>
<td>'.Tools::displayPrice($product['wholesale_price'], $currency).'</td>
<td>'.Tools::displayPrice($product['stockvalue'], $currency).'</td>
</tr>';
}
$this->html .= '
</tbody>
<tfoot>
<tr>
<th colspan="3"></th>
<th><span class="title_box active">'.$this->l('Total quantities').'</span></th>
<th><span class="title_box active">'.$this->l('Avg price').'</span></th>
<th><span class="title_box active">'.$this->l('Total value').'</span></th>
</tr>
<tr>
<td colspan="3"></td>
<td>'.$rollup['quantity'].'</td>
<td>'.Tools::displayPrice($rollup['wholesale_price'] / count($products), $currency).'</td>
<td>'.Tools::displayPrice($rollup['stockvalue'], $currency).'</td>
</tr>
</tfoot>
</table> </table>
<p>* '.$this->l('This section corresponds to the default wholesale price according to the default supplier for the product. An average price is used when the product has attributes.').'</p></div>'; <i class="icon-asterisk"></i> '.$this->l('This section corresponds to the default wholesale price according to the default supplier for the product. An average price is used when the product has attributes.');
return $this->html; return $this->html;
} }