-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGETWO-53010: [Email Logo] Saving a custom transactional email logo,…
… failed.
- Loading branch information
Oleksandr Karpenko
committed
Jun 7, 2016
1 parent
3fbefa4
commit 23103c0
Showing
5 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Email\Model\Design\Backend; | ||
|
||
use Magento\Theme\Model\Design\Backend\Logo as DesignLogo; | ||
|
||
class Logo extends DesignLogo | ||
{ | ||
/** | ||
* The tail part of directory path for uploading | ||
*/ | ||
const UPLOAD_DIR = 'email/logo'; | ||
|
||
/** | ||
* Upload max file size in kilobytes | ||
* | ||
* @var int | ||
*/ | ||
protected $maxFileSize = 2048; | ||
|
||
/** | ||
* Getter for allowed extensions of uploaded files | ||
* | ||
* @return string[] | ||
*/ | ||
public function getAllowedExtensions() | ||
{ | ||
return ['jpg', 'jpeg', 'gif', 'png']; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this bug fix been included in 2.1.1? I can't see it in the change notes? http://devdocs.magento.com/guides/v2.1/release-notes/ReleaseNotes2.1.1CE.html
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have this issue. What is the status on this? So everyone who is using 2.1 is sending Luma logo emails?
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also facing same issue. It seems issue is fixed but not release yet. We need this fix ASAP.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chamath, as a quick fix.. just FTP the file to the correct path. Click on the missing logo image in the backend and it will open a new window/tab.. That is your path, or pub/media/email/logo/websites/( 2, 3 or etc.) You will then see the image in the backend too and in your transactional emails.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @flnative and @romeof1980. I will try those. But thing is we need do same thing when we do deploy
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its still the same in mag 2.1.1 its not fixed at all
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi,
I tried that already and no good
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@romeof1980 I tried your workaround but it is still not working for me. In Content, Configuration, Transactional Emails, I have uploaded my logo. When I go back in, the link is broken but I can see the path. When I follow the path in FTP, I see that the logo image has been uploaded. But I still get the default logo in my New Order email.
I would like to try the fix by changing those 5 files, but I don't have a app/code/Magento folder. I am using the default Magento Luma theme. Where can I find these files to fix?
I am using 2.1.1
Thanks!
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
I was able to temporary fix the logo by:
L.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucasalfaro That didn't work for me. The Luma logo was still appearing and going back into Transaction Emails still gave me a broken link. Although I uploaded the same image by FTP, it never worked.
I don't have an app/code/Magento folder. I guess this means my M2 install was from composer rather than git. But I was able to fix this issue by using the solution above changing the 5 files. I found these files under vendor/magento. Instead of a folder called Config, Email or Theme, I found the folders module-config, module-email, and module-theme. I finally have my own logo for the emails. I can see it in the preview and the link is not broken.
Thanks all!
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not included in 2.1.2. Maybe by 2.1.3?
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope it will be included after 2.1.2. :(
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my ftp I do not even have those paths to follow.
For example the second file is under:
/vendor/magento/module-email/Model/AbstractTemplate.php
Instead of:
/app/code/Magento/Email/Model/AbstractTemplate.php
How can this be possible?
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @Uvestudio that's possibile and even normal.
the different path (either on app/ or vendor/) depends of how you installed Magento (i.e .via Composer or via Git).
As you see, the path is different but after app/code/ and vendor/ there are no difference.
Same for other module you installed (core modules too)
cheers!
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for the information @romeof1980 :)
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another hack, is to obtain the Magento Logo url from the emails received, which is here:
pub/static/frontend/...theme/theme_name/lang-pack ..../Magento_Email/logo_email.png
(this depends on how your stores are setup)
Its a 540x156 png file called: logo_email.png
So just upload your own, the same name/size as the default Magento image, to the same place and your good to go, until its fixed.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rrains that is what I tried. The funny thing of all this is that I copied the image URL, opened it in my browswer and guess what, it was my logo 🗡️
I replaced all the logo_email.png in my server and was still showing magento's logo... Then I asked some friends to subscribe to the newsletter and they were getting our custom logo... I have tried to flush magento's cache and my own but I still get the default logo, but it seems that I'm the only one getting it... So weird!
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rrains @Uvestudio not sure if it's much of a hack as per the developer docs, you can also create directory Magento_Email/web in your theme folder and upload your file there labeled logo_email.png. When deploying static contents, the file takes precedence and is created in the same place as the stock magento logo would be created. THIS RESULT IS THE SAME AS @rrains idea, but this way, if you have to clear the pub/static dir, it's no problem, because on redeploying static contents, your file will be there again.
This is confusing as heck: Following the dev docs custom theme creation methods, you can have a custom email logo, and no "bug" is evident. But by following the common-sense/user friendly method of uploading through the admin panel as mentioned in the dev docs as well (and which most normal people will try to do), a bug is there. You will also never visually see the logo in the admin panel without applying the temporary fix. To verify, you'll need to go the path as mentioned above.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I run magento v2.1.2 and this is how I fixed this issue;
On my admin dashboard, the directory path of the broken transactional email logo I uploaded earlier was pub/media/email/logo/stores/1/logo.png, however this directory is missing in magento v2.1.2.
So to resolve this, I created the directory as the above and placed the logo image inside. Everything is displaying fine now both on the transactional emails.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to put this change in an extension? I'm trying to build a module that overwrites the classes mentioned in the files using dependency injection with . But somehow it doesn't work. Can anyone give me some pointers?
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to edit any file or any mess-up with codes.
Just do these simple things and all your email logo things will be fixed.
Step 1.
Rename your logo to "logo_email.png" in your computer.
Step 2.
Just search for "logo_email.png" in Magento installed directory in your server.
--in my case it is in "public_html" directory.
Step 3.
Just replace these above two ".png"(inside black rectangles) files with your ".png" file and "Flush cache" in Magento from your admin_panel and give your email template a preview & see its working.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't believe that this bug still exists.
It was recognized at 2.1.1 and it is still not fixed in 2.1.5 ... @magento-team you need to hurry with this stuff.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aKalisch Yes. Is there any temporary fix ?
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating this folder structure "Magento_Email/web" in my theme and putting the file "logo_email.png" in the web folder worked for me on one of my sites, but strangely enough, not the other. Both are running version 2.1.5 in developer mode with caching off.
Please get this fixed up as soon as you're able
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still facing the same problem.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bug is still alive!
Follow these steps to correct it:
<preference for="Magento\Theme\Model\Design\Backend\Logo" type="Vendor\YouModuleName\Model\Design\Backend\Logo"/>
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
casiandaniel, your custom module did the trick. It's a shame we have to jump through this hoop when it should be Magento themselves fixing it though.
For those out there who don't know how to write a custom module, casiandaniel's example above is attached to this post in full install-able format. Go ahead and change the vendor name.
FirstScribe_EmailLogo-1.0.0.zip
Let's hope this is just a temporary module and that Magento simply fixes the issue at the source!
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue is still here in Magento 2.1.5... @magento-team what are you doing with fix? Maybe you have to change your fix process release?! This is issue is from 2016 and still any patch :/
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dear All,
I found an easy way to work it out, (I am using the ver 2.1.2)
You can copy this file:
vendor/magento/module-theme/Model/Design/Backend/Logo.php
And rename it anything you want, in my case I created a new folder name "Email" under the same path,
And copy the Logo.php into it (don't forget to change the namespace, class name, and extends)
inside the new copy, please change the UPLOAD_DIR from "logo" to "email/logo"
And then you have to change the other file which is in "vendor\magento\module-email\etc\di.xml"
Change Line: 30 from :
Magento\Theme\Model\Design\Backend\Logo
to :
(in my case :Magento\Theme\Model\Design\Backend\Email\Logo)
it works for me, hope it helps everyone with this people.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First thing it should be noted that you never want to update any of the core files directly even with replacing the logo files. When you upgrade your Magento store there is absolutely no way to ensure that those images having been updated and won't be replaced. Core files include default Magento themes.
The extension method put forth by @mzenner1 absolutely works but there are two caveats you should be aware of. When the official fix is finally in place this extension will continue to override the logo upload from the Magento core, as well as you will also need to re-upload your site logo as installation. Both the transactional email logo and website logo use the same model. If you're fine with this go for it.
I prefer using the method of upgrading the custom theme I have installed on the store as follows:
Assuming your custom theme folder is Company/customtheme
Create the following directory structure (if it does not exist currently in your theme) "Magento_Email/web" Note capitalization matters.
And place your logo_email.png inside it. Your theme directory structure should appear as such when complete.
Company/customtheme/Magento_Email/web/logo_email.png
And from the store root would be.
app/design/frontend/Company/customtheme/Magento_Email/web/logo_email.png
Refresh your cache and recompile if you are running under production mode.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont have the app/code/Magento-map. All my files (like AbstractTemplate.php) are under vendor/magento. So I don't know where to put, for example, the Logo.php-file (Above fix says app/code/Magento/Email/Model/Design/Backend/Logo.php but m structure is different).
Or do I just have to create the Magento-directory under app/code?
@romeof1980 explained the difference between composer and GIT installs somewhere above, but that isn't true (anymore), because my directories are way different.. It would be great if Magento would post a REAL and WORKING fix for EVERYONE. For composer AND git-installs.
They should know the fix right?
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using version 2.1.7 and am experiencing the same issue - the Magneto logo is being used versus my logo. I have tried most of the suggestions above and did get the link fixed in the "Transactional eMails" setup so the logo displayed. However, it still does not appear on the actual email. After flushing the Magento cache I have another issue (which I just finished reporting) after selecting Content, then Design, I choose Configuration, select my store and then click Edit - I receive an error that the page isn't working. My installation was done through Installatron via cPanel. I'm about ready to go back to PresaShop.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@catzpaw164: this issue is fixed in Magento 2.1.8:
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eCommerceGorilla
your solution worked great, thanks!
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a quick solution to do this and it will done by changing core files.Open magento vendor/magento/module_email/view/frontend/email header.phtml file.In this file change the img src by adding your logo img hardcode around line 50.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Anees-Ahmad That is a real bad solution. @mzenner1 already posted a small extension that fixes this bug.
It's the quickest and best solution without changing core files.
NEVER CHANGE CORE FILES if you plan to keep your system uptodate.
23103c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bug has been fixed in 2.2. Be aware when upgrading. Make sure the modules you installed are compatible with 2.2 beforehand.