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

[Backport][2.2] Alternative fix for Multi Store Emails issue, Fix Async Emails issues, Fix Multiple Email issues #18472

Merged
merged 17 commits into from
Mar 5, 2019

Conversation

gwharton
Copy link
Contributor

@gwharton gwharton commented Oct 8, 2018

This PR replaces PR #16461 as for some reason, that PR has become detached from my repo and I don't think it will merge properly.

Original Pull Request

#18471

Description

This PR removes the previously introduced transportBuilderByStore class that was introduced in 2.2.4 to fix issue #11740 as this implementation caused unwanted regression/bug when sending multiple emails/async emails.

Fixed Issues (if relevant)

  1. Sending emails from Admin in Multi-Store Environment defaults to Primary Store #11740:Sending emails from Admin in Multi-Store Environment defaults to Primary Store
  2. Confirmation emails have no FROM or FROM email address 2.2.4 #14952:Confirmation emails have no FROM or FROM email address 2.2.4
  3. Store Email Addresses are not used anymore #14945:Store Email Addresses are not used anymore
  4. Magento 2.2.4 not sending from sales sender #16355:Magento 2.2.4 not sending from sales sender

Manual testing scenarios

Scenareo 1

  • Single store
  • Setup store email addresses
  • Complete checkout
  • Verify from address in confirmation email

Scenareo 2

  • Multiple store
  • Setup store email addresses for Store 1
  • Setup store email addresses for Store 2
  • Complete checkout on Store 1- Verify from address in confirmation email
  • Complete checkout on Store 2- Verify from address in confirmation email

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@ihor-sviziev
Copy link
Contributor

Hi @sidolov,
Any updates from discussing this issue with architects?

@ihor-sviziev
Copy link
Contributor

@gwharton is it really backport of some fix from 2.3-develop branch?

@gwharton
Copy link
Contributor Author

gwharton commented Oct 8, 2018

The same fault is present in 2.3. Magento is prioritising 2.3 now as i guess 2.3.0 is iminent. There is a new pr for 2.3 and i labelled this one backport. Hopefully they will make the decision on the 2.3 pr and this one will follow without discussion.

@sidolov
Copy link
Contributor

sidolov commented Oct 10, 2018

Hi @ihor-sviziev , @gwharton , we discussed this case with @buskamuza recently. We still not allowed to add new parameters to public methods, the best way is to deprecate the old method and create the new one, like setFromByStore and change all usages to the new method.

@ihor-sviziev ihor-sviziev self-assigned this Oct 10, 2018
@gwharton
Copy link
Contributor Author

ok, someone else will have to pick this one up.

TODO : Rest of Magento codebase still uses deprecated setFrom
@hostep
Copy link
Contributor

hostep commented Mar 4, 2019

Just informational, but there is official Magento documentation around how to use the cweagans/composer-patches module: https://support.magento.com/hc/en-us/articles/360005484154-Create-a-patch-for-a-Magento-2-Composer-installation-from-a-GitHub-commit

Although it doesn't go over complex PR's like this one which span multiple modules, so you need to split out the diff in multiple diff files, one per module (magento/module-sales & magento/framework).

@ladle3000
Copy link

Ok thanks @hostep and @ihor-sviziev I tried for hours yesterday and did manage to figure out splitting to two modules.

Still getting failure on the framework one due to some unexpected ending. I'll have to look more today.

I still don't even know if this PR will fix my issue for sure yet.

@ladle3000
Copy link

I could not get the framework diff to apply, so I've just copied and pasted all the 6 files from raw to my magento and now get this error on testing an email send

Zend\Mail\Transport\Smtp transport expects either a Sender or at least one From address in the Message; none provided

Really need a fix for this, I'm a merchant running a store and sending out generic looking emails now.

@gwharton
Copy link
Contributor Author

gwharton commented Mar 5, 2019

You should only copy the changes, not the entire raw file. By copying the entire raw file, you have effectively overwritten your 2.2.7 files with the 2.2-develop files which may contain other changes not compatible with the rest of 2.2.7.

Just go by the diff, if the line is red (prefixed with a "-"), it is removed, if the line is green (prefixed with a "+"), it is added. The white lines are not changed, and are there for you to locate the lines that have changed.

If you just want to get it to work, you could ignore the files with Test in the filename as they are not needed.

Be aware if this PR doesnt make it into 2.2.8 then when you upgrade to 2.2.8 you will need to make these changes again.

@ladle3000
Copy link

ladle3000 commented Mar 5, 2019 via email

@gwharton
Copy link
Contributor Author

gwharton commented Mar 5, 2019

PR #18471 is the equivalent fix for 2.3

This has already been merged into 2.3-develop and will be included in release 2.3.1

You need to revert what you have done, and make the changes according to PR #18471

@ladle3000
Copy link

ladle3000 commented Mar 5, 2019 via email

@gwharton
Copy link
Contributor Author

gwharton commented Mar 5, 2019

Don't copy raw files from develop into a release version........ full stop. You're asking for trouble as the files may not be compatible.

If you are running 2.3.0 then revert your changes by copying over the files from YOUR release to get you back to the originals. Then if you must apply the PR manually, do so by only making the changes identified in the diff.

@ladle3000
Copy link

ladle3000 commented Mar 5, 2019 via email

@ghost
Copy link

ghost commented Mar 5, 2019

Hi @gwharton, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

magento-engcom-team pushed a commit that referenced this pull request Mar 5, 2019
…ssue, Fix Async Emails issues, Fix Multiple Email issues #18472
@magento-engcom-team magento-engcom-team added this to the Release: 2.2.9 milestone Mar 5, 2019
@gwharton gwharton deleted the 2.2-develop-emailfix branch March 5, 2019 21:01
@qrider
Copy link

qrider commented May 5, 2019

I am seeing this for a 2.3.0 site still. From what I can tell 2.3 contains the patch. So not sure why it is not working.

@gwharton
Copy link
Contributor Author

gwharton commented May 5, 2019

2.3.1 i believe got this. Not 2.3.0.

@qrider
Copy link

qrider commented May 5, 2019

thanks

@LandonL82
Copy link

Has anyone figured out how to apply this patch to a composer 2.2.7 install?

@crankycyclops
Copy link
Contributor

Has anyone figured out how to apply this patch to a composer 2.2.7 install?

@LandonL82, just make the following string replacements in your text editor before applying the patch:

app/code/Magento/Sales -> vendor/magento/module-sales
lib/internal/Magento/Framework -> vendor/magento/framework

@sudma
Copy link

sudma commented May 27, 2019

@LandonL82
Here is the official Magento blog post about applying the patches via composer.

https://support.magento.com/hc/en-us/articles/360005484154-Create-a-patch-for-a-Magento-2-Composer-installation-from-a-GitHub-commit

@tuyennn
Copy link
Member

tuyennn commented Jun 11, 2019

@gwharton Good to have the backward compatible with TransportBuilder.php on <=2.2.6 on your PR

@ladle3000
Copy link

ladle3000 commented Jun 13, 2019 via email

@tuyennn
Copy link
Member

tuyennn commented Jun 13, 2019

On 2.2.6 you should exclude Mail.php from patch because it was not implemented some missing functions. Actually the Mail.php was changed since 2.2.7

@MiomenteMUC
Copy link

Still got the problem in 2.3.1 for every payment method except Paypal and Amazon Pay.
Expectation:

Regards, Loqic

@ihor-sviziev
Copy link
Contributor

Hi @Loqic2633,
If you're still having this issue on latest Magento version - please create separate issue for that

Thank you!

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

Successfully merging this pull request may close these issues.