Magento2: "Template file 'header.html' is not found" error while trying to save Design Configuration.

Created on 7 Feb 2018  路  38Comments  路  Source: magento/magento2

Preconditions

  1. Magento 2.2-develop branch, current commit: f18377b9e59
  2. PHP 7.0.27

Steps to reproduce

  1. Setup a clean Magento from the 2.2-develop using commit f18377b9e59
  2. Go into the backend to Content => Design => Configuration
  3. Open either the Global or Website scoped configuration
  4. Click 'Save and Continue'

Expected result

  1. Configuration should be saved without errors

Actual result

  1. We are getting the error: Something went wrong while saving this configuration: Template file 'header.html' is not found.

Discussion

Curiously enough, this only happens on the Global and Website scope, when trying the same on the Storeview scope, it works and we don't see this error.

Fixed in 2.2.x Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.2.x

Most helpful comment

@hostep I reproduce the error when I create another website and I want to change the theme of the new one.

And I've already patch the core with DanielRuf's fix.

All 38 comments

@hostep, thank you for your report.
We've acknowledged the issue and added to our backlog.

MageTitansMX

@AngelBS thank you for joining. Please accept team invitation here and self-assign the issue.

For future reference, this problem was introduced in https://github.com/magento/magento2/commit/5e93220a56bd741d3ec27b8a0fffd2f539e4e473 which was a fix for https://github.com/magento/magento2/issues/8437, yet I think the commit which introduced this looks fine and only revealed a deeper problem (but not entirely sure).

For reference for other contributors.

git bisect bad
5e93220a56bd741d3ec27b8a0fffd2f539e4e473 is the first bad commit
commit 5e93220a56bd741d3ec27b8a0fffd2f539e4e473
Author: RomanKis
Date:   Wed Dec 6 15:53:14 2017 +0200

    8437:Silent error when an email template is not found

:040000 040000 5bc453a9c3de0a0d4cadafaa791acfc8892d918f 825a6a59695858e125097f2f5b859afeed6a883b M      app

https://github.com/magento/magento2/commit/5e93220a56bd741d3ec27b8a0fffd2f539e4e473#diff-36cd96b3be4f49a6c44df680cedf1008R249

So it return false there.

We should check then if and how we can solve the root cause and merge this with https://github.com/magento/magento2/pull/15137 as I am not sure if these 2 issues are directly connected.

Hi @hostep. Thank you for your report.
The issue has been fixed in magento/magento2#15137 by @DanielRuf in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming 2.2.5 release.

Hi @magento-engcom-team

Still able to reproduce on a clean install of Magento2.2.4 while adding favicon from the backend

@syedsaleem086

The fix will be available with the upcoming 2.2.5 release.

Hi @DanielRuf

0ae1230c4bbe985f66929ed234835137e64664c9
3df51d4c294dda946d78ba25b9aef693cb813a0a
0dec988872e175e568c2bf4bb29548ab7a4698e5
d92b679e48da825813bfaff51e631236a2bbc73a

I have added these commits manually still won't work

Can you try with only this commit: https://github.com/magento/magento2/commit/7019a0a1392095185505ff3ca7b97dd3e9cb4ef2 (is a combination of the 4 before, maybe you made a mistake somewhere when trying to apply those 4)

Hi @hostep

I have verified and tested above modified files and let others to test in my team. It worked for changing the theme (switching) before it wasn't working. but not while updating favicon.

Please try to update favicon

Please try to update favicon

Was there an error message in this case?

@syedsaleem086: I'm unable to reproduce your problem, either with or without the fix from @DanielRuf

I tested it on all levels, Global, Website and Storeview, and it all works as expected.
On Storeview it doesn't work in a clean Magento 2.2.4 installation because of https://github.com/magento/magento2/issues/14968, but when applying the fix from @DanielRuf it works again.

If you have exact steps to reproduce, please let us know.

@hostep
Create a custom theme and try to load the favicon. thanks

@hostep I reproduce the error when I create another website and I want to change the theme of the new one.

And I've already patch the core with DanielRuf's fix.

Sorry guys, I still fail to reproduce your issue. It would be highly appreciated if someone could put down all the steps it takes to reproduce this on a clean installation, for example:

  1. Setup a clean Magento 2.2.4
  2. Apply patch https://github.com/magento/magento2/commit/7019a0a1392095185505ff3ca7b97dd3e9cb4ef2
  3. In backend: configure this and that
  4. In backend: execute this, and run into problem

Something like this.

Also an exact error message would be appreciated.

If you are able to reproduce, it might also make sense to open a new issue with all those steps to reproduce, as it might be unrelated to this one, but feel free to link back to this one if you believe it is related.

Thanks!

The issue still exists on Magento 2.2.5. How long this will take to merge with master?

@anish-cubet my patch will be in 2.2.6.

@DanielRuf Can I get the patch file please ?

I did the fix but still got error, i debugged and found my solution:

public function getDesignParams()
{
return [
// Retrieve area from getDesignConfig, rather than the getDesignTheme->getArea(), as the latter doesn't
// return the emulated area
'area' => $this->getDesignConfig()->getArea(),
'theme' => $this->design->getDesignTheme()->getCode(),
'themeModel' => $this->design->getDesignTheme(),
'locale' => $this->design->getLocale(),
];
}

i edited:

public function getDesignParams()
{
return [
// Retrieve area from getDesignConfig, rather than the getDesignTheme->getArea(), as the latter doesn't
// return the emulated area
'area' => empty($this->area) ? $this->getDesignConfig()->getArea() : $this->area,
'theme' => $this->design->getDesignTheme()->getCode(),
'themeModel' => $this->design->getDesignTheme(),
'locale' => $this->design->getLocale(),
];
}

@gundamkid this is not the right file.

@DanielRuf
Can you help me debug in case change settings of Website view or Global view?

@DanielRuf
still got the bug after I created plugin to override this function in case i edit settings on Website View or Global view.

my version is 2.2.5

still got the bug after I created plugin to override this function in case i edit settings on Website View or Global view.

Do not create a plugin, use composer-patches and there is a patch from Magento.

Hello everyone,

I am also encountering the bug which is described on the first post(Something went wrong while saving this configuration: Template file 'header.html' is not found.)

We are running a M2 EE 2.2.4.

I was able to fix it with the following modifications:

  1. Changed getDesignParams() from Magento\Email\Model\AbstractTemplate to the version described from @gundamkid
public function getDesignParams()
{
return [
// Retrieve area from getDesignConfig, rather than the getDesignTheme->getArea(), as the latter doesn't
// return the emulated area
'area' => empty($this->area) ? $this->getDesignConfig()->getArea() : $this->area,
'theme' => $this->design->getDesignTheme()->getCode(),
'themeModel' => $this->design->getDesignTheme(),
'locale' => $this->design->getLocale(),
];
}
  1. Changed the scope of the property "area" to protected(same file)
    /**
     * Package area
     *
     * @var string
     */
    protected $area;

I have checked the reason for that change, and found out that the Dotdigitalgroup_Email Extension has a Plugin for the Magento Magento\Email\Model\Template Class. This class inherits from Magento\Email\Model\AbstractTemplate. After its being initialized by the plugin-system, the area code becomes inaccessible. So the Code from @gundamkid dont work. With the change #2, it will start working again.

This is fixed in Magento 2.2.6+. Please see the previous comments.

Changed the scope of the property "area" to protected(same file)

This is an API change and not allowed in 2.2.

At least it is changed in the current dev branches.

Hi, I have this problem with 2.3.0 when I tried to upload favicon or logo to the Global level but not on website level. Is there anyone facing the same problem?

@DanielRuf the issue can still be reproduced on 2.2.9 so before closing an existing issue you need to make sure it is not happening again.

@mertgokceimam please check if your instance has the mentioned patch

https://github.com/magento/magento2/issues/13530#issuecomment-403369788

Afaik there was no regression.

@DanielRuf : there's no need for a patch on Magento 2.2.9 since the fix was included with Magento 2.2.5 and onwards 馃槈

@mertgokceimam: just to be sure, I've set up a clean Magento 2.2.9 installation and tried executing the steps to reproduce again:

  1. Go into the backend to Content => Design => Configuration
  2. Open either the Global or Website scoped configuration
  3. Click 'Save and Continue'

But I can't reproduce the problem.

If you can reproduce it, can you please list exact steps to reproduce this problem (preferably on a vanilla Magento 2.2.9 installation). Thanks!

@DanielRuf : there's no need for a patch on Magento 2.2.9 since the fix was included with Magento 2.2.5 and onwards

I know as I confirmed it and worked on the PR.

Just wanted to point to the changeset / diff so he can check that.

If you can reproduce it please open a new issue and reference this one.

Was this page helpful?
0 / 5 - 0 ratings