Remove statssearch
This commit is contained in:
@@ -189,7 +189,7 @@ class PrestaShopBackupCore
|
||||
{
|
||||
if (!$this->psBackupAll) {
|
||||
$ignore_insert_table = array(_DB_PREFIX_.'connections', _DB_PREFIX_.'connections_page', _DB_PREFIX_
|
||||
.'connections_source', _DB_PREFIX_.'guest', _DB_PREFIX_.'statssearch');
|
||||
.'connections_source', _DB_PREFIX_.'guest');
|
||||
} else {
|
||||
$ignore_insert_table = array();
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ class AdminBackupControllerCore extends AdminController
|
||||
'title' => $this->l('Ignore statistics tables'),
|
||||
'desc' => $this->l('Drop existing tables during import.').'
|
||||
<br />'._DB_PREFIX_.'connections, '._DB_PREFIX_.'connections_page, '._DB_PREFIX_
|
||||
.'connections_source, '._DB_PREFIX_.'guest, '._DB_PREFIX_.'statssearch',
|
||||
.'connections_source, '._DB_PREFIX_.'guest',
|
||||
'cast' => 'intval',
|
||||
'type' => 'bool'
|
||||
),
|
||||
|
||||
@@ -2149,7 +2149,6 @@ class AdminThemesControllerCore extends AdminController
|
||||
'statsproduct',
|
||||
'statsregistrations',
|
||||
'statssales',
|
||||
'statssearch',
|
||||
'statsstock',
|
||||
'statsvisits',
|
||||
'themeconfigurator',
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
2014-03-27 17:21:33 +0100 / MO statssearch : min ps_versions_compliancy modified (1.5.6.1 => 1.6)
|
||||
2014-03-24 15:22:56 +0100 / MO statssearch : ps_versions_compliancy added
|
||||
2014-03-20 14:37:34 +0100 Initial commit
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>statssearch</name>
|
||||
<displayName><![CDATA[Shop search]]></displayName>
|
||||
<version><![CDATA[1.4.1]]></version>
|
||||
<description><![CDATA[Adds a tab showing which keywords have been searched by your store's visitors.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[analytics_stats]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1013 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB |
@@ -1,164 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
class StatsSearch extends ModuleGraph
|
||||
{
|
||||
private $html = '';
|
||||
private $query = '';
|
||||
private $query_group_by = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'statssearch';
|
||||
$this->tab = 'analytics_stats';
|
||||
$this->version = '1.4.1';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->query = 'SELECT `keywords`, COUNT(TRIM(`keywords`)) as occurences, MAX(results) as total
|
||||
FROM `'._DB_PREFIX_.'statssearch`
|
||||
WHERE 1
|
||||
'.Shop::addSqlRestriction().'
|
||||
AND `date_add` BETWEEN ';
|
||||
|
||||
$this->query_group_by = 'GROUP BY `keywords`
|
||||
HAVING occurences > 1
|
||||
ORDER BY occurences DESC';
|
||||
|
||||
$this->displayName = $this->l('Shop search');
|
||||
$this->description = $this->l('Adds a tab to the Stats dashboard, showing which keywords have been searched by your store\'s visitors.');
|
||||
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.7.0.99');
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install() || !$this->registerHook('search') || !$this->registerHook('AdminStatsModules'))
|
||||
return false;
|
||||
|
||||
return Db::getInstance()->execute('
|
||||
CREATE TABLE `'._DB_PREFIX_.'statssearch` (
|
||||
id_statssearch INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
id_shop INTEGER UNSIGNED NOT NULL DEFAULT \'1\',
|
||||
id_shop_group INTEGER UNSIGNED NOT NULL DEFAULT \'1\',
|
||||
keywords VARCHAR(255) NOT NULL,
|
||||
results INT(6) NOT NULL DEFAULT 0,
|
||||
date_add DATETIME NOT NULL,
|
||||
PRIMARY KEY(id_statssearch)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
if (!parent::uninstall())
|
||||
return false;
|
||||
|
||||
return (Db::getInstance()->execute('DROP TABLE `'._DB_PREFIX_.'statssearch`'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert keywords in statssearch table when a search is launched on FO
|
||||
*/
|
||||
public function hookSearch($params)
|
||||
{
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'statssearch` (`id_shop`, `id_shop_group`, `keywords`, `results`, `date_add`)
|
||||
VALUES ('.(int)$this->context->shop->id.', '.(int)$this->context->shop->id_shop_group.', \''.pSQL($params['expr']).'\', '.(int)$params['total'].', NOW())';
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
public function hookAdminStatsModules()
|
||||
{
|
||||
if (Tools::getValue('export'))
|
||||
$this->csvExport(array('type' => 'pie'));
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->query.ModuleGraph::getDateBetween().$this->query_group_by);
|
||||
$this->html = '
|
||||
<div class="panel-heading">
|
||||
'.$this->displayName.'
|
||||
</div>';
|
||||
$table = '
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><span class="title_box active">'.$this->l('Keywords').'</span></th>
|
||||
<th><span class="title_box active">'.$this->l('Occurrences').'</span></th>
|
||||
<th><span class="title_box active">'.$this->l('Results').'</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
|
||||
foreach ($result as $row)
|
||||
{
|
||||
if (Tools::strlen($row['keywords']) >= Configuration::get('PS_SEARCH_MINWORDLEN'))
|
||||
$table .= '<tr>
|
||||
<td>'.$row['keywords'].'</td>
|
||||
<td>'.$row['occurences'].'</td>
|
||||
<td>'.$row['total'].'</td>
|
||||
</tr>';
|
||||
}
|
||||
$table .= '
|
||||
</tbody>
|
||||
</table>';
|
||||
|
||||
if (count($result))
|
||||
$this->html .= '<div>'.$this->engine(array('type' => 'pie')).'</div>
|
||||
<a class="btn btn-default" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1">
|
||||
<i class="icon-cloud-upload"></i> '.$this->l('CSV Export').'
|
||||
</a>'.$table;
|
||||
else
|
||||
$this->html .= '<p>'.$this->l('Cannot find any keywords that have been searched for more than once.').'</p>';
|
||||
|
||||
return $this->html;
|
||||
}
|
||||
|
||||
protected function getData($layers)
|
||||
{
|
||||
$this->_titles['main'] = $this->l('Top 10 keywords');
|
||||
$total_result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->query.$this->getDate().$this->query_group_by);
|
||||
$total = 0;
|
||||
$total2 = 0;
|
||||
foreach ($total_result as $total_row)
|
||||
$total += $total_row['occurences'];
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->query.$this->getDate().$this->query_group_by.' LIMIT 9');
|
||||
foreach ($result as $row)
|
||||
{
|
||||
if (!$row['occurences'])
|
||||
continue;
|
||||
$this->_legend[] = $row['keywords'];
|
||||
$this->_values[] = $row['occurences'];
|
||||
$total2 += $row['occurences'];
|
||||
}
|
||||
if ($total > $total2)
|
||||
{
|
||||
$this->_legend[] = $this->l('Others');
|
||||
$this->_values[] = $total - $total2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
Reference in New Issue
Block a user