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

How to include template from custom plugin in custom Shopware theme?

我正在尝试在 Shopware 5.2.

的自定义主题中包含来自自定义插件的模板

主题模板包含以下行:

{include file="frontend/custom/colorpicker.tpl"}

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

我收到以下错误消息:

Fatal error: Uncaught SmartyException: Unable to load template snippet 'frontend/custom/colorpicker.tpl' in 'frontend/detail/index.tpl|frontend/plugins/seo/index.tpl' in...

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

{include file="parent:frontend/custom/colorpicker.tpl"}

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

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

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