From 9baa66ac08beecd04adc391dbf25b9c40d42af7a Mon Sep 17 00:00:00 2001 From: gonzalo Date: Mon, 23 Oct 2023 18:17:01 -0300 Subject: [PATCH] fix the store id #1847 for magento 2.3.6-p1 --- Model/Plugin/Subscriber.php | 20 ++++---------------- view/frontend/templates/footerwphone.phtml | 4 ++-- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/Model/Plugin/Subscriber.php b/Model/Plugin/Subscriber.php index bb60249e..36aa9f06 100644 --- a/Model/Plugin/Subscriber.php +++ b/Model/Plugin/Subscriber.php @@ -66,7 +66,7 @@ public function beforeUnsubscribeCustomerById( \Magento\Newsletter\Model\Subscriber $subscriber, $customerId ) { - $storeId = $this->getStoreIdFromSubscriber($subscriber); + $storeId = $this->_storeManager->getStore()->getId(); if ($this->_helper->isMailChimpEnabled($storeId)) { if (!$this->_helper->getConfigValue(\Ebizmarts\MailChimp\Helper\Data::XML_MAGENTO_MAIL, $storeId)) { $subscriber->setImportMode(true); @@ -101,8 +101,7 @@ public function beforeSubscribeCustomerById( \Magento\Newsletter\Model\Subscriber $subscriber, $customerId ) { - - $storeId = $this->getStoreIdFromSubscriber($subscriber); + $storeId = $this->_storeManager->getStore()->getId(); if ($this->_helper->isMailChimpEnabled($storeId)) { $subscriber->loadByCustomerId($customerId); if (!$subscriber->isSubscribed()) { @@ -154,7 +153,6 @@ public function beforeSubscribe( \Magento\Newsletter\Model\Subscriber $subscriber, $email ) { - //$websiteId = $this->getStoreIdFromSubscriber($subscriber); $storeId = $this->_storeManager->getStore()->getId(); if ($this->_helper->isMailChimpEnabled($storeId)) { if (!$this->_helper->getConfigValue(\Ebizmarts\MailChimp\Helper\Data::XML_MAGENTO_MAIL, $storeId)) { @@ -203,7 +201,7 @@ public function beforeSubscribe( public function beforeUnsubscribe( \Magento\Newsletter\Model\Subscriber $subscriber ) { - $storeId = $this->getStoreIdFromSubscriber($subscriber); + $storeId = $this->_storeManager->getStore()->getId(); if ($this->_helper->isMailChimpEnabled($storeId)) { if (!$this->_helper->getConfigValue(\Ebizmarts\MailChimp\Helper\Data::XML_MAGENTO_MAIL, $storeId)) { $subscriber->setImportMode(true); @@ -230,8 +228,7 @@ public function beforeUnsubscribe( public function afterDelete( \Magento\Newsletter\Model\Subscriber $subscriber ) { - - $storeId = $this->getStoreIdFromSubscriber($subscriber); + $storeId = $this->_storeManager->getStore()->getId(); if ($this->_helper->isMailChimpEnabled($storeId)) { $api = $this->_helper->getApi($storeId); if ($subscriber->isSubscribed()) { @@ -254,13 +251,4 @@ public function afterDelete( } return null; } - - /** - * @param \Magento\Newsletter\Model\Subscriber $subscriber - * @return int - */ - protected function getStoreIdFromSubscriber(\Magento\Newsletter\Model\Subscriber $subscriber) - { - return $subscriber->getStoreId(); - } } diff --git a/view/frontend/templates/footerwphone.phtml b/view/frontend/templates/footerwphone.phtml index 7487b3d6..c4b21a35 100644 --- a/view/frontend/templates/footerwphone.phtml +++ b/view/frontend/templates/footerwphone.phtml @@ -19,9 +19,9 @@ data-validate="{required:true, 'validate-email':true}" />