如何在 NopCommerce 插件中添加自定义产品模板

问题描述

我创建了一个插件,但它需要一个定制的产品模板,我无法让它工作。有人可以帮我理解我做错了什么吗?

到目前为止我有:

  1. 转到 https://example.com/Admin/Template/List 并添加了新的产品模板 1a.将视图路径设置为“myCustomPlugin.Views.Product.ProductTemplateCustom.Simple”
  2. 转到 https://example.com/Admin/Product/Edit/46 并使用新产品模板设置该产品
  3. 在我的插件代码中,我在以下位置创建了模板:myCustomPlugin\Views\Product\ProductTemplateCustom.Simple.cshtml
  4. 加载了产品页面

当我加载产品页面时,我得到:

InvalidOperationException:InvalidOperationException:未找到视图“ProductTemplateCustom.Simple”。搜索了以下位置:/Themes/DefaultClean/Views/Product/ProductTemplateCustom.Simple.cshtml /Themes/DefaultClean/Views/Shared/ProductTemplateCustom.Simple.cshtml /Views/Product/ProductTemplateCustom.Simple.cshtml /Views/Shared/ProductTemplateCustom .Simple.cshtml /Pages/Shared/ProductTemplateCustom.Simple.cshtml

  • 我已经检查了 Nop.Web\Plugins\myCustomPlugin\Views\Product 并且 ProductTemplateCustom.Simple.cshtml 已被复制。

  • 我查看了 RouteProvider.cs,希望将一些路由配置添加到我的插件中,但我什么也看不到

  • Their documentation 说我必须向 Views\Product 添加一个新的产品模板,所以我已经这样做了,但它存在于我的插件路径中,我无法弄清楚如何让 NopCommerce看那个位置

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)