From e33060494a267f69e2c29a940f2f2607a91fd594 Mon Sep 17 00:00:00 2001 From: Ibrahima SOW Date: Tue, 26 Dec 2023 20:47:25 +0000 Subject: [PATCH] Remove paylater banner code + Bump to 2.5.1 --- config.xml | 2 +- gamification.php | 70 +------------------ upgrade/install-2.5.1.php | 32 +++++++++ .../hook/displayBackOfficeHeader.tpl | 62 ---------------- 4 files changed, 34 insertions(+), 132 deletions(-) create mode 100644 upgrade/install-2.5.1.php delete mode 100644 views/templates/hook/displayBackOfficeHeader.tpl diff --git a/config.xml b/config.xml index bfb4582..c42f4a7 100644 --- a/config.xml +++ b/config.xml @@ -2,7 +2,7 @@ gamification - + diff --git a/gamification.php b/gamification.php index 64190aa..93ecf4c 100644 --- a/gamification.php +++ b/gamification.php @@ -46,7 +46,7 @@ public function __construct() { $this->name = 'gamification'; $this->tab = 'administration'; - $this->version = '2.5.0'; + $this->version = '2.5.1'; $this->author = 'PrestaShop'; $this->ps_versions_compliancy = [ 'min' => '1.6.1.0', @@ -82,7 +82,6 @@ public function install() && parent::install() && $this->registerHook('actionAdminControllerSetMedia') && $this->registerHook('displayBackOfficeHeader') - && $this->registerHook('displayAdminAfterHeader') ; } @@ -586,71 +585,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', '<')) { - 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'], 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-2.5.1.php b/upgrade/install-2.5.1.php new file mode 100644 index 0000000..e8722c6 --- /dev/null +++ b/upgrade/install-2.5.1.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_2_5_1($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} -
-
-
-
-
-
-
-
-