我复制了magento-frontend-luma主题 并更改vendor \ theme名称并粘贴到设计文件夹中 magento2 \应用\设计\前端\ Webmyne \ pruthvi
在registration.php中
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
'frontend/Webmyne/pruthvi',
__DIR__
);
在theme.xml中
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Webmyne Pruthvi</title>
<parent>Magento/blank</parent>
<media>
<preview_image>media/preview.jpg</preview_image>
</media>
</theme>
在composer.json
中{
"name": "webmyne/pruthvi",
"description": "N/A",
"require": {
"php": "7.0.2|7.0.4|~7.0.6|~7.1.0",
"magento/theme-frontend-blank": "100.2.*",
"magento/framework": "101.0.*"
},
"type": "magento2-theme",
"version": "100.2.3",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload": {
"files": [
"registration.php"
]
}
}
但是当我尝试改变主题时 来自CONTENT&gt;设计&gt;构造
我收到错误 '区域已经设置'
答案 0 :(得分:0)
我认为问题出在您的registration.php
文件
尝试以这种方式改变它
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
'Webmyne_pruthvi',
__DIR__
);
所以删除声明中的frontend
部分。如果您从已经声明为前端区域的主题继承,则无需指定区域。
答案 1 :(得分:0)
这是Magento 2.2.4 C.E。
的重新发行 Magento由Daniel Ruf在https://github.com/magento/magento2/commit/7019a0a1392095185505ff3ca7b97dd3e9cb4ef2在PR#15137修复,并已在2.2-develop分支合并您需要修改setForcedArea方法的代码并使用下面的方法替换该方法代码。
public function setForcedArea($templateId)
{
if (!isset($this->area)) {
$this->area = $this->emailConfig->getTemplateArea($templateId);
}
return $this;
}
参考: