Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions statsdata.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct()
{
$this->name = 'statsdata';
$this->tab = 'administration';
$this->version = '2.1.2';
$this->version = '2.1.3';
$this->author = 'PrestaShop';
$this->need_instance = 0;

Expand All @@ -48,6 +48,7 @@ public function __construct()
public function install()
{
return parent::install()
&& $this->registerHook('displayHeader')
&& $this->registerHook('displayBeforeBodyClosingTag')
&& $this->registerHook('actionAuthentication')
&& $this->registerHook('actionCustomerAccountAdd');
Expand All @@ -68,6 +69,13 @@ public function getContent()
return $html;
}

public function hookDisplayHeader()
{
if (Configuration::get('PS_STATSDATA_PLUGINS')) {
$this->context->controller->registerJavascript('modules-plugindetect', 'modules/' . $this->name . '/js/plugindetect.js', ['position' => 'bottom', 'priority' => 150]);
}
}

public function hookDisplayBeforeBodyClosingTag($params)
{
$script_content_plugins = $this->getScriptPlugins($params);
Expand All @@ -82,8 +90,6 @@ private function getScriptPlugins($params)
Guest::setNewGuest($params['cookie']);

if (Configuration::get('PS_STATSDATA_PLUGINS')) {
$this->context->controller->registerJavascript('modules-plugindetect', 'modules/' . $this->name . '/js/plugindetect.js', ['position' => 'bottom', 'priority' => 150]);

$token = sha1($params['cookie']->id_guest . _COOKIE_KEY_);

return '<script type="text/javascript">
Expand Down
35 changes: 35 additions & 0 deletions upgrade/upgrade-2.1.3.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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 https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}

function upgrade_module_2_1_3($module)
{
$module->registerHook('displayHeader');

return true;
}
Loading