Skip to content
Permalink
Browse files

MAGETWO-53010: [Email Logo] Saving a custom transactional email logo,…

… failed.
  • Loading branch information...
Alkar778 committed Jun 7, 2016
1 parent 3fbefa4 commit 23103c03c527fe1ed3e1a3be691436818b7963fe
@@ -11,6 +11,9 @@
*/
namespace Magento\Config\Model\Config\Backend\Email;
/**
* @deprecated
*/
class Logo extends \Magento\Config\Model\Config\Backend\Image
{
/**
@@ -389,7 +389,7 @@ protected function getLogoUrl($store)
$store
);
if ($fileName) {
$uploadDir = \Magento\Config\Model\Config\Backend\Email\Logo::UPLOAD_DIR;
$uploadDir = \Magento\Email\Model\Design\Backend\Logo::UPLOAD_DIR;
$mediaDirectory = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA);
if ($mediaDirectory->isFile($uploadDir . '/' . $fileName)) {
return $this->storeManager->getStore()->getBaseUrl(
@@ -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'];
}
}
@@ -27,7 +27,7 @@
<item name="email_logo" xsi:type="array">
<item name="path" xsi:type="string">design/email/logo</item>
<item name="fieldset" xsi:type="string">other_settings/email</item>
<item name="backend_model" xsi:type="string">Magento\Theme\Model\Design\Backend\Logo</item>
<item name="backend_model" xsi:type="string">Magento\Email\Model\Design\Backend\Logo</item>
<item name="base_url" xsi:type="array">
<item name="type" xsi:type="string">media</item>
<item name="scope_info" xsi:type="string">1</item>
@@ -21,7 +21,7 @@ class Logo extends Image
*/
protected function _getUploadDir()
{
return $this->_mediaDirectory->getRelativePath($this->_appendScopeInfo(self::UPLOAD_DIR));
return $this->_mediaDirectory->getRelativePath($this->_appendScopeInfo(static::UPLOAD_DIR));
}
/**

39 comments on commit 23103c0

@timbaker1991

This comment has been minimized.

Copy link

replied Sep 15, 2016

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

@flnative

This comment has been minimized.

Copy link

replied Sep 20, 2016

I have this issue. What is the status on this? So everyone who is using 2.1 is sending Luma logo emails?

@chamath

This comment has been minimized.

Copy link

replied Sep 20, 2016

I'm also facing same issue. It seems issue is fixed but not release yet. We need this fix ASAP.

@flnative

This comment has been minimized.

Copy link

replied Sep 20, 2016

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.

@chamath

This comment has been minimized.

Copy link

replied Sep 20, 2016

Thanks @flnative and @romeof1980. I will try those. But thing is we need do same thing when we do deploy

@jpcsguru

This comment has been minimized.

Copy link

replied Sep 23, 2016

Its still the same in mag 2.1.1 its not fixed at all

@romeof1980

This comment has been minimized.

Copy link

replied Sep 23, 2016

@jpcsguru

This comment has been minimized.

Copy link

replied Sep 23, 2016

hi,
I tried that already and no good

@romeof1980

This comment has been minimized.

Copy link

replied Sep 23, 2016

@cwabbott22

This comment has been minimized.

Copy link

replied Oct 3, 2016

@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!

@lucasalfaro

This comment has been minimized.

Copy link

replied Oct 6, 2016

Hi,

I was able to temporary fix the logo by:

  • upload the logo on Content > Configuration > then Transaction Emails
  • by FTP created the folders /email/logo/default inside pub/media/
  • uloaded the same image
  • refresh the admin page and it will show the logo, also seems to be showing in the emails.

L.

@cwabbott22

This comment has been minimized.

Copy link

replied Oct 7, 2016

@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!

@Ctucker9233

This comment has been minimized.

Copy link

replied Oct 22, 2016

Still not included in 2.1.2. Maybe by 2.1.3?

@jehzlau

This comment has been minimized.

Copy link

replied Nov 8, 2016

I hope it will be included after 2.1.2. :(

@Uvestudio

This comment has been minimized.

Copy link

replied Dec 14, 2016

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?

@romeof1980

This comment has been minimized.

Copy link

replied Dec 14, 2016

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!

@Uvestudio

This comment has been minimized.

Copy link

replied Dec 14, 2016

Thank you very much for the information @romeof1980 :)

@rrains

This comment has been minimized.

Copy link

replied Dec 15, 2016

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.

@Uvestudio

This comment has been minimized.

Copy link

replied Dec 15, 2016

@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!

@jmtakahashi

This comment has been minimized.

Copy link

replied Dec 22, 2016

@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.

@pascalskillz

This comment has been minimized.

Copy link

replied Jan 6, 2017

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.

@Dan0sz

This comment has been minimized.

Copy link

replied Feb 21, 2017

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?

@Sohail-Ansari

This comment has been minimized.

Copy link

replied Feb 25, 2017

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.
ice_screenshot_20170225-133635

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.

@aKalisch

This comment has been minimized.

Copy link

replied Mar 3, 2017

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.

@bat553

This comment has been minimized.

Copy link

replied Mar 3, 2017

@aKalisch Yes. Is there any temporary fix ?

@mzenner1

This comment has been minimized.

Copy link

replied Mar 7, 2017

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

@clementbeudot

This comment has been minimized.

Copy link
Contributor

replied Mar 24, 2017

Still facing the same problem.

@casiandaniel

This comment has been minimized.

Copy link

replied Mar 29, 2017

The bug is still alive!
Follow these steps to correct it:

  • create di.xml into you custom module
  • add <preference for="Magento\Theme\Model\Design\Backend\Logo" type="Vendor\YouModuleName\Model\Design\Backend\Logo"/>
  • create the file Vendor\YouModuleName\Model\Design\Backend\Logo.php
  • replace the const UPLOAD_DIR = 'logo'; with const UPLOAD_DIR = 'email/logo';
  • Test it! ;)
@mzenner1

This comment has been minimized.

Copy link

replied Mar 29, 2017

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!

@z4qx

This comment has been minimized.

Copy link

replied Apr 2, 2017

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 :/

@alextang1030

This comment has been minimized.

Copy link

replied Apr 28, 2017

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.

@eCommerceGorilla

This comment has been minimized.

Copy link

replied May 8, 2017

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.

@El-Rico

This comment has been minimized.

Copy link

replied Jul 20, 2017

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?

@catzpaw164

This comment has been minimized.

Copy link

replied Aug 30, 2017

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.

@hostep

This comment has been minimized.

Copy link
Contributor

replied Aug 31, 2017

@catzpaw164: this issue is fixed in Magento 2.1.8:

Magento now successfully uploads the thumbnail images for email logos that are used in transactional emails. Previously, these thumbnail images were not displayed.

The email logo image function now works as expected. GitHub-5352, GitHub-5633, GitHub-5916 GitHub-6275, GitHub-9590

@lclghst

This comment has been minimized.

Copy link

replied Sep 6, 2017

@eCommerceGorilla

your solution worked great, thanks!

@Anees-Ahmad

This comment has been minimized.

Copy link

replied Oct 30, 2017

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.

@aKalisch

This comment has been minimized.

Copy link

replied Oct 30, 2017

@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.

@mzenner1

This comment has been minimized.

Copy link

replied Oct 30, 2017

This bug has been fixed in 2.2. Be aware when upgrading. Make sure the modules you installed are compatible with 2.2 beforehand.

Please sign in to comment.
You can’t perform that action at this time.