From 65fd5747a422bceefcbc12bb039bfa6096470eb2 Mon Sep 17 00:00:00 2001 From: Alexander Mykhailenko Date: Fri, 3 Jun 2022 00:42:30 +0300 Subject: [PATCH] Prestashop 1.7.7.* doesn't list the sender addresses under the home menu. ## Description - Fixed issue with displaying list of senders on the home screen of Mailjet module --- .gitignore | 1 + classes/MailJetTemplate.php | 2 +- mailjet.php | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6bdd118..830bb21 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ translations/translation_* config_*.xml backward_compatibility /nbproject/* +logs/*.log diff --git a/classes/MailJetTemplate.php b/classes/MailJetTemplate.php index 4e73162..ecc0346 100644 --- a/classes/MailJetTemplate.php +++ b/classes/MailJetTemplate.php @@ -85,7 +85,7 @@ public function __construct() /** * Get the api connection * @static - * @return null + * @return Mailjet_ApiOverlay|Mailjet_Api|null */ public static function getApi($with_overlay = true) { diff --git a/mailjet.php b/mailjet.php index dc7dede..b72ed80 100644 --- a/mailjet.php +++ b/mailjet.php @@ -1474,6 +1474,12 @@ public function getContent() } $tab = ['class_name' => 'AdminModules']; $link = $this->context->link->getTabLink($tab) . '&configure=' . $this->name . '&conf=4&token=' . Tools::getAdminTokenLite('AdminModules') . '&sync_list=true'; + + $api = MailjetTemplate::getApi(); + $infos = $api->getUser(); + $mjSenders = $api->getSenders(null, $infos); + $currentSender = Configuration::get('PS_SHOP_EMAIL'); + $this->context->smarty->assign(array( 'MJ_templates' => $this->mj_template->getTemplates(), 'MJ_iframes' => $this->mj_template->getIframesURL(), @@ -1489,6 +1495,8 @@ public function getContent() 'MJ_adminmodules_link' => $this->getAdminModuleLink(array()), 'MJ_REQUEST_PAGE_TYPE' => MailJetPages::REQUEST_PAGE_TYPE, 'MJ_sync_url' => $link, + 'mjSenders' => $this->getOnlyEmailSenders($mjSenders), + 'currentSender' => $currentSender, )); if ($this->page_name == 'CONTACTS') { $this->context->smarty->assign([