I am unable to apply a new theme in a clean install of 2.2.4. Upading to 2.2.5 does not fix the problem.
-
could please share with me what have you actually done– Hitesh KoshtiMay 11, 2018 at 11:26
-
Hello @SwapnilTatkondawar, As per your instructions i have D/L the patch... but where do i install it on my IDE before running the said command? Thank you,– rav narayanFeb 13, 2019 at 7:49
-
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review– Sukumar GoraiFeb 13, 2019 at 8:10
-
If i can't ask on an existing question would you like me to create a duplicate?– rav narayanFeb 13, 2019 at 8:11
-
Please add comment instead of adding it as an answer.– Sukumar GoraiFeb 13, 2019 at 8:13
4 Answers
Note : This is a know issue in Magento 2.2.4 (see GitHub issue) and below fix is just a temp fix. You should not directly change the Magento core file (override or create a plugin)
Change in Magento\Email\Model\AbstractTemplate.php
this:
public function setForcedArea($templateId)
{
if ($this->area) {
throw new \LogicException(__('Area is already set'));
}
$this->area = $this->emailConfig->getTemplateArea($templateId);
return $this;
}
For this:
public function setForcedArea($templateId)
{
if (!isset($this->area)) {
$this->area = $this->emailConfig->getTemplateArea($templateId);
}
return $this;
}
It should fix the issue
Update : can also be fixed by applying this Patch
-
3Thanks! This has solved my issue. To reproduce: In Content > Design > Configuration > "Edit" your theme on Store View Level. If you do any change (no matter if applying a theme or changing a logo) the following message pops up: "Something went wrong while saving this configuration: Area is already set [on hold]". May 13, 2018 at 13:03
-
3It worked as i edited in core file. How to override this specifc model file so i dont edit any core file. What is the folder structure i need to use in app folder. May 23, 2018 at 13:10
-
2Magento 2 doesn't do hotfix releases, unfortunately. However, they've released an official patch over here: magento.com/tech-resources/download (search for MAGETWO-93036). Apply this patch by using below command patch -p1 < m2-hotfixes/EE-MAGETWO-93036-2018-07-02-07-07-16.patch. After applying mention patch and It works perfectly. Aug 28, 2018 at 11:39
-
2
-
1Thanks for updating your answer with the link to the patch file :) Oct 8, 2018 at 15:36
For fixed error Something went wrong while saving this configuration: Area is already set
while saving theme configuration. You want create plugin for override Magento\Email\Model\AbstractTemplate.php
file in custom module. And update setForcedArea()
function.
File path: magento/app/code/Vendor/AreaConfigFix/registration.php
<?php
use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Vendor_AreaConfigFix', __DIR__);
File path: magento/app/code/Vendor/AreaConfigFix/etc/module.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_AreaConfigFix" setup_version="1.0.0">
<sequence>
<module name="Magento_Email"/>
</sequence>
</module>
</config>
File path: magento/app/code/Vendor/AreaConfigFix/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Email\Model\AbstractTemplate">
<plugin name="email_setforced_area" type="Vendor\AreaConfigFix\Plugin\Email\Model\AbstractTemplate" />
</type>
</config>
File path: magento/app/code/Vendor/AreaConfigFix/Plugin/Email/Model/AbstractTemplate.php
<?php
namespace Vendor\AreaConfigFix\Plugin\Email\Model;
class AbstractTemplate
{
private $emailConfig;
public function __construct(\Magento\Email\Model\Template\Config $emailConfig)
{
$this->emailConfig = $emailConfig;
}
public function aroundSetForcedArea(\Magento\Email\Model\AbstractTemplate $subject, \Closure $proceed, $templateId)
{
if (!isset($this->area)) {
$this->area = $this->emailConfig->getTemplateArea($templateId);
}
return $this;
}
}
Instead of installing the patch given by magento or changing the core files directly here is how I did it:
"File path: magento/app/code/Vendor/ThemeErrorFix/registration.php"
<?php
use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Vendor_ThemeErrorFix', __DIR__);
"File path: magento/app/code/Vendor/ThemeErrorFix/etc/module.xml"
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_ThemeErrorFix" setup_version="1.0.0">
<sequence>
<module name="Magento_Email"/>
</sequence>
</module>
</config>
"File path: magento/app/code/Vendor/ThemeErrorFix/etc/di.xml"
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Email\Model\Template">
type="email_setforced_area" type="Vendor\ThemeErrorFix\Model\Template" />
</config>
"File path: magento/app/code/Vendor/ThemeErrorFix/Model/Template.php"
<?php
namespace Vendor\ThemeErrorFix\Model;
use Magento\Email\Model\Template as coreTemplate;
class Template extends coreTemplate
{
public function setForcedArea($templateId)
{
if (!isset($this->area)) {
$this->area = $this->emailConfig->getTemplateArea($templateId);
}
return $this;
}
}
I corrected your code by removing the duplicated type attribute.
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Email\Model\Template"
type="Vendor\ThemeErrorFix\Model\Template" />
</config>