Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magento subscription email sent despite 'Magento always managed emails' set to 'No' #1311

Closed
itmsenior opened this issue Nov 18, 2021 · 7 comments · Fixed by #1756
Closed
Assignees
Labels
Milestone

Comments

@itmsenior
Copy link

itmsenior commented Nov 18, 2021

Hi,

As per title, I've checked similar issue #1189 but I believe I'm on the 2.4 branch so I think this is a new occurrence of this bug.

Preconditions

  • Magento 2.4.3-p1
  • Mailchimp 103.4.43
  • Config 'Magento always manage emails' set to 'No'

Steps to reproduce

  1. Login to Magento website with customer account.
  2. Go to manage newsletter subscription
  3. Tick box to subscribe to newsletter

Expected result

  1. Customer is subscribed
  2. Magento confirmation email is not sent

Actual result

  1. Customer is subscribed
  2. Magento confirmation email is sent
@itmsenior
Copy link
Author

Update: It looks like the email may only be sent on the second subscription e.g.

  1. Login to Magento website with customer account.
  2. Go to manage newsletter subscription
  3. Tick box to subscribe to newsletter
  4. Go back to manage newsletter subscription
  5. Tick box to unsubscribe from newsletter
  6. Go back to manage newsletter subscription
  7. Re-subscribe to newsletter
  8. Core subscription email wrongly sent.

This was referenced Dec 7, 2021
@sprankhub
Copy link

This still seems to happen with Magento 2.4.5-p2, PHP 8.1, Mailchimp 103.4.49. There is already a PR, which might fix it. @gonzaloebiz, could you have a look?

@gonzaloebiz gonzaloebiz self-assigned this Apr 19, 2023
@sprankhub
Copy link

@gonzaloebiz, any news on this? Thanks!

@itmsenior
Copy link
Author

itmsenior commented Jun 19, 2023

@sprankhub

Just to mention we're now using a slightly modified afterLoadByCustomer function that matches the recent changes to afterLoadBySubscriberEmail.

    /**
     * @param \Magento\Newsletter\Model\Subscriber $subscriber
     * @param $email
     * @param $websiteId
     * @return \Magento\Newsletter\Model\Subscriber
     */
    public function afterLoadByCustomer(\Magento\Newsletter\Model\Subscriber $subscriber, $email, $websiteId)
    {
        if ($this->_helper->isMailChimpEnabled($subscriber->getStoreId())) {
            try {
                if (!$this->_helper->getConfigValue(
                    \Ebizmarts\MailChimp\Helper\Data::XML_MAGENTO_MAIL,
                    $subscriber->getStoreId()
                )) {
                    $subscriber->setImportMode(true);
                }
            } catch (\Exception $exception) {
                $this->_helper->log($exception->getMessage());
            }
        }

        return $subscriber;
    }

Our CR is likely to out of date to be usable now and I can also see that Subscriber.php appears to have been rewritten in the development branch.

@sprankhub
Copy link

@gonzaloebiz, could you have a look at this? Thanks!

@sprankhub
Copy link

@gonzaloebiz, could you release a new version with this fix? Thanks!

@gonzaloebiz
Copy link
Collaborator

Already in 10x.x.57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants