Closed tstamplis closed 5 years ago
@SoCix, there are 7 files related to this issue. Better you apply patches rather making changes directly to core files. Your composer need to update to work with Patches.
There are solutions like composer-patches and you can add .patch to a commit or PR URL.
https://patch-diff.githubusercontent.com/raw/magento/magento2/pull/18471.patch is what you get when you go to https://github.com/magento/magento2/pull/18471.patch
Just migrate from M2.2.7 to M2.3.0 at issue continue, but I don't find file: vendor/magento/module-sales-Model/Order/SenderBuilder.php and change that I was working correctly in version 2.2.7:
protected function configureEmailTemplate() { $this->transportBuilder->setTemplateIdentifier($this->templateContainer->getTemplateId()); $this->transportBuilder->setTemplateOptions($this->templateContainer->getTemplateOptions()); $this->transportBuilder->setTemplateVars($this->templateContainer->getTemplateVars()); $this->transportBuilder->setFrom($this->identityContainer->getEmailIdentity());
//the below are commented //$this->transportBuilderByStore->setFromByStore( // $this->identityContainer->getEmailIdentity(), // $this->identityContainer->getStore()->getId()
Sorry, found.
Hi @rishabhchd19 ,can i ask you what file you changed?thank you!
h3y @andy17612, as already stated above "there are 7 files related to this issue as mentioned in the PR by gwharton. Better you apply patches rather making changes directly to core files. " With a work to patch, you have a procedure to apply .patch file.
I had made changes directly to core files by making a backup before just to test the resolution provided in PR. The files have now revert back to original and i have applied patches finally with a proper patch process.
Hi @rishabhchd19 are you meaning there? https://github.com/magento/magento2/pull/18471/files thank you!
as per previous response by gwharton "As previously stated
if you are required for 2.3 #18471 is the resolution.
@rishabhchd19 thank you! And do you have this bug on 2.3 , i am getting this bug again https://github.com/magento/magento2/issues/18150
@DanielRuf Using composer patch is not a option here... there's any release date for the 2.3.1?
@DanielRuf Using composer patch is not a option here
Why not? And normal patches? It's just a patch file in both cases, just the path is different.
https://patch-diff.githubusercontent.com/raw/magento/magento2/pull/18471.patch
how to install the patch
@hazzan3li with composer-patches or patch -p0 18471.patch
.
Or search for "how to apply patch file" + your OS (should be some Linux) at Google.
Thank you I applied the patch with patch.php method but I don't know if it's applied or not the screen only shows **done my website hosted in shared hosting
patch -p0 18471.patch ????
Not sure what you mean with patch.php. You have to check the files if they contain what you see in the patch file (the changes with +
at the beginning).
patch.php method to patch magento Make one file with the name of patch.php, write the following code in it, php print("<PRE>"); passthru("/bin/bash abcd.patch"); print("</PRE>"); echo "Done";
replace the file name in it, upload it in the root and run the file from the browser. Name should be abcd.patch
This is not needed. You can do the same with SSH. In this case rename the file to abcd.patch or similar.
Where is this from? Our official docs?
passthru()
is often disabled as this is not a secure way and the patch files are not bash scripts.
the last answer with 6 steps
@hazzan3li : this sound like how patches are applied for Magento 1 shops. Those were bash scripts, but the patches for Magento 2 shops are pure git diff files which won't work if you execute them with bash.
If you use composer to install Magento, it's best to follow something like mentioned in this article: https://support.magento.com/hc/en-us/articles/360005484154-Create-a-patch-for-a-Magento-2-Composer-installation-from-a-GitHub-commit (if you never done something like this before, it might take you a while until you've figured it out how to make this work best, but then you'll also be able in the future to more quickly incorporate other patches, so it's very beneficial to understand how this works in the long run)
it is too hard to understand all of these complex thinges I am a begginer THANK YOU ALL
@hazzan3li : this sound like how patches are applied for Magento 1 shops. Those were bash scripts, but the patches for Magento 2 shops are pure git diff files which won't work if you execute them with bash.
If you use composer to install Magento, it's best to follow something like mentioned in this article: https://support.magento.com/hc/en-us/articles/360005484154-Create-a-patch-for-a-Magento-2-Composer-installation-from-a-GitHub-commit (if you never done something like this before, it might take you a while until you've figured it out how to make this work best, but then you'll also be able in the future to more quickly incorporate other patches, so it's very beneficial to understand how this works in the long run)
what changes I have to make in json file Module: ?? Title: ?? Path to patch: "patches/composer/18471.diff" +1:
Just migrate from M2.2.7 to M2.3.0 at issue continue, but I don't find file: vendor/magento/module-sales-Model/Order/SenderBuilder.php and change that I was working correctly in version 2.2.7:
protected function configureEmailTemplate() { $this->transportBuilder->setTemplateIdentifier($this->templateContainer->getTemplateId()); $this->transportBuilder->setTemplateOptions($this->templateContainer->getTemplateOptions()); $this->transportBuilder->setTemplateVars($this->templateContainer->getTemplateVars()); $this->transportBuilder->setFrom($this->identityContainer->getEmailIdentity());
//the below are commented //$this->transportBuilderByStore->setFromByStore( // $this->identityContainer->getEmailIdentity(), // $this->identityContainer->getStore()->getId()
It's work. Thank You @salelsol
Hi how to edit composer json file to fit for patching (problem 18471) "extra": { "composer-exit-on-patch-failure": true, "patches": { "?????": { "??????????????????": "patches/composer/18471.diff" } } }
@hazzan3li : here's is how we do it, but this is using #18472, because we have no shops on Magento 2.3 yet, only on 2.2.
We split the patch in 2 parts, because it affects 2 different Magento modules: magento/module-sales
and magento/framework
, and change the paths in the diff files so they are relative against the module filestructure.
So in your composer files, you add something like this:
"patches": {
"magento/module-sales": {
"PR-18472: Alternative fix for Multi Store Emails issue, Fix Async Emails issues, Fix Multiple Email issues": "PR-18472-Sales.diff"
},
"magento/framework": {
"PR-18472: Alternative fix for Multi Store Emails issue, Fix Async Emails issues, Fix Multiple Email issues": "PR-18472-Framework.diff"
}
}
And the diff files themselves in this zip file: PR-18472.zip
Please try to understand how the cweagans/composer-patches package works, so you can try to do the same using #18471
If you have further questions around how to apply patches, it might be best to go to https://magento.stackexchange.com/ or https://community.magento.com/, because Github isn't really ment for questions and answers like this.
Thanks and good luck! :)
Much-appreciated, @hostep -- what a killer module!
Hi @tstamplis. Thank you for your report. The issue has been fixed in magento/magento2#18471 by @gwharton in 2.3-develop branch Related commit(s):
The fix will be available with the upcoming 2.3.1 release.
Thanks @hostep, this made things so much easier! Works in both my 2.2.5 and 2.2.7 environments.
Here is a patch for Magento 2.3.0:
One more query...is this patch replace file/entire coding or just the code on the line no . ?
On Thu 24 Jan, 2019, 6:42 PM Craig Carnell <notifications@github.com wrote:
Here is a patch for Magento 2.3.0:
PR-18471.zip https://github.com/magento/magento2/files/2791807/PR-18471.zip
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/magento/magento2/issues/14952#issuecomment-457191280, or mute the thread https://github.com/notifications/unsubscribe-auth/Adg8baJCghOKGQ8sSLnXJex1NBtpjsclks5vGbFGgaJpZM4TwYEs .
Just the code that needs replacing, it's a diff
Here is a patch for Magento 2.3.0:
I can confirm that it's working on Magento 2.3.0.
Just updated from 2.2.5 to 2.2.7 and the issue is still on, this need to be addressed and fixed ASAP, Team please help how to apply fix.
It will be probably in 2.2.8.
@DanielRuf When is a new release due?
It will be probably in 2.2.8.
But isn't that security concern which is directly displaying our VPS address, so the hackers can manipulate it and hack the VPS or emails address
But isn't that security concern which is directly displaying our VPS address, so the hackers can manipulate it and hack the VPS or emails address
Your answer does not make much sense to me. You can apply the patch using composer-patches and there were also workarounds mentioned in the collapsed comments (setting the sender for the binary which sends the mails).
@terrybakshi also see https://github.com/magento/magento2/issues/14952#issuecomment-449823307
what about this solution will this fix the issue https://magento.stackexchange.com/questions/152799/order-confirmation-email-not-send-in-magento-2/257215#257215
@terrybakshi also see #14952 (comment)
Fix: vendor/magento/module-sales/Model/Order/Email/SenderBuilder.php
replace
$this->transportBuilderByStore->setFromByStore(
$this->identityContainer->getEmailIdentity(),
$this->identityContainer->getStore()->getId()
);
with
$this->transportBuilder->setFrom(
$this->identityContainer->getEmailIdentity(),
$this->identityContainer->getStore()->getId()
);
vendor/magento/framework/Mail/Template/TransportBuilder.php
replace
/**
/**
This is what the linked patches already do ;-) It was already posted a few times before.
composer-patches is recommended, editing the core (manually) is highly discouraged and not recommended. Never touch core files. This is why we have patch
.
This is what the linked patches already do ;-) It was already posted a few times before.
composer-patches is recommended, editing the core (manually) is highly discouraged and not recommended. Never touch core files. This is why we have
patch
.
can you please assist me in how to step by step apply patch as i am new so not sure how to do if you can tell me the commands would be much appreciated.
Thanks
Hi guys,
I figured before I go the patch route I'd give Terrybakshi's solution a try. Seemed easy enough. But after backing up the two files and making the changes, I get the following error everywhere I go in the site including the admin module.
There has been an error processing your request Exception printing is disabled by default for security reasons. Error log record number: 376655659721
I restored the original files and everything worked again. I tried the changes once more and started getting this fat one instead.
Fatal error: Uncaught Error: Call to undefined method Magento\Framework\Mail\Template\TransportBuilder\Interceptor::_init() in /home1/mysite/public_html/generated/code/Magento/Framework/Mail/Template/TransportBuilder/Interceptor.php:13 Stack trace: #0 /home1/mysite/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Magento\Framework\Mail\Template\TransportBuilder\Interceptor->construct(Object(Magento\Framework\Mail\Template\Factory), Object(Magento\Framework\Mail\Message\Interceptor), Object(Magento\Email\Model\Template\SenderResolver), Object(Magento\Framework\App\ObjectManager), Object(Magento\Framework\Mail\TransportInterfaceFactory)) #1 /home1/mysite/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\Framewo...', Array) #2 /home1/mysite/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dyn in /home1/mysite/public_html/generated/code/Magento/Framework/Mail/Template/TransportBuilder/Interceptor.php on line 13
Again, the problem seems to be here because if put the original 2.5 code back for this function only, keeping the changes in place for SenderBuilder.php, everything works again but no emails are sent of course.
public function setFrom($from, $store = null)
{
$result = $this->_senderResolver->resolve($from, $store);
$this->message->setFrom($result['email'], $result['name']);
return $this;
}
I fear the patch will do the same thing if I run it. Any ideas?
@winstonojeda after adding the code did u run the commands php bin/magento setup:upgrade
php bin/magento cache:clean
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
No. I did not.
No. I did not.
so after adding code you have to run commands to get it working
Your stack trace is showing an interceptor problem. This is because you havent rerun php bin/magento setup:di:compile
Do this and then run the static deploy command after.
Great! I wasn't sure about that step. Thanks!
Preconditions
Magento 2.2.4 PHP 7.1 Cpanel Server
Steps to reproduce
Production Mode Single Store Mode Add product to cart Checkout
Expected result
Order confirmation email with FROM name and email address sent to customer per settings from store email addresses in config
Actual result
Order confirmation email contains no FROM or FROM EMAIL address.