如何在自定义 Shopware 主题中包含自定义插件的模板?

pwa*_*ner 2 php templates smarty shopware

我试图将自定义插件的模板包含在Shopware 5.2 的自定义主题中。

主题模板包含以下行:

{include file="frontend/custom/colorpicker.tpl"}
Run Code Online (Sandbox Code Playgroud)

插件模板位于/custom/plugins/PLUGINNAME/Resources/views/frontend/custom/colorpicker.tpl

我收到以下错误消息:

致命错误:未捕获的 SmartyException:无法在“frontend/detail/index.tpl|frontend/plugins/seo/index.tpl”中加载模板片段“frontend/custom/colorpicker.tpl”...

我已经尝试将父级添加到文件路径,但没有任何乐趣。错误消息消失,但模板未加载:

{include file="parent:frontend/custom/colorpicker.tpl"}
Run Code Online (Sandbox Code Playgroud)

不幸的是,我在 Shopware 文档中找不到任何内容,说明是否需要任何特殊内容才能包含插件中的模板。

小智 5

protected $injectBeforePlugins = true;尝试在主题中添加类变量Theme.php

https://developers.shopware.com/designers-guide/smarty/#inheritance-and-plugin-templates