I have upgraded to version 2.2.4 from 2.2.3 now I'm getting error when try to save theme seting
-
I'm getting the same; no idea what that means.– Kristoffer Vågen BirkenesCommented May 6, 2018 at 8:13
-
Me too, it must be a bug, also I noticed that my product meta titles are gone in simple products and breadcrumbs are gone too also the back button text has changed.– Coen PonsenCommented May 10, 2018 at 11:11
4 Answers
This is a re-owned issue of Magento 2.2.4 C.E.
Magento has been fixed by Daniel Ruf at https://github.com/magento/magento2/commit/7019a0a1392095185505ff3ca7b97dd3e9cb4ef2 at PR #15137 and already merge at 2.2-develop branch
You need to modify the code of Magento\Email\Model\AbstractTemplate
setForcedArea method and Replace that method code using below one.
public function setForcedArea($templateId)
{
if (!isset($this->area)) {
$this->area = $this->emailConfig->getTemplateArea($templateId);
}
return $this;
}
And it will be released on coming any version.Still is not fixed 2.2.5
-
It is not released in 2.2.5. I am getting same error in CE 2.2.5. Can you please help me to override this file ?– MGentoCommented Jun 29, 2018 at 6:41
-
The above fix is not working for me in version 2.2.5. is there any other solution to solve this? Commented Jul 4, 2018 at 7:02
It's thrown by this function in file vendor/magento/module-email/Model/AbstractTemplate.php
on line 570.
Note I have commented out the error throwing part - which allows me to change the theme with what seems to be no ill effects. You could probably get the same results.
/** * Store the area associated with a template so that it will be returned by getDesignConfig and getDesignParams * * @param string $templateId * @return $this * @throws \Magento\Framework\Exception\MailException */ public function setForcedArea($templateId) { #if ($this->area) { # throw new \LogicException(__('Area is already set')); #} $this->area = $this->emailConfig->getTemplateArea($templateId); return $this; }
-
Can you help me overriding vendor/magento/module-email/Model/AbstractTemplate.php? Commented May 28, 2018 at 9:44
-
Your solution is working great if I make changes in the vendor file, but since the class is an abstract class, I am not able to override it. Commented May 28, 2018 at 9:45
-
@MohitKumarArora How did you override it ? I have tried to override it using the plugin way, but not working for me. Any help would be greatly appreciated.– MGentoCommented Jun 29, 2018 at 6:38
-
1@MGento, please try this github.com/pfortin-expertime/MageFix-Misc Commented Jun 29, 2018 at 6:52
-
@MGento, Can you post a question for this and upvote my answer there? Commented Jun 29, 2018 at 10:35
I have overridden this function using a plugin. Please find my answer here https://magento.stackexchange.com/a/232745/48571
Don't need plugin. Just apply patch.
composer require cweagans/composer-patches
mkdir ./patches
mkdir ./patches/composer
./patches/composer/area.patch
diff --git a/vendor/magento/module-email/Model/AbstractTemplate.php b/vendor/magento/module-email/Model/AbstractTemplate.php
index fa9d280..ecd6502 100644
--- a/vendor/magento/module-email/Model/AbstractTemplate.php
+++ b/vendor/magento/module-email/Model/AbstractTemplate.php
@@ -534,10 +534,10 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn
*/
public function setForcedArea($templateId)
{
- if ($this->area) {
- throw new \LogicException(__('Area is already set'));
+ if ($this->area === null) {
+ $this->area = $this->emailConfig->getTemplateArea($templateId);
}
- $this->area = $this->emailConfig->getTemplateArea($templateId);
+
return $this;
}
composer.json
"extra": {
"magento-force": "override",
"composer-exit-on-patch-failure": true,
"patches": {
"magento/module-email": {
"Design Area code error": "patches/composer/area.patch"
}
}
}
Run composer install