From 2bd6d0fbe405fbe989d0471ddfd6682880f93b48 Mon Sep 17 00:00:00 2001 From: Ibrahima SOW Date: Tue, 26 Dec 2023 20:40:40 +0000 Subject: [PATCH] Remove paylater banner code + Bump to 3.0.4 --- config.xml | 2 +- gamification.php | 70 +------------------ upgrade/install-3.0.4.php | 32 +++++++++ .../hook/displayBackOfficeHeader.tpl | 62 ---------------- views/templates/hook/index.php | 35 ---------- 5 files changed, 34 insertions(+), 167 deletions(-) create mode 100755 upgrade/install-3.0.4.php delete mode 100644 views/templates/hook/displayBackOfficeHeader.tpl delete mode 100644 views/templates/hook/index.php diff --git a/config.xml b/config.xml index 0477b72..7c491fb 100644 --- a/config.xml +++ b/config.xml @@ -2,7 +2,7 @@ gamification - + diff --git a/gamification.php b/gamification.php index b27e354..45a1570 100644 --- a/gamification.php +++ b/gamification.php @@ -45,7 +45,7 @@ public function __construct() { $this->name = 'gamification'; $this->tab = 'administration'; - $this->version = '3.0.3'; + $this->version = '3.0.4'; $this->author = 'PrestaShop'; $this->module_key = 'c1187d1672d2a2d33fbd7d5c29f0d42e'; $this->ps_versions_compliancy = [ @@ -77,7 +77,6 @@ public function install() && parent::install() && $this->registerHook('actionAdminControllerSetMedia') && $this->registerHook('displayBackOfficeHeader') - && $this->registerHook('displayAdminAfterHeader') ; } @@ -436,71 +435,4 @@ public function isFresh($file, $timeout = 86400000) return $now < $lastFileUpdate; } - - /** - * Display PrestaShop Paylater with PayPlug & Oney - * - * @return string - */ - public function hookDisplayAdminAfterHeader() - { - // PrestaShop Paylater with PayPlug & Oney is available only from PrestaShop 1.7 - if (version_compare(_PS_VERSION_, '1.7.0.0', '<') || version_compare(_PS_VERSION_, '8.0.0', '>=')) { - return ''; - } - - // Display PrestaShop Paylater with PayPlug & Oney only if PrestaShop Checkout is enabled and onboarded for FR & IT located merchant - if ('AdminPayment' === Tools::getValue('controller') - && in_array($this->getShopCountryCode(), ['FR', 'IT', 'ES', 'BE'], true) - && Module::isEnabled('ps_checkout') - && Configuration::get('PS_CHECKOUT_PAYPAL_ID_MERCHANT') - ) { - $this->context->smarty->assign([ - 'pspaylater_install_link' => $this->getModuleInstallUrl('pspaylater'), - 'pspaylater_configure_link' => $this->context->link->getAdminLink('AdminModules', true) . '&configure=pspaylater', - 'pspaylater_img_path' => $this->getPathUri() . 'views/img/pspaylater.png', - 'pspaylater_enabled' => Module::isEnabled('pspaylater'), - ]); - - return $this->display(__FILE__, 'displayBackOfficeHeader.tpl'); - } - - return ''; - } - - /** - * @return string - */ - private function getShopCountryCode() - { - $defaultCountry = ''; - - if (empty($defaultCountry) && Configuration::hasKey('PS_COUNTRY_DEFAULT')) { - $defaultCountry = (new Country((int) Configuration::get('PS_COUNTRY_DEFAULT')))->iso_code; - } - - return $defaultCountry ? strtoupper($defaultCountry) : ''; - } - - /** - * @param string $name - * - * @return string - */ - private function getModuleInstallUrl($name) - { - if (version_compare(_PS_VERSION_, '1.7.0.0', '>=')) { - return $this->context->link->getAdminLink( - 'AdminModulesSf', - true, - [ - 'route' => 'admin_module_manage_action', - 'action' => 'install', - 'module_name' => $name, - ] - ); - } - - return $this->context->link->getAdminLink('AdminModules') . '&install=' . $name . '&tab_module=payments_gateways&module_name=' . $name . '&anchor=' . ucfirst($name); - } } diff --git a/upgrade/install-3.0.4.php b/upgrade/install-3.0.4.php new file mode 100755 index 0000000..4607f30 --- /dev/null +++ b/upgrade/install-3.0.4.php @@ -0,0 +1,32 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +/** + * @param Module $module + * + * @return bool + */ +function upgrade_module_3_0_4($module) +{ + return (bool) $module->unregisterHook('displayAdminAfterHeader'); +} diff --git a/views/templates/hook/displayBackOfficeHeader.tpl b/views/templates/hook/displayBackOfficeHeader.tpl deleted file mode 100644 index 3246e31..0000000 --- a/views/templates/hook/displayBackOfficeHeader.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{** - * 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 version 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 and Contributors - * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 - *} - -
-
-
-
-

- extension {l s='Boost your sales by offering payment in 3 or 4 installments to your customers' mod='gamification'} -

-
-
-
-
- {l s='PrestaShop Paylater with PayPlug & Oney' mod='gamification'} -
-
-

{l s='PrestaShop Paylater is the official PrestaShop payment in installments solution.' mod='gamification'}

-
    -
  • {l s='Up to 70% increase in average shopping cart value on your store' mod='gamification'}
  • -
  • {l s='Full coverage for fraud and outstanding payments' mod='gamification'}
  • -
  • {l s='Up to 98% payment acceptance rate for your shoppers' mod='gamification'}
  • -
-
-
-
- {if $pspaylater_enabled} - - {l s='Configure' mod='gamification'} - - {else} -
- -
- {/if} -
-
-
-
-
-
-
-
-
diff --git a/views/templates/hook/index.php b/views/templates/hook/index.php deleted file mode 100644 index ceb411b..0000000 --- a/views/templates/hook/index.php +++ /dev/null @@ -1,35 +0,0 @@ - -* @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;