From e73e50ecf2dcce3a2982413ea644e6b907083a9f Mon Sep 17 00:00:00 2001 From: Gytautas Date: Mon, 14 Jul 2025 10:27:42 +0300 Subject: [PATCH 01/10] SMAR-26 PrestaShop 9 compatibility and cloudsync integration --- composer.json | 5 +- composer.lock | 222 ++++++++++++++++++- config/admin/services.yml | 2 + config/common.yml | 12 + module_dependencies.json | 10 + smartsupp.php | 181 ++++++++++++--- views/templates/admin/cloudsync.tpl | 14 ++ views/templates/admin/dependency_builder.tpl | 17 ++ views/templates/admin/ps_accounts.tpl | 6 + 9 files changed, 427 insertions(+), 42 deletions(-) create mode 100644 config/admin/services.yml create mode 100644 config/common.yml create mode 100644 module_dependencies.json create mode 100644 views/templates/admin/cloudsync.tpl create mode 100644 views/templates/admin/dependency_builder.tpl create mode 100644 views/templates/admin/ps_accounts.tpl diff --git a/composer.json b/composer.json index 8d8dfaf..ca794a1 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,10 @@ "require": { "php": ">=5.6.0", "smartsupp/chat-code-generator": "^1.0", - "smartsupp/php-partner-client": "^1.0" + "smartsupp/php-partner-client": "^1.0", + "prestashop/prestashop-accounts-installer": "^1.0.1", + "prestashop/module-lib-service-container": "v2.0", + "prestashop/module-lib-mbo-installer": "^3.0.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 509e8be..9e60e34 100644 --- a/composer.lock +++ b/composer.lock @@ -4,27 +4,222 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8c62af103569bb882c558226bd17bdcd", + "content-hash": "02a96e9f067ad2b321bee380e3b9e910", "packages": [ + { + "name": "prestashop/module-lib-cache-directory-provider", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/PrestaShopCorp/module-lib-cache-directory-provider.git", + "reference": "34a577b66a7e52ae16d6f40efd1db17290bad453" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PrestaShopCorp/module-lib-cache-directory-provider/zipball/34a577b66a7e52ae16d6f40efd1db17290bad453", + "reference": "34a577b66a7e52ae16d6f40efd1db17290bad453", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "require-dev": { + "phpunit/phpunit": "~5.7" + }, + "type": "project", + "autoload": { + "psr-4": { + "PrestaShop\\ModuleLibCacheDirectoryProvider\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AFL-3.0" + ], + "authors": [ + { + "name": "PrestaShop SA", + "email": "contact@prestashop.com" + } + ], + "description": "Cache directory provider to use on prestashop modules", + "keywords": [ + "composer", + "modules", + "package", + "prestashop" + ], + "support": { + "issues": "https://github.com/PrestaShopCorp/module-lib-cache-directory-provider/issues", + "source": "https://github.com/PrestaShopCorp/module-lib-cache-directory-provider/tree/master" + }, + "time": "2020-09-08T14:13:23+00:00" + }, + { + "name": "prestashop/module-lib-mbo-installer", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/PrestaShopCorp/module-lib-mbo-installer.git", + "reference": "46fbb457e9241b4f8b0c3f9fdabcb9feba0d0303" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PrestaShopCorp/module-lib-mbo-installer/zipball/46fbb457e9241b4f8b0c3f9fdabcb9feba0d0303", + "reference": "46fbb457e9241b4f8b0c3f9fdabcb9feba0d0303", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=5.6" + }, + "require-dev": { + "phpstan/phpstan": "^1.9", + "phpunit/phpunit": "^9.5|^8.5|^5.7", + "prestashop/php-dev-tools": "^4.2|^3.16" + }, + "type": "library", + "autoload": { + "psr-4": { + "Prestashop\\ModuleLibMboInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AFL-3.0" + ], + "authors": [ + { + "name": "PrestaShop SA", + "email": "contact@prestashop.com" + }, + { + "name": "Mikatux", + "email": "mickael@mayeur.eu" + } + ], + "description": "A helper to ease the download PS MBO from the Addons Marketplace", + "support": { + "issues": "https://github.com/PrestaShopCorp/module-lib-mbo-installer/issues", + "source": "https://github.com/PrestaShopCorp/module-lib-mbo-installer/tree/v3.0.0" + }, + "time": "2025-02-24T15:19:05+00:00" + }, + { + "name": "prestashop/module-lib-service-container", + "version": "v2.0", + "source": { + "type": "git", + "url": "https://github.com/PrestaShopCorp/module-lib-service-container.git", + "reference": "5525b56513d9ddad6e4232dfd93a24e028efdca7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PrestaShopCorp/module-lib-service-container/zipball/5525b56513d9ddad6e4232dfd93a24e028efdca7", + "reference": "5525b56513d9ddad6e4232dfd93a24e028efdca7", + "shasum": "" + }, + "require": { + "php": ">=5.6.0", + "prestashop/module-lib-cache-directory-provider": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "~5.7" + }, + "suggest": { + "symfony/config": "Needed when the running PrestaShop does not already run with Symfony", + "symfony/dependency-injection": "Needed when the running PrestaShop does not already run with Symfony", + "symfony/expression-language": "Needed when the running PrestaShop does not already run with Symfony", + "symfony/yaml": "Needed when the running PrestaShop does not already run with Symfony" + }, + "type": "library", + "autoload": { + "psr-4": { + "PrestaShop\\ModuleLibServiceContainer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AFL-3.0" + ], + "authors": [ + { + "name": "PrestaShop SA", + "email": "contact@prestashop.com" + } + ], + "description": "Service container to use on prestashop modules", + "keywords": [ + "composer", + "modules", + "package", + "prestashop" + ], + "support": { + "issues": "https://github.com/PrestaShopCorp/module-lib-service-container/issues", + "source": "https://github.com/PrestaShopCorp/module-lib-service-container/tree/v2.0" + }, + "time": "2022-06-20T08:30:47+00:00" + }, + { + "name": "prestashop/prestashop-accounts-installer", + "version": "v1.0.4", + "source": { + "type": "git", + "url": "https://github.com/PrestaShopCorp/prestashop-accounts-installer.git", + "reference": "0ad934bc540558db3944a9a1e5b08b852bb46e8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PrestaShopCorp/prestashop-accounts-installer/zipball/0ad934bc540558db3944a9a1e5b08b852bb46e8b", + "reference": "0ad934bc540558db3944a9a1e5b08b852bb46e8b", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16", + "fzaninotto/faker": "^1.9", + "phpunit/phpunit": "^5.7", + "prestashop/php-dev-tools": "3.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "PrestaShop\\PsAccountsInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Utility package to install `ps_accounts` module or present data to trigger manual install from psx configuration page.", + "support": { + "issues": "https://github.com/PrestaShopCorp/prestashop-accounts-installer/issues", + "source": "https://github.com/PrestaShopCorp/prestashop-accounts-installer/tree/v1.0.4" + }, + "time": "2023-05-04T07:24:48+00:00" + }, { "name": "smartsupp/chat-code-generator", - "version": "1.0.1", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/smartsupp/chat-code-generator.git", - "reference": "1f63b44aeb90a1cd9e37b260a35b0ccb3377feea" + "reference": "5c92d0c531365df8641996652cec8aedb4f7cc15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/smartsupp/chat-code-generator/zipball/1f63b44aeb90a1cd9e37b260a35b0ccb3377feea", - "reference": "1f63b44aeb90a1cd9e37b260a35b0ccb3377feea", + "url": "https://api.github.com/repos/smartsupp/chat-code-generator/zipball/5c92d0c531365df8641996652cec8aedb4f7cc15", + "reference": "5c92d0c531365df8641996652cec8aedb4f7cc15", "shasum": "" }, "require": { "php": ">=5.3.2" }, "require-dev": { - "phpunit/phpunit": "4.7.*" + "phpunit/phpunit": "4.8.*" }, "type": "library", "extra": { @@ -49,7 +244,12 @@ "keywords": [ "chat" ], - "time": "2018-11-08T15:36:32+00:00" + "support": { + "issues": "https://github.com/smartsupp/chat-code-generator/issues", + "source": "https://github.com/smartsupp/chat-code-generator", + "wiki": "https://github.com/smartsupp/chat-code-generator/wiki" + }, + "time": "2025-06-06T07:36:42+00:00" }, { "name": "smartsupp/php-partner-client", @@ -89,6 +289,11 @@ "keywords": [ "chat" ], + "support": { + "issues": "https://github.com/smartsupp/php-partner-client/issues", + "source": "https://github.com/smartsupp/php-partner-client", + "wiki": "https://github.com/smartsupp/php-partner-client/wiki" + }, "time": "2019-09-30T15:08:09+00:00" } ], @@ -101,5 +306,6 @@ "platform": { "php": ">=5.6.0" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "2.2.0" } diff --git a/config/admin/services.yml b/config/admin/services.yml new file mode 100644 index 0000000..a39ee22 --- /dev/null +++ b/config/admin/services.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../common.yml } \ No newline at end of file diff --git a/config/common.yml b/config/common.yml new file mode 100644 index 0000000..e925501 --- /dev/null +++ b/config/common.yml @@ -0,0 +1,12 @@ +services: + PrestaShop\PsAccountsInstaller\Installer\Installer: + class: 'PrestaShop\PsAccountsInstaller\Installer\Installer' + public: true + arguments: + - "7.0.0" + + PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts: + class: 'PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts' + public: true + arguments: + - '@PrestaShop\PsAccountsInstaller\Installer\Installer' \ No newline at end of file diff --git a/module_dependencies.json b/module_dependencies.json new file mode 100644 index 0000000..1d1d8cb --- /dev/null +++ b/module_dependencies.json @@ -0,0 +1,10 @@ +{ + "dependencies": [ + { + "name" : "ps_accounts" + }, + { + "name" : "ps_eventbus" + } + ] +} \ No newline at end of file diff --git a/smartsupp.php b/smartsupp.php index 44d6996..c9bf580 100755 --- a/smartsupp.php +++ b/smartsupp.php @@ -19,22 +19,38 @@ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt */ +use PrestaShop\Module\PsEventbus\Service\PresenterService; +use PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts; use Smartsupp\LiveChat\Utility\VersionUtility; if (!defined('_PS_VERSION_')) { exit; } +if (file_exists(__DIR__ . '/vendor/autoload.php')) { + require_once __DIR__ . '/vendor/autoload.php'; +} + class Smartsupp extends Module { + const PRESTASHOP_CLOUDSYNC_CDC = 'https://assets.prestashop3.com/ext/cloudsync-merchant-sync-consent/latest/cloudsync-cdc.js'; + + /** + * @var PrestaShop\ModuleLibServiceContainer\DependencyInjection\ServiceContainer + */ + private $serviceContainer; + public function __construct() { + // Parameter for cloudsync consent component + $this->useLightMode = true; + $this->name = 'smartsupp'; $this->tab = 'advertising_marketing'; - $this->version = '2.2.3'; + $this->version = '2.2.4'; $this->author = 'Smartsupp'; $this->need_instance = 0; - $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); + $this->ps_versions_compliancy = ['min' => '1.6', 'max' => _PS_VERSION_]; $this->bootstrap = true; $this->module_key = 'da5110815a9ea717be24a57b804d24fb'; @@ -49,8 +65,6 @@ public function __construct() include _PS_MODULE_DIR_ . $this->name . '/backward_compatibility/backward.php'; } - $this->autoload(); - if (!Configuration::get('SMARTSUPP_KEY')) { $this->warning = $this->l('No Smartsupp key provided.'); } @@ -72,31 +86,29 @@ public function install() $tab->id_parent = -1; $tab->module = $this->name; - $backOfficeHookSuccess = false; - - if (VersionUtility::isPsVersionGreaterThan('1.6')) { - $backOfficeHookSuccess = $this->registerHook('displayBackOfficeHeader'); + if (VersionUtility::isPsVersionGreaterOrEqualTo('1.6')) { + $this->registerHook('displayBackOfficeHeader'); } else { - $backOfficeHookSuccess = $this->registerHook('backOfficeHeader'); + $this->registerHook('backOfficeHeader'); } - if (!$tab->add() - || !parent::install() - || !$this->registerHook('displayHeader') - || !$backOfficeHookSuccess - || !Configuration::updateValue('SMARTSUPP_KEY', '') - || !Configuration::updateValue('SMARTSUPP_EMAIL', '') - || !Configuration::updateValue('SMARTSUPP_CUSTOMER_ID', '1') - || !Configuration::updateValue('SMARTSUPP_CUSTOMER_NAME', '1') - || !Configuration::updateValue('SMARTSUPP_CUSTOMER_EMAIL', '1') - || !Configuration::updateValue('SMARTSUPP_CUSTOMER_PHONE', '1') - || !Configuration::updateValue('SMARTSUPP_CUSTOMER_ROLE', '1') - || !Configuration::updateValue('SMARTSUPP_CUSTOMER_SPENDINGS', '1') - || !Configuration::updateValue('SMARTSUPP_CUSTOMER_ORDERS', '1') - || !Configuration::updateValue('SMARTSUPP_OPTIONAL_API', '') - ) { - return false; - } + parent::install(); + + $tab->add(); + + Configuration::updateValue('SMARTSUPP_KEY', ''); + Configuration::updateValue('SMARTSUPP_EMAIL', ''); + Configuration::updateValue('SMARTSUPP_CUSTOMER_ID', '1'); + Configuration::updateValue('SMARTSUPP_CUSTOMER_NAME', '1'); + Configuration::updateValue('SMARTSUPP_CUSTOMER_EMAIL', '1'); + Configuration::updateValue('SMARTSUPP_CUSTOMER_PHONE', '1'); + Configuration::updateValue('SMARTSUPP_CUSTOMER_ROLE', '1'); + Configuration::updateValue('SMARTSUPP_CUSTOMER_SPENDINGS', '1'); + Configuration::updateValue('SMARTSUPP_CUSTOMER_ORDERS', '1'); + Configuration::updateValue('SMARTSUPP_OPTIONAL_API', ''); + + $this->registerHook('displayHeader'); + $this->registerHook('displayBackOfficeHeader'); return true; } @@ -114,7 +126,7 @@ public function uninstall() $tab->delete(); } - if (VersionUtility::isPsVersionGreaterThan('1.6')) { + if (VersionUtility::isPsVersionGreaterOrEqualTo('1.6')) { $this->unregisterHook('displayBackOfficeHeader'); } else { $this->unregisterHook('backOfficeHeader'); @@ -204,6 +216,29 @@ public function displayForm() public function getContent() { + $mboInstaller = new Prestashop\ModuleLibMboInstaller\DependencyBuilder($this); + $psDependencies = ''; + + if (!$mboInstaller->areDependenciesMet()) { + $dependencies = $mboInstaller->handleDependencies(); + $this->context->smarty->assign('dependencies', $dependencies); + + return $this->context->smarty->fetch($this->getLocalPath() . 'views/templates/admin/dependency_builder.tpl'); + } + + try { + $this->loadPsAccounts(); + $this->loadCloudSync(); + + $psDependencies .= $this->context->smarty->fetch($this->getLocalPath() . 'views/templates/admin/ps_accounts.tpl'); + $psDependencies .= $this->context->smarty->fetch($this->getLocalPath() . '/views/templates/admin/cloudsync.tpl'); + + } catch (\Exception $exception) { + $this->errors[] = $this->l('Unable to load your PrestaShop accounts details. Please contact support.', 'SmartsUpp'); + \PrestaShopLogger::addLog($exception->getMessage(), 3, null, 'SmartsUpp', null, true); + return $psDependencies; + } + $output = ''; if (Tools::isSubmit('submit' . $this->name)) { $smartsupp_key = Configuration::get('SMARTSUPP_KEY'); @@ -226,7 +261,8 @@ public function getContent() ) ); - return $this->display(__FILE__, 'views/templates/admin/landing_page.tpl') . + return $psDependencies . + $this->display(__FILE__, 'views/templates/admin/landing_page.tpl') . $this->display(__FILE__, 'views/templates/admin/connect_account.tpl') . $this->display(__FILE__, 'views/templates/admin/configuration.tpl') . $output; @@ -357,7 +393,11 @@ public function hookDisplayBackOfficeHeader() ]); $path = $this->_path; - $this->context->controller->addJquery(); + + if (!VersionUtility::isPsVersionGreaterOrEqualTo('9.0.0')) { + $this->context->controller->addJquery(); + } + $this->context->controller->addJs($path . 'views/js/smartsupp.js'); $this->context->controller->addCSS($path . 'views/css/smartsupp.css'); $this->context->controller->addCSS($path . 'views/css/smartsupp-nobootstrap.css'); @@ -366,13 +406,88 @@ public function hookDisplayBackOfficeHeader() return $js; } - protected function getAdminDir() + /** + * @return string + * + * @throws \PrestaShop\PsAccountsInstaller\Installer\Exception\ModuleNotInstalledException + * @throws \PrestaShop\PsAccountsInstaller\Installer\Exception\ModuleVersionException + */ + private function loadPsAccounts() { - return basename(_PS_ADMIN_DIR_); + /** @var PsAccounts $accountsFacade */ + $accountsFacade = $this->getService(PsAccounts::class); + + $psAccountsPresenter = $accountsFacade->getPsAccountsPresenter(); + $psAccountsService = $accountsFacade->getPsAccountsService(); + + $existing = $this->context->smarty->getTemplateVars('smartsupp') ?? []; + + $this->context->smarty->assign('smartsupp', array_merge_recursive($existing, [ + 'url' => [ + 'psAccountsCdnUrl' => $psAccountsService->getAccountsCdn(), + ], + ])); + + $previousJsDef = isset(\Media::getJsDef()['smartsupp']) ? \Media::getJsDef()['smartsupp'] : []; + + \Media::addJsDef([ + 'contextPsAccounts' => $psAccountsPresenter->present(), + 'smartsupp' => array_merge($previousJsDef, [ + 'isPsAccountsLinked' => $psAccountsService->isAccountLinked(), + ]), + ]); } - private function autoload() + /** + * @return void + * + * @throws PrestaShopException + */ + private function loadCloudSync() { - include_once "{$this->getLocalPath()}vendor/autoload.php"; + $eventbusModule = \Module::getInstanceByName('ps_eventbus'); + + if (!$eventbusModule) { + \PrestaShopLogger::addLog('Module ps_eventbus not found', 3, null, 'SmartsUpp', null, true); + return; + } + + /** @var PresenterService $eventbusPresenterService */ + $eventbusPresenterService = $eventbusModule->getService(PresenterService::class); + + $existing = $this->context->smarty->getTemplateVars('smartsupp') ?? []; + + $this->context->smarty->assign('smartsupp', array_merge_recursive($existing, [ + 'url' => [ + 'cloudSyncPathCDC' => self::PRESTASHOP_CLOUDSYNC_CDC, + ], + ])); + $previousJsDef = isset(\Media::getJsDef()['smartsupp']) ? \Media::getJsDef()['smartsupp'] : []; + + \Media::addJsDef([ + 'contextPsEventbus' => $eventbusPresenterService->expose($this, ['info']), + 'smartsupp' => array_merge($previousJsDef, [ + 'url' => [ + 'cloudSyncPathCDC' => self::PRESTASHOP_CLOUDSYNC_CDC, + ], + ]), + ]); + } + + /** + * @param string $serviceName + * + * @return mixed + */ + public function getService($serviceName) + { + if ($this->serviceContainer === null) { + $this->serviceContainer = new \PrestaShop\ModuleLibServiceContainer\DependencyInjection\ServiceContainer( + $this->name . str_replace(['.', '-', '+'], '', $this->version), + $this->getLocalPath() + ); + } + + return $this->serviceContainer->getService($serviceName); } } diff --git a/views/templates/admin/cloudsync.tpl b/views/templates/admin/cloudsync.tpl new file mode 100644 index 0000000..1caf4b6 --- /dev/null +++ b/views/templates/admin/cloudsync.tpl @@ -0,0 +1,14 @@ +
+ + + + \ No newline at end of file diff --git a/views/templates/admin/dependency_builder.tpl b/views/templates/admin/dependency_builder.tpl new file mode 100644 index 0000000..e00cceb --- /dev/null +++ b/views/templates/admin/dependency_builder.tpl @@ -0,0 +1,17 @@ + + + + +
+ + \ No newline at end of file diff --git a/views/templates/admin/ps_accounts.tpl b/views/templates/admin/ps_accounts.tpl new file mode 100644 index 0000000..5bbbdc7 --- /dev/null +++ b/views/templates/admin/ps_accounts.tpl @@ -0,0 +1,6 @@ + + + + \ No newline at end of file From 38a551ebe13579da6d559be612ca244d0bc01305 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Mon, 14 Jul 2025 10:52:51 +0300 Subject: [PATCH 02/10] hook registering adjustment --- smartsupp.php | 66 ++++++++++++-------- translations/cs.php | 0 views/css/smartsupp.css | 0 views/img/all-changes-saved.png | Bin views/img/all-done.png | Bin views/img/avatar-grey.png | Bin views/img/chatbot asset.png | Bin views/img/chatbot.png | Bin views/img/dashboard.png | Bin views/img/done.png | Bin views/img/icon-20x20.png | Bin views/img/index.php | 0 views/img/insportline.png | Bin views/img/logo.png | Bin views/img/mobile.png | Bin views/img/motorgarten.png | Bin views/img/multichannel.png | Bin views/img/redfox.png | Bin views/img/smartsupp_logo.png | Bin views/img/tablet-screen.png | Bin views/img/travelking.png | Bin views/js/smartsupp.js | 0 views/templates/admin/configuration.tpl | 0 views/templates/admin/connect_account.tpl | 0 views/templates/admin/includes/clients.tpl | 0 views/templates/admin/includes/features.tpl | 0 views/templates/admin/landing_page.tpl | 0 views/templates/front/chat_widget.tpl | 0 28 files changed, 41 insertions(+), 25 deletions(-) mode change 100755 => 100644 smartsupp.php mode change 100755 => 100644 translations/cs.php mode change 100755 => 100644 views/css/smartsupp.css mode change 100755 => 100644 views/img/all-changes-saved.png mode change 100755 => 100644 views/img/all-done.png mode change 100755 => 100644 views/img/avatar-grey.png mode change 100755 => 100644 views/img/chatbot asset.png mode change 100755 => 100644 views/img/chatbot.png mode change 100755 => 100644 views/img/dashboard.png mode change 100755 => 100644 views/img/done.png mode change 100755 => 100644 views/img/icon-20x20.png mode change 100755 => 100644 views/img/index.php mode change 100755 => 100644 views/img/insportline.png mode change 100755 => 100644 views/img/logo.png mode change 100755 => 100644 views/img/mobile.png mode change 100755 => 100644 views/img/motorgarten.png mode change 100755 => 100644 views/img/multichannel.png mode change 100755 => 100644 views/img/redfox.png mode change 100755 => 100644 views/img/smartsupp_logo.png mode change 100755 => 100644 views/img/tablet-screen.png mode change 100755 => 100644 views/img/travelking.png mode change 100755 => 100644 views/js/smartsupp.js mode change 100755 => 100644 views/templates/admin/configuration.tpl mode change 100755 => 100644 views/templates/admin/connect_account.tpl mode change 100755 => 100644 views/templates/admin/includes/clients.tpl mode change 100755 => 100644 views/templates/admin/includes/features.tpl mode change 100755 => 100644 views/templates/admin/landing_page.tpl mode change 100755 => 100644 views/templates/front/chat_widget.tpl diff --git a/smartsupp.php b/smartsupp.php old mode 100755 new mode 100644 index c9bf580..7f936d9 --- a/smartsupp.php +++ b/smartsupp.php @@ -72,43 +72,60 @@ public function __construct() public function install() { + // Must succeed before proceeding + if (!parent::install()) { + return false; + } + if (version_compare(_PS_VERSION_, '1.6', '>=') && Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } + // Register appropriate hook + $hookRegistered = version_compare(_PS_VERSION_, '1.6', '>=') + ? $this->registerHook('displayBackOfficeHeader') + : $this->registerHook('backOfficeHeader'); + + if (!$hookRegistered || !$this->registerHook('displayHeader')) { + return false; + } + + // Create Tab $tab = new Tab(); $tab->active = 1; $tab->class_name = 'AdminSmartsuppAjax'; - $tab->name = array(); + $tab->name = []; + foreach (Language::getLanguages(true) as $lang) { $tab->name[$lang['id_lang']] = 'Smartsupp'; } + $tab->id_parent = -1; $tab->module = $this->name; - if (VersionUtility::isPsVersionGreaterOrEqualTo('1.6')) { - $this->registerHook('displayBackOfficeHeader'); - } else { - $this->registerHook('backOfficeHeader'); + if (!$tab->add()) { + return false; } - parent::install(); - - $tab->add(); - - Configuration::updateValue('SMARTSUPP_KEY', ''); - Configuration::updateValue('SMARTSUPP_EMAIL', ''); - Configuration::updateValue('SMARTSUPP_CUSTOMER_ID', '1'); - Configuration::updateValue('SMARTSUPP_CUSTOMER_NAME', '1'); - Configuration::updateValue('SMARTSUPP_CUSTOMER_EMAIL', '1'); - Configuration::updateValue('SMARTSUPP_CUSTOMER_PHONE', '1'); - Configuration::updateValue('SMARTSUPP_CUSTOMER_ROLE', '1'); - Configuration::updateValue('SMARTSUPP_CUSTOMER_SPENDINGS', '1'); - Configuration::updateValue('SMARTSUPP_CUSTOMER_ORDERS', '1'); - Configuration::updateValue('SMARTSUPP_OPTIONAL_API', ''); - - $this->registerHook('displayHeader'); - $this->registerHook('displayBackOfficeHeader'); + // Configuration values to be stored + $configValues = [ + 'SMARTSUPP_KEY' => '', + 'SMARTSUPP_EMAIL' => '', + 'SMARTSUPP_CUSTOMER_ID' => '1', + 'SMARTSUPP_CUSTOMER_NAME' => '1', + 'SMARTSUPP_CUSTOMER_EMAIL' => '1', + 'SMARTSUPP_CUSTOMER_PHONE' => '1', + 'SMARTSUPP_CUSTOMER_ROLE' => '1', + 'SMARTSUPP_CUSTOMER_SPENDINGS' => '1', + 'SMARTSUPP_CUSTOMER_ORDERS' => '1', + 'SMARTSUPP_OPTIONAL_API' => '', + ]; + + foreach ($configValues as $key => $value) { + if (!Configuration::updateValue($key, $value)) { + return false; + } + } return true; } @@ -223,7 +240,7 @@ public function getContent() $dependencies = $mboInstaller->handleDependencies(); $this->context->smarty->assign('dependencies', $dependencies); - return $this->context->smarty->fetch($this->getLocalPath() . 'views/templates/admin/dependency_builder.tpl'); + $psDependencies = $this->context->smarty->fetch($this->getLocalPath() . 'views/templates/admin/dependency_builder.tpl'); } try { @@ -234,9 +251,8 @@ public function getContent() $psDependencies .= $this->context->smarty->fetch($this->getLocalPath() . '/views/templates/admin/cloudsync.tpl'); } catch (\Exception $exception) { - $this->errors[] = $this->l('Unable to load your PrestaShop accounts details. Please contact support.', 'SmartsUpp'); + $this->errors[] = $this->l('Unable to load your PrestaShop accounts details.', 'SmartsUpp'); \PrestaShopLogger::addLog($exception->getMessage(), 3, null, 'SmartsUpp', null, true); - return $psDependencies; } $output = ''; diff --git a/translations/cs.php b/translations/cs.php old mode 100755 new mode 100644 diff --git a/views/css/smartsupp.css b/views/css/smartsupp.css old mode 100755 new mode 100644 diff --git a/views/img/all-changes-saved.png b/views/img/all-changes-saved.png old mode 100755 new mode 100644 diff --git a/views/img/all-done.png b/views/img/all-done.png old mode 100755 new mode 100644 diff --git a/views/img/avatar-grey.png b/views/img/avatar-grey.png old mode 100755 new mode 100644 diff --git a/views/img/chatbot asset.png b/views/img/chatbot asset.png old mode 100755 new mode 100644 diff --git a/views/img/chatbot.png b/views/img/chatbot.png old mode 100755 new mode 100644 diff --git a/views/img/dashboard.png b/views/img/dashboard.png old mode 100755 new mode 100644 diff --git a/views/img/done.png b/views/img/done.png old mode 100755 new mode 100644 diff --git a/views/img/icon-20x20.png b/views/img/icon-20x20.png old mode 100755 new mode 100644 diff --git a/views/img/index.php b/views/img/index.php old mode 100755 new mode 100644 diff --git a/views/img/insportline.png b/views/img/insportline.png old mode 100755 new mode 100644 diff --git a/views/img/logo.png b/views/img/logo.png old mode 100755 new mode 100644 diff --git a/views/img/mobile.png b/views/img/mobile.png old mode 100755 new mode 100644 diff --git a/views/img/motorgarten.png b/views/img/motorgarten.png old mode 100755 new mode 100644 diff --git a/views/img/multichannel.png b/views/img/multichannel.png old mode 100755 new mode 100644 diff --git a/views/img/redfox.png b/views/img/redfox.png old mode 100755 new mode 100644 diff --git a/views/img/smartsupp_logo.png b/views/img/smartsupp_logo.png old mode 100755 new mode 100644 diff --git a/views/img/tablet-screen.png b/views/img/tablet-screen.png old mode 100755 new mode 100644 diff --git a/views/img/travelking.png b/views/img/travelking.png old mode 100755 new mode 100644 diff --git a/views/js/smartsupp.js b/views/js/smartsupp.js old mode 100755 new mode 100644 diff --git a/views/templates/admin/configuration.tpl b/views/templates/admin/configuration.tpl old mode 100755 new mode 100644 diff --git a/views/templates/admin/connect_account.tpl b/views/templates/admin/connect_account.tpl old mode 100755 new mode 100644 diff --git a/views/templates/admin/includes/clients.tpl b/views/templates/admin/includes/clients.tpl old mode 100755 new mode 100644 diff --git a/views/templates/admin/includes/features.tpl b/views/templates/admin/includes/features.tpl old mode 100755 new mode 100644 diff --git a/views/templates/admin/landing_page.tpl b/views/templates/admin/landing_page.tpl old mode 100755 new mode 100644 diff --git a/views/templates/front/chat_widget.tpl b/views/templates/front/chat_widget.tpl old mode 100755 new mode 100644 From 281311c35e17fff31dff7104e81f6bb9b1b5b99a Mon Sep 17 00:00:00 2001 From: Gytautas Date: Mon, 14 Jul 2025 14:10:08 +0300 Subject: [PATCH 03/10] ps16 compatability --- smartsupp.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/smartsupp.php b/smartsupp.php index 7f936d9..5f472ae 100644 --- a/smartsupp.php +++ b/smartsupp.php @@ -233,17 +233,20 @@ public function displayForm() public function getContent() { - $mboInstaller = new Prestashop\ModuleLibMboInstaller\DependencyBuilder($this); $psDependencies = ''; - if (!$mboInstaller->areDependenciesMet()) { - $dependencies = $mboInstaller->handleDependencies(); - $this->context->smarty->assign('dependencies', $dependencies); + try { + if (VersionUtility::isPsVersionGreaterOrEqualTo('1.7.0')) { + $mboInstaller = new Prestashop\ModuleLibMboInstaller\DependencyBuilder($this); - $psDependencies = $this->context->smarty->fetch($this->getLocalPath() . 'views/templates/admin/dependency_builder.tpl'); - } + if (!$mboInstaller->areDependenciesMet()) { + $dependencies = $mboInstaller->handleDependencies(); + $this->context->smarty->assign('dependencies', $dependencies); + + $psDependencies = $this->context->smarty->fetch($this->getLocalPath() . 'views/templates/admin/dependency_builder.tpl'); + } + } - try { $this->loadPsAccounts(); $this->loadCloudSync(); From 5c08ea7904451abda5a73790186af44c58f6e8f9 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Thu, 24 Jul 2025 10:10:50 +0300 Subject: [PATCH 04/10] small adjustments for lower php versions --- smartsupp.php | 17 ++++++++++++----- views/templates/admin/cloudsync.tpl | 4 +++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/smartsupp.php b/smartsupp.php index 5f472ae..cb758c8 100644 --- a/smartsupp.php +++ b/smartsupp.php @@ -439,7 +439,8 @@ private function loadPsAccounts() $psAccountsPresenter = $accountsFacade->getPsAccountsPresenter(); $psAccountsService = $accountsFacade->getPsAccountsService(); - $existing = $this->context->smarty->getTemplateVars('smartsupp') ?? []; + $smartsuppVar = $this->context->smarty->getTemplateVars('smartsupp'); + $existing = $smartsuppVar !== null ? $smartsuppVar : []; $this->context->smarty->assign('smartsupp', array_merge_recursive($existing, [ 'url' => [ @@ -474,20 +475,26 @@ private function loadCloudSync() /** @var PresenterService $eventbusPresenterService */ $eventbusPresenterService = $eventbusModule->getService(PresenterService::class); - $existing = $this->context->smarty->getTemplateVars('smartsupp') ?? []; + $smartsuppVar = $this->context->smarty->getTemplateVars('smartsupp'); + $existing = $smartsuppVar !== null ? $smartsuppVar : []; $this->context->smarty->assign('smartsupp', array_merge_recursive($existing, [ 'url' => [ - 'cloudSyncPathCDC' => self::PRESTASHOP_CLOUDSYNC_CDC, - ], + 'cloudSyncPathCDC' => defined('self::PRESTASHOP_CLOUDSYNC_CDC') + ? self::PRESTASHOP_CLOUDSYNC_CDC + : '', + ], ])); + $previousJsDef = isset(\Media::getJsDef()['smartsupp']) ? \Media::getJsDef()['smartsupp'] : []; \Media::addJsDef([ 'contextPsEventbus' => $eventbusPresenterService->expose($this, ['info']), 'smartsupp' => array_merge($previousJsDef, [ 'url' => [ - 'cloudSyncPathCDC' => self::PRESTASHOP_CLOUDSYNC_CDC, + 'cloudSyncPathCDC' => defined('self::PRESTASHOP_CLOUDSYNC_CDC') + ? self::PRESTASHOP_CLOUDSYNC_CDC + : '', ], ]), ]); diff --git a/views/templates/admin/cloudsync.tpl b/views/templates/admin/cloudsync.tpl index 1caf4b6..d3fb630 100644 --- a/views/templates/admin/cloudsync.tpl +++ b/views/templates/admin/cloudsync.tpl @@ -1,6 +1,8 @@
- +{if isset($smartsupp.url.cloudSyncPathCDC)} + +{/if} '; - - return $chat->render() . $custom_code; + return $chat->render(); } public function hookDisplayHeader() { $smartsupp_key = Configuration::get('SMARTSUPP_KEY'); - $this->smarty->assign(array('smartsupp_js' => $this->getSmartsuppJs($smartsupp_key))); + $this->smarty->assign(array( + 'smartsupp_js' => $this->getSmartsuppJs($smartsupp_key), + 'smartsupp_optional_api' => $smartsupp_key ? trim(Configuration::get('SMARTSUPP_OPTIONAL_API')) : '', + )); return $this->display(__FILE__, './views/templates/front/chat_widget.tpl'); } @@ -391,10 +390,11 @@ public function hookBackOfficeHeader() ], ]); - $path = $this->_path; - $js .= ''; - $js .= ''; - $js .= ''; + $this->context->smarty->assign([ + 'smartsupp_module_path' => $this->_path, + ]); + + $js .= $this->display(__FILE__, 'views/templates/admin/backoffice_header.tpl'); } return $js; diff --git a/src/Utility/VersionUtility.php b/src/Utility/VersionUtility.php index 7c49b3d..ee75108 100644 --- a/src/Utility/VersionUtility.php +++ b/src/Utility/VersionUtility.php @@ -21,6 +21,10 @@ namespace Smartsupp\LiveChat\Utility; +if (!defined('_PS_VERSION_')) { + exit; +} + class VersionUtility { public static function isPsVersionGreaterThan($version) diff --git a/src/Validator/UserCredentialsValidator.php b/src/Validator/UserCredentialsValidator.php index d7e5e71..ef88d8f 100644 --- a/src/Validator/UserCredentialsValidator.php +++ b/src/Validator/UserCredentialsValidator.php @@ -21,6 +21,10 @@ namespace Smartsupp\LiveChat\Validator; +if (!defined('_PS_VERSION_')) { + exit; +} + class UserCredentialsValidator { const FILE_NAME = 'UserCredentialsValidator'; diff --git a/src/Validator/index.php b/src/Validator/index.php new file mode 100644 index 0000000..ed66748 --- /dev/null +++ b/src/Validator/index.php @@ -0,0 +1,30 @@ + + * @link http://www.smartsupp.com + * @copyright 2016 Smartsupp.com + * @license GPL-2.0+ + * + * Plugin Name: Smartsupp Live Chat + * Plugin URI: http://www.smartsupp.com + * Description: Adds Smartsupp Live Chat code to PrestaShop. + * Version: 2.2.0 + * Author: Smartsupp + * Author URI: http://www.smartsupp.com + * Text Domain: smartsupp + * License: GPL-2.0+ + * License URI: http://www.gnu.org/licenses/gpl-2.0.txt + */ + +header('Expires: Mon, 26 Jul 1998 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; diff --git a/upgrade/upgrade-2.2.0.php b/upgrade/upgrade-2.2.0.php index ebdfb59..8d08dff 100644 --- a/upgrade/upgrade-2.2.0.php +++ b/upgrade/upgrade-2.2.0.php @@ -21,6 +21,10 @@ use Smartsupp\LiveChat\Utility\VersionUtility; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * @param Module $module * diff --git a/views/templates/admin/backoffice_header.tpl b/views/templates/admin/backoffice_header.tpl new file mode 100644 index 0000000..ad26574 --- /dev/null +++ b/views/templates/admin/backoffice_header.tpl @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/views/templates/front/chat_widget.tpl b/views/templates/front/chat_widget.tpl index 8e2428d..8336718 100644 --- a/views/templates/front/chat_widget.tpl +++ b/views/templates/front/chat_widget.tpl @@ -15,4 +15,9 @@ **/ ?> -{$smartsupp_js nofilter} \ No newline at end of file +{$smartsupp_js nofilter} +{if isset($smartsupp_optional_api) && $smartsupp_optional_api} + +{/if} \ No newline at end of file From e793489d26cc02b90713a81ecc6af8e6fbb61ba5 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Tue, 19 Aug 2025 09:20:48 +0300 Subject: [PATCH 06/10] fix: depracated method fix --- smartsupp.php | 7 ++--- src/Utility/PriceUtility.php | 52 ++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 src/Utility/PriceUtility.php diff --git a/smartsupp.php b/smartsupp.php index fd6e3f1..3b2e3a3 100644 --- a/smartsupp.php +++ b/smartsupp.php @@ -21,6 +21,7 @@ use PrestaShop\Module\PsEventbus\Service\PresenterService; use PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts; +use Smartsupp\LiveChat\Utility\PriceUtility; use Smartsupp\LiveChat\Utility\VersionUtility; if (!defined('_PS_VERSION_')) { @@ -353,7 +354,7 @@ protected function getSmartsuppJs($smartsupp_key) $chat->setVariable( 'spending', $this->l('Spendings'), - Tools::displayPrice( + PriceUtility::displayPrice( $spending, $this->context->currency->id ) @@ -371,10 +372,10 @@ protected function getSmartsuppJs($smartsupp_key) public function hookDisplayHeader() { $smartsupp_key = Configuration::get('SMARTSUPP_KEY'); - $this->smarty->assign(array( + $this->smarty->assign([ 'smartsupp_js' => $this->getSmartsuppJs($smartsupp_key), 'smartsupp_optional_api' => $smartsupp_key ? trim(Configuration::get('SMARTSUPP_OPTIONAL_API')) : '', - )); + ]); return $this->display(__FILE__, './views/templates/front/chat_widget.tpl'); } diff --git a/src/Utility/PriceUtility.php b/src/Utility/PriceUtility.php new file mode 100644 index 0000000..9da3748 --- /dev/null +++ b/src/Utility/PriceUtility.php @@ -0,0 +1,52 @@ + + * @link http://www.smartsupp.com + * @copyright 2016 Smartsupp.com + * @license GPL-2.0+ + * + * Plugin Name: Smartsupp Live Chat + * Plugin URI: http://www.smartsupp.com + * Description: Adds Smartsupp Live Chat code to PrestaShop. + * Version: 2.2.0 + * Author: Smartsupp + * Author URI: http://www.smartsupp.com + * Text Domain: smartsupp + * License: GPL-2.0+ + * License URI: http://www.gnu.org/licenses/gpl-2.0.txt + */ + +namespace Smartsupp\LiveChat\Utility; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class PriceUtility +{ + public static function displayPrice($price, $currency = null) + { + if (VersionUtility::isPsVersionGreaterOrEqualTo('9.0.0')) { + $context = \Context::getContext(); + $isoCode = $currency && isset($currency->iso_code) + ? $currency->iso_code + : $context->currency->iso_code; + + $locale = $context->getCurrentLocale(); + + if (!$locale) { + return (string) $price; + } + + return $locale->formatPrice( + $price, + $isoCode + ); + } + + return \Tools::displayPrice($price, $currency); + } +} \ No newline at end of file From 4933d8de5a6fb1de88910d5715f6a7a0c724b154 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Tue, 19 Aug 2025 09:49:58 +0300 Subject: [PATCH 07/10] escape variables --- views/templates/admin/backoffice_header.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/views/templates/admin/backoffice_header.tpl b/views/templates/admin/backoffice_header.tpl index ad26574..a4d6cfc 100644 --- a/views/templates/admin/backoffice_header.tpl +++ b/views/templates/admin/backoffice_header.tpl @@ -1,3 +1,3 @@ - - - \ No newline at end of file + + + \ No newline at end of file From 80a92524869dc16315dce65735c5985b22c2976d Mon Sep 17 00:00:00 2001 From: Gytautas Date: Tue, 19 Aug 2025 10:21:22 +0300 Subject: [PATCH 08/10] small fixes --- smartsupp.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/smartsupp.php b/smartsupp.php index 3b2e3a3..97182b2 100644 --- a/smartsupp.php +++ b/smartsupp.php @@ -154,14 +154,14 @@ public function uninstall() || !$this->unregisterHook('displayHeader') || !Configuration::deleteByName('SMARTSUPP_KEY') || !Configuration::deleteByName('SMARTSUPP_EMAIL') - || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_ID', '') - || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_NAME', '') - || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_EMAIL', '') - || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_PHONE', '') - || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_ROLE', '') - || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_SPENDINGS', '') - || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_ORDERS', '') - || !Configuration::deleteByName('SMARTSUPP_OPTIONAL_API', '') + || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_ID') + || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_NAME') + || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_EMAIL') + || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_PHONE') + || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_ROLE') + || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_SPENDINGS') + || !Configuration::deleteByName('SMARTSUPP_CUSTOMER_ORDERS') + || !Configuration::deleteByName('SMARTSUPP_OPTIONAL_API') ) { return false; } From 009af1d7d29a4ca7b0b7a413101fe87101f6e12e Mon Sep 17 00:00:00 2001 From: MarijusDilys Date: Thu, 2 Oct 2025 14:29:33 +0300 Subject: [PATCH 09/10] init --- smartsupp.php | 2 +- upgrade/upgrade-2.2.5.php | 40 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 upgrade/upgrade-2.2.5.php diff --git a/smartsupp.php b/smartsupp.php index 97182b2..2b898e6 100644 --- a/smartsupp.php +++ b/smartsupp.php @@ -48,7 +48,7 @@ public function __construct() $this->name = 'smartsupp'; $this->tab = 'advertising_marketing'; - $this->version = '2.2.4'; + $this->version = '2.2.5'; $this->author = 'Smartsupp'; $this->need_instance = 0; $this->ps_versions_compliancy = ['min' => '1.6', 'max' => _PS_VERSION_]; diff --git a/upgrade/upgrade-2.2.5.php b/upgrade/upgrade-2.2.5.php new file mode 100644 index 0000000..35238a7 --- /dev/null +++ b/upgrade/upgrade-2.2.5.php @@ -0,0 +1,40 @@ + + * @copyright 2016 Smartsupp.com + * @license GPL-2.0+ + * @package Smartsupp + * @link http://www.smartsupp.com + * + * Plugin Name: Smartsupp Live Chat + * Plugin URI: http://www.smartsupp.com + * Description: Adds Smartsupp Live Chat code to PrestaShop. + * Version: 2.2.0 + * Text Domain: smartsupp + * Author: Smartsupp + * Author URI: http://www.smartsupp.com + * License: GPL-2.0+ + * License URI: http://www.gnu.org/licenses/gpl-2.0.txt + */ + +use Smartsupp\LiveChat\Utility\VersionUtility; + +if (!defined('_PS_VERSION_')) { + exit; +} + +/** + * @param Module $module + * + * @return bool + */ +function upgrade_module_2_2_5($module) +{ + if (VersionUtility::isPsVersionGreaterThan('1.6')) { + $module->unregisterHook('header'); + } + + return true; +} From 87df5cb6f7b73974cfcc88262eb101a9ed868e04 Mon Sep 17 00:00:00 2001 From: MarijusDilys Date: Thu, 2 Oct 2025 14:53:52 +0300 Subject: [PATCH 10/10] fix --- smartsupp.php | 2 +- upgrade/upgrade-2.2.5.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/smartsupp.php b/smartsupp.php index 2b898e6..71544cc 100644 --- a/smartsupp.php +++ b/smartsupp.php @@ -11,7 +11,7 @@ * Plugin Name: Smartsupp Live Chat * Plugin URI: http://www.smartsupp.com * Description: Adds Smartsupp Live Chat code to PrestaShop. - * Version: 2.2.3 + * Version: 2.2.5 * Author: Smartsupp * Author URI: http://www.smartsupp.com * Text Domain: smartsupp diff --git a/upgrade/upgrade-2.2.5.php b/upgrade/upgrade-2.2.5.php index 35238a7..a36c747 100644 --- a/upgrade/upgrade-2.2.5.php +++ b/upgrade/upgrade-2.2.5.php @@ -11,7 +11,7 @@ * Plugin Name: Smartsupp Live Chat * Plugin URI: http://www.smartsupp.com * Description: Adds Smartsupp Live Chat code to PrestaShop. - * Version: 2.2.0 + * Version: 2.2.5 * Text Domain: smartsupp * Author: Smartsupp * Author URI: http://www.smartsupp.com