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

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

Closed
hostep opened this issue Feb 7, 2018 · 42 comments
Assignees
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release

Comments

@hostep
Copy link
Contributor

hostep commented Feb 7, 2018

Preconditions

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

Steps to reproduce

  1. Setup a clean Magento from the 2.2-develop using commit f18377b
  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.

@magento-engcom-team magento-engcom-team added Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed labels Feb 7, 2018
@magento-engcom-team
Copy link
Contributor

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

@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release and removed Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Feb 7, 2018
@AngelBS
Copy link

AngelBS commented Mar 2, 2018

#MageTitansMX

@magento-engcom-team
Copy link
Contributor

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

AngelBS added a commit to AngelBS/magento2 that referenced this issue Mar 2, 2018
@AngelBS AngelBS mentioned this issue Mar 2, 2018
4 tasks
@hostep
Copy link
Contributor Author

hostep commented May 10, 2018

For future reference, this problem was introduced in 5e93220 which was a fix for #8437, yet I think the commit which introduced this looks fine and only revealed a deeper problem (but not entirely sure).

@DanielRuf
Copy link
Contributor

DanielRuf commented May 10, 2018

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

@DanielRuf
Copy link
Contributor

5e93220#diff-36cd96b3be4f49a6c44df680cedf1008R249

So it return false there.

@DanielRuf
Copy link
Contributor

We should check then if and how we can solve the root cause and merge this with #15137 as I am not sure if these 2 issues are directly connected.

@magento-engcom-team
Copy link
Contributor

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

The fix will be available with the upcoming 2.2.5 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label May 16, 2018
@syedsaleem086
Copy link

Hi @magento-engcom-team

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

@DanielRuf
Copy link
Contributor

@syedsaleem086

The fix will be available with the upcoming 2.2.5 release.

@syedsaleem086
Copy link

Hi @DanielRuf

0ae1230
3df51d4
0dec988
d92b679

I have added these commits manually still won't work

@hostep
Copy link
Contributor Author

hostep commented Jun 13, 2018

Can you try with only this commit: 7019a0a (is a combination of the 4 before, maybe you made a mistake somewhere when trying to apply those 4)

@syedsaleem086
Copy link

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

@DanielRuf
Copy link
Contributor

Please try to update favicon

Was there an error message in this case?

@hostep
Copy link
Contributor Author

hostep commented Jun 13, 2018

@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 #14968, but when applying the fix from @DanielRuf it works again.

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

@pfortin-expertime
Copy link

pfortin-expertime commented Jun 14, 2018

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

@hostep
Copy link
Contributor Author

hostep commented Jun 14, 2018

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 7019a0a
  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!

@anish-cubet
Copy link

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

@DanielRuf
Copy link
Contributor

@anish-cubet my patch will be in 2.2.6.

@anish-cubet
Copy link

anish-cubet commented Jul 9, 2018

@DanielRuf Can I get the patch file please ?

@DanielRuf
Copy link
Contributor

@gundamkid
Copy link

gundamkid commented Jul 19, 2018

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(),
];
}

@DanielRuf
Copy link
Contributor

@gundamkid this is not the right file.

@gundamkid
Copy link

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

@DanielRuf
Copy link
Contributor

@gundamkid try 7019a0a and clear all caches.

@gundamkid
Copy link

@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

@DanielRuf
Copy link
Contributor

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.

@EliasKotlyar
Copy link
Contributor

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.

@EliasKotlyar EliasKotlyar reopened this Sep 5, 2018
@DanielRuf
Copy link
Contributor

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

@DanielRuf
Copy link
Contributor

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

This is an API change and not allowed in 2.2.

@DanielRuf
Copy link
Contributor

At least it is changed in the current dev branches.

@nghitrum
Copy link

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?

@mertgokceimam
Copy link

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

@DanielRuf
Copy link
Contributor

@mertgokceimam please check if your instance has the mentioned patch

#13530 (comment)

Afaik there was no regression.

@hostep
Copy link
Contributor Author

hostep commented Sep 12, 2019

@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
Copy link
Contributor

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

@DanielRuf
Copy link
Contributor

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

@tuyennn
Copy link
Member

tuyennn commented Apr 15, 2022

@DanielRuf @hostep this could be reproduce easily by sending an area adminhtml email while doing a frontend action.

@DanielRuf
Copy link
Contributor

@tuyennn shouldn't this already have been resolved for some years now?

Or does it happen in Magento 2.4.4? If so please open a new issue with all relevant details. Thank you.

@pmonosolo
Copy link

Still reproducible in 2.4.3:

Admin Site -> Account Setting (right top corner with Admin user name) -> Set New Password -> Save Account.

The email that is being sent is: User Notification

It must have: {{template config_path="design/email/header_template"}} in the top of the file.

You can create a custom template and then assign it to: Stores->Configuration->Advanced->Admin->User Notification Template.

The preview of the template looks correctly, but when the email is sent, the error is shown.

@DanielRuf
Copy link
Contributor

@pmonosolo

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release
Projects
None yet
Development

No branches or pull requests