Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use hook AdminStatsModules alias, use displayAdminStatsModules & Bump version to 2.1.1 #27

Merged
merged 1 commit into from Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.xml
Expand Up @@ -2,7 +2,7 @@
<module>
<name>statsproduct</name>
<displayName><![CDATA[Product details]]></displayName>
<version><![CDATA[2.1.0]]></version>
<version><![CDATA[2.1.1]]></version>
<description><![CDATA[Adds detailed statistics for each product to the Stats dashboard.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[analytics_stats]]></tab>
Expand Down
6 changes: 3 additions & 3 deletions statsproduct.php
Expand Up @@ -39,7 +39,7 @@ public function __construct()
{
$this->name = 'statsproduct';
$this->tab = 'analytics_stats';
$this->version = '2.1.0';
$this->version = '2.1.1';
$this->author = 'PrestaShop';
$this->need_instance = 0;

Expand All @@ -52,7 +52,7 @@ public function __construct()

public function install()
{
return (parent::install() && $this->registerHook('AdminStatsModules'));
return (parent::install() && $this->registerHook('displayAdminStatsModules'));
}

public function getTotalBought($id_product)
Expand Down Expand Up @@ -156,7 +156,7 @@ private function getCrossSales($id_product, $id_lang)
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
}

public function hookAdminStatsModules()
public function hookDisplayAdminStatsModules()
{
$id_category = (int)Tools::getValue('id_category');
$currency = Context::getContext()->currency;
Expand Down
35 changes: 35 additions & 0 deletions upgrade/index.php
@@ -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)
*/

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;
33 changes: 33 additions & 0 deletions upgrade/upgrade-2.1.1.php
@@ -0,0 +1,33 @@

<?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.
*
* @author PrestaShop SA <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)
*/

/**
* @param Module $module
*
* @return bool
*/
function upgrade_module_2_1_1($module)
{
$module->unregisterHook('AdminStatsModules');
$module->registerHook('displayAdminStatsModules');

return true;
}