zoukankan      html  css  js  c++  java
  • NopCommerce 增加 Customer Settings

    预期:

    仿照Customer 的 Phone number enabled 和 required

    增加MemberType

     

    相关步骤如下:

    1.运行站点

    Admin -> Settings -> All settings(advanced)

    -> Add new record

    仿照 customersettings.phone 新增

    customersettings.membertypeenabled

    customersettings.membertyperequired

            

    2.运行站点

    Admin -> Configuration -> Languages -> Edit

    -> Add new record

    仿照 CustomerUser.phone 新增

    Admin.Configuration.Settings.CustomerUser.MemberTypeEnabled

    Admin.Configuration.Settings.CustomerUser.MemberTypeRequired

            

    3.Nop.CoreDomainCustomersCustomerSettings.cs

    仿照 PhoneEnabled 及 PhoneRequired 新增

    /// <summary>

    /// Gets or sets a value indicating whether 'Member Type' is enabled

    /// </summary>

    public bool MemberTypeEnabled { get; set; }

    /// <summary>

    /// Gets or sets a value indicating whether 'Member Type' is required

    /// </summary>

    public bool MemberTypeRequired { get; set; }

                      

    4.PresentationNop.WebAdministrationModelsSettingsCustomerUserSettingsModel.cs

    修改 CustomerSettingsModel

    仿照 PhoneEnabled 及 PhoneRequired 新增

    [NopResourceDisplayName("Admin.Configuration.Settings.CustomerUser.MemberTypeEnabled")]

    public bool MemberTypeEnabled { get; set; }

    [NopResourceDisplayName("Admin.Configuration.Settings.CustomerUser.MemberTypeRequired")]

    public bool MemberTypeRequired { get; set; }

                      

                      

    5.PresentationNop.WebAdministrationViewsSettingCustomerUser.cshtml

    仿照 PhoneEnabled 及 PhoneRequired 新增

    <div class="form-group">

             <div class="col-md-3">

                       @Html.NopLabelFor(model => model.CustomerSettings.MemberTypeEnabled)

             </div>

             <div class="col-md-9">

                       @Html.NopEditorFor(model => model.CustomerSettings.MemberTypeEnabled)

                       @Html.ValidationMessageFor(model => model.CustomerSettings.MemberTypeEnabled)

             </div>

    </div>

    <div class="form-group" id="pnlMemberTypeRequired">

             <div class="col-md-3">

                       @Html.NopLabelFor(model => model.CustomerSettings.MemberTypeRequired)

             </div>

             <div class="col-md-9">

                       @Html.NopEditorFor(model => model.CustomerSettings.MemberTypeRequired)

                       @Html.ValidationMessageFor(model => model.CustomerSettings.MemberTypeRequired)

             </div>

    </div>

                      

    if ($('#@Html.FieldIdFor(model => model.CustomerSettings.MemberTypeEnabled)').is(':checked')) {

             $('#pnlMemberTypeRequired').show();

    } else {

             $('#pnlMemberTypeRequired').hide();

    }

    $("#@Html.FieldIdFor(model => model.CustomerSettings.MemberTypeEnabled)").click(toggleCustomerRequiredFormField);

                      

    6.解决方案 Clean 和 Rebuild

    7.运行站点 查看效果

                      

    其他:

    PresentationNop.WebAdministrationControllersSettingController.cs

    public ActionResult CustomerUser()

    {

             if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))

                       return AccessDeniedView();

             var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);

             var customerSettings = _settingService.LoadSetting<CustomerSettings>(storeScope);

                               

    PresentationNop.WebAdministrationInfrastructureMapperAutoMapperConfiguration.cs

             仿照  cfg.CreateMap<CustomerUserSettingsModel.CustomerSettingsModel, CustomerSettings>()

                 //.ForMember(dest => dest.MemberTypeEnabled, mo => mo.Ignore())

                       //.ForMember(dest => dest.MemberTypeRequired, mo => mo.Ignore())

                                                  

            

            

  • 相关阅读:
    SAP MM 有了采购订单历史的PO行项目里的采购附加费不允许再改了?
    风之语.人在职场也需要'备胎'
    两万字,任正非采访全记录
    SAP 如何得到交货单上的序列号清单?
    【2019年版】如何向SAP公司提交Message?
    工作上996,生活上669,并不是什么难事儿!
    风之语.甲骨文裁员之我见
    天河2号-保持使用yhrun/srun时连接不中断 (screen 命令教程 )
    PXE 和 计算机网络启动
    Gmail 设置,时区
  • 原文地址:https://www.cnblogs.com/freeliver54/p/6178072.html
Copyright © 2011-2022 走看看