2

I would like to add a decimal setting to the Catalog Settings named CustomerEnterPricePercentageSurcharge in nopcommerce 2.65. I followed the instructions on How to Add New Setting Value in Customer settings thread.

However, after following the 3 steps (listed below and modified for Catalog Settings) mentioned in the aforementioned thread, when login into the admin section and save the catalog settings the value is always 0.0000. It seems that it isn't saving (or loading) the "catalogsettings.customerenterpricepercentagesurcharge" settings value. Could someone help me clarify what the value isn't being saved?

  1. Updating Nop.Admin/Models/Setting/CatalogSettingsModel.cs with

    [NopResourceDisplayName("Admin.Configuration.Settings.Catalog.CustomerEnterPricePercentageSurcharge")]
    public decimal CustomerEnterPricePercentageSurcharge { get; set; }
    
  2. Updating Nop.Admin/Views/Setting/Catalog.cshtml with

     <tr>
        <td class="adminTitle">
            @Html.NopLabelFor(model => model.CustomerEnterPricePercentageSurcharge):
        </td>
        <td class="adminData">
            @Html.EditorFor(model => model.CustomerEnterPricePercentageSurcharge)
            @Html.ValidationMessageFor(model => model.CustomerEnterPricePercentageSurcharge)
        </td>
     </tr>
    
  3. Adding:

    "catalogsettings.customerenterpricepercentagesurcharge" under (configuration ->setting->AllSetting) and updating the 
    

Your help is very much appreciated.

Community
  • 1
  • 1
maxdmvp
  • 25
  • 6

1 Answers1

2

To be honest, you don't really have to create a new field in Nop.Admin/Views/Setting/Catalog.cshtml

You can avoid all this, and simply:

  1. Add a new value in All Settings.

  2. Then to use it, just add a new field to:

    Nop.Core.Domain.Catalog.CatalogSettings

such as

    /// <summary>
    /// Gets or sets a surcharge
    /// </summary>
    public decimal CustomerEnterPricePercentageSurcharge { get; set; }
maxdmvp
  • 25
  • 6
Carlos Martinez T
  • 6,458
  • 1
  • 34
  • 40