0

我已复制 magento-frontend-luma 主题并更改 vendor\theme 名称并粘贴到设计文件夹 magento2\app\design\frontend\Webmyne\pruthvi

在registration.php中

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'frontend/Webmyne/pruthvi',
    __DIR__
);

在主题.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 > Design > Configuration 更改主题时

我收到错误“区域已设置”

4

2 回答 2

0

这是 Magento 2.2.4 CE 的重新拥有的问题

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;
}

参考:

于 2018-06-06T06:22:13.233 回答
0

我认为问题出在您的registration.php文件中

尝试以这种方式更改它

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'Webmyne_pruthvi',
    __DIR__
);

所以删除frontend声明中的部分。如果您从已经声明为前端区域的主题继承,则无需指定区域。

于 2018-06-01T15:00:38.607 回答