From fc7bd0925d2fce199db1ac41685c2f60f160aa59 Mon Sep 17 00:00:00 2001 From: nghiatt Date: Fri, 29 Nov 2024 09:38:17 +0700 Subject: [PATCH 1/3] fix: wrong store id when send abandoned cart email --- Block/Adminhtml/AbandonedCart/Edit/Form.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Block/Adminhtml/AbandonedCart/Edit/Form.php b/Block/Adminhtml/AbandonedCart/Edit/Form.php index c0fb0d2..ddc5a17 100644 --- a/Block/Adminhtml/AbandonedCart/Edit/Form.php +++ b/Block/Adminhtml/AbandonedCart/Edit/Form.php @@ -131,14 +131,14 @@ public function __construct( GroupRepositoryInterface $groupRepository, array $data = [] ) { - $this->addressConfig = $addressConfig; - $this->priceCurrency = $priceCurrency; - $this->emailIdentity = $emailIdentity; - $this->emailTemplate = $emailTemplate; - $this->taxConfig = $taxConfig; + $this->addressConfig = $addressConfig; + $this->priceCurrency = $priceCurrency; + $this->emailIdentity = $emailIdentity; + $this->emailTemplate = $emailTemplate; + $this->taxConfig = $taxConfig; $this->logCollectionFactory = $logCollectionFactory; $this->helperEmailMarketing = $helperEmailMarketing; - $this->groupRepository = $groupRepository; + $this->groupRepository = $groupRepository; parent::__construct($context, $registry, $formFactory, $data); } @@ -189,10 +189,10 @@ public function getHelperEmailMarketing() */ public function getSubtotal(Quote $quote, $inclTax = false) { - $address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress(); + $address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress(); $subtotal = $inclTax ? $address->getSubtotalInclTax() : $address->getSubtotal(); - return $this->formatPrice($subtotal, $quote->getId()); + return $this->formatPrice($subtotal, $quote->getStoreId()); } /** @@ -362,8 +362,8 @@ public function isSingleStoreMode() public function getStoreName(Quote $quote) { $storeId = $quote->getStoreId(); - $store = $this->_storeManager->getStore($storeId); - $name = [$store->getWebsite()->getName(), $store->getGroup()->getName(), $store->getName()]; + $store = $this->_storeManager->getStore($storeId); + $name = [$store->getWebsite()->getName(), $store->getGroup()->getName(), $store->getName()]; return implode('
', $name); } From 0f6ede941d700846c9752b920e6fbdaded29480c Mon Sep 17 00:00:00 2001 From: chuccv Date: Tue, 3 Dec 2024 11:49:10 +0700 Subject: [PATCH 2/3] fix: Dev mode & clean code --- Mail/Transport.php | 68 +++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/Mail/Transport.php b/Mail/Transport.php index e3a8761..837b301 100644 --- a/Mail/Transport.php +++ b/Mail/Transport.php @@ -97,58 +97,58 @@ public function __construct( } /** + * Around send message + * * @param TransportInterface $subject * @param Closure $proceed * * @throws MailException * @throws Zend_Exception */ - public function aroundSendMessage( - TransportInterface $subject, - Closure $proceed - ) { + public function aroundSendMessage(TransportInterface $subject, Closure $proceed) + { $this->_storeId = $this->registry->registry('mp_smtp_store_id'); - $message = $this->getMessage($subject); - - if ($this->resourceMail->isModuleEnable($this->_storeId) && $message) { - if ($this->helper->versionCompare('2.2.8')) { - $message = Message::fromString($message->getRawMessage())->setEncoding('utf-8'); - } + if (!$this->resourceMail->isModuleEnable($this->_storeId)) { + $proceed(); - if (!$this->validateBlacklist($message)) { - $message = $this->resourceMail->processMessage($message, $this->_storeId); - $transport = $this->resourceMail->getTransport($this->_storeId); - try { - if (!$this->resourceMail->isDeveloperMode($this->_storeId)) { - if ($this->helper->versionCompare('2.3.3')) { - $message->getHeaders()->removeHeader("Content-Disposition"); - } - $transport->send($message); + return; + } + $message = $this->getMessage($subject); + if ($this->helper->versionCompare('2.2.8')) { + $message = Message::fromString($message->getRawMessage())->setEncoding('utf-8'); + } + if (!$this->validateBlacklist($message)) { + $message = $this->resourceMail->processMessage($message, $this->_storeId); + try { + if (!$this->resourceMail->isDeveloperMode($this->_storeId)) { + if ($this->helper->versionCompare('2.3.3')) { + $message->getHeaders()->removeHeader("Content-Disposition"); + } + $transport = $this->resourceMail->getTransport($this->_storeId); + $transport->send($message); - if ($this->helper->versionCompare('2.2.8')) { - $messageTmp = $this->getMessage($subject); - if ($messageTmp && is_object($messageTmp)) { - $body = $messageTmp->getBody(); - if (is_object($body) && $body->isMultiPart()) { - $message->setBody($body->getPartContent("0")); - } + if ($this->helper->versionCompare('2.2.8')) { + $messageTmp = $this->getMessage($subject); + if ($messageTmp && is_object($messageTmp)) { + $body = $messageTmp->getBody(); + if (is_object($body) && $body->isMultiPart()) { + $message->setBody($body->getPartContent("0")); } } - - $this->emailLog($message); } - } catch (Exception $e) { - $this->emailLog($message, false); - throw new MailException(new Phrase($e->getMessage()), $e); } + $this->emailLog($message); + } catch (Exception $e) { + $this->emailLog($message, false); + throw new MailException(new Phrase($e->getMessage()), $e); } - } else { - $proceed(); } } /** - * @param $transport + * Get message + * + * @param TransportInterface $transport * * @return mixed|null */ From 5ef0cd2c5ed76d19f04129e1a0ada9d3ef8a1944 Mon Sep 17 00:00:00 2001 From: chuccv Date: Tue, 3 Dec 2024 13:29:06 +0700 Subject: [PATCH 3/3] Release v4.7.14 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 851cd51..2de2f04 100644 --- a/composer.json +++ b/composer.json @@ -2,10 +2,10 @@ "name": "mageplaza/module-smtp", "description": "SMTP Extension for Magento 2 helps the owner of store simply install SMTP (Simple Mail Transfer Protocol) server which transmits the messages into codes or numbers", "require": { - "mageplaza/module-core": "^1.5.7" + "mageplaza/module-core": "^1.5.9" }, "type": "magento2-module", - "version": "4.7.13", + "version": "4.7.14", "license": "proprietary", "authors": [ {