如何在客户设置中添加新的设置值

编程入门 行业动态 更新时间:2024-10-06 08:24:04
本文介绍了如何在客户设置中添加新的设置值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在安装 nopcommerce 2.5 后在客户设置页面(/Admin/Setting/CustomerUser)中添加新的设置值.我该怎么做?我有 nopcommerce 2.5 源代码.我正在寻找自定义客户设置页面的方法添加新的观看价值.

I want to add new setting value in Customer settings Page(/Admin/Setting/CustomerUser) after installed nopcommerce 2.5.How can I do?I got nopcommerce 2.5 source code.I'm finding the ways to customize Customer settings Page to add new seeting value.

推荐答案

您需要在 CustomerSettingsModel 中添加新属性,例如

you need to add new property in CustomerSettingsModel e.g

//Nop.Admin/Models/Setting/ public bool ZipCodeEnbale{get;set}

然后在 CustomerUser.cshtml 中为其添加控件

then add control for it in CustomerUser.cshtml

//Nop.Admin/Views/Setting/ <tr> <td class="adminTitle"> @Html.NopLabelFor(model => model.CustomerSettings.ZipCodeEnbale): </td> <td class="adminData"> @Html.EditorFor(model => model.CustomerSettings.ZipCodeEnbale) @Html.ValidationMessageFor(model => model.CustomerSettings.ZipCodeEnbale) </td> </tr>

运行应用程序后,您将看到新属性将添加到 CustomerSeeting 标签中的管理员/客户设置页面下.

after run the application you will see new property will add under Admin/Customer setting page in CustomerSeeting tab.

注意:如果您在安装 nopcommerec 时将默认值设置为属性,那么您需要在 (Nop.Service) 中的 InstallationService.cs 中进行一些额外的更改在安装设置方法下的 CustomerSettings 中添加新的属性值.例如

Note: if you ant to set default value to property while installing nopcommerec then you need to some additional chnages in InstallationService.cs in (Nop.Service) add new property value in CustomerSettings under InstallSettings method. e.g

EngineContext.Current.Resolve<IConfigurationProvider<CustomerSettings>>() .SaveSettings(new CustomerSettings() { ZipCodeEnbale= true, }

更多推荐

如何在客户设置中添加新的设置值

本文发布于:2023-11-28 04:28:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640961.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:客户   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!