From bf6767a3634d2684f23d061058ed29553029e958 Mon Sep 17 00:00:00 2001 From: Marek Gach Date: Tue, 12 Nov 2019 19:23:23 +0100 Subject: [PATCH] Add platform information --- .../controllers/admin/AdminSmartsuppAjax.php | 17 +++++++++++++++-- smartsupp/smartsupp.php | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/smartsupp/controllers/admin/AdminSmartsuppAjax.php b/smartsupp/controllers/admin/AdminSmartsuppAjax.php index a6a5c3a..ee23b9c 100644 --- a/smartsupp/controllers/admin/AdminSmartsuppAjax.php +++ b/smartsupp/controllers/admin/AdminSmartsuppAjax.php @@ -43,7 +43,12 @@ public function init() switch (Tools::getValue('action')) { case 'login': - $response = $api->login(array('email' => Tools::getValue('email'), 'password' => Tools::getValue('password'))); + $response = $api->login(array( + 'email' => Tools::getValue('email'), + 'password' => Tools::getValue('password'), + 'platform' => 'Prestashop ' . _PS_VERSION_, + )); + Configuration::updateValue('SMARTSUPP_KEY', $response['account']['key']); Configuration::updateValue('SMARTSUPP_EMAIL', Tools::getValue('email')); break; @@ -52,7 +57,15 @@ public function init() if (array_key_exists($language, $this->languageMap)) { $language = $this->languageMap[$language]; } - $response = $api->create(array('email' => Tools::getValue('email'), 'password' => Tools::getValue('password'), 'partnerKey' => $this->partnerKey, 'lang' => $language, 'consentTerms' => 1)); + $response = $api->create(array( + 'email' => Tools::getValue('email'), + 'password' => Tools::getValue('password'), + 'partnerKey' => $this->partnerKey, + 'lang' => $language, + 'consentTerms' => 1, + 'platform' => 'Prestashop ' . _PS_VERSION_, + )); + Configuration::updateValue('SMARTSUPP_KEY', $response['account']['key']); Configuration::updateValue('SMARTSUPP_EMAIL', Tools::getValue('email')); break; diff --git a/smartsupp/smartsupp.php b/smartsupp/smartsupp.php index c90cd5c..9dffd83 100644 --- a/smartsupp/smartsupp.php +++ b/smartsupp/smartsupp.php @@ -197,6 +197,7 @@ protected function getSmartsuppJs($smartsupp_key) } $chat = new ChatGenerator($smartsupp_key); + $chat->setPlatform('Prestashop ' . _PS_VERSION_); $chat->setCookieDomain('.' . Tools::getHttpHost(false)); $customer = $this->context->customer;