Skip to content

Commit

Permalink
fix the store id #1847 for magento 2.3.6-p1
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaloebiz committed Oct 23, 2023
1 parent 6cfe89a commit 9baa66a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
20 changes: 4 additions & 16 deletions Model/Plugin/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
Expand All @@ -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()) {
Expand All @@ -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();
}
}
4 changes: 2 additions & 2 deletions view/frontend/templates/footerwphone.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
data-validate="{required:true, 'validate-email':true}"
/>
<input name="phone" type="tel" id="newsletter"
placeholder="<?= $block->escapeHtml(__('Enter your phone')) ?>"
placeholder="<?= $block->escapeHtml(__('Enter your SMS phone')) ?>"
data-mage-init='{"mage/trim-input":{}}'
data-validate="{required:true, 'validate-phoneStrict':false}"
data-validate="{required:false, 'validate-phoneStrict':false}"
/>
</label>
</div>
Expand Down

0 comments on commit 9baa66a

Please sign in to comment.