All settings in configuration

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 12 años
Hi guys, an easy one for you!

If I were to add a new setting into configuration > all settings, how can I go about checking the setting exists and using throughout the project, namely in nop.web?

Thanks in advance!

Dave
Hace 12 años
You use the ISettingService to get it.


private readonly ISettingService _settingService = EngineContext.Current.Resolve<ISettingService>();

_settingService.GetSettingByKey<T>("YOURKEY");


The first line is only if you aren't injecting the service in your constructor.  The "T" in the second line is the type you want the value as (int, string, etc).  "YOURKEY" is the Setting name you gave it earlier on the All Settings screen.
Hace 12 años
Spot on, thanks Andy, I knew it would be easy!

Any idea on how I could update the setting via a custom admin page, I need to make a few amends to my admin section and it will be easier just to add a setting and update it rather than creating more tables etc, can I just use the code from the all settings page but somehow make it only update the settings I have pulled out on to the custom page?

Thanks again!

Dave
Hace 12 años
I think it might be easier to use code typical of a plugin that has settings - e.g. Shipping.ByWeight
Hace 12 años
inspired wrote:
Spot on, thanks Andy, I knew it would be easy!

Any idea on how I could update the setting via a custom admin page, I need to make a few amends to my admin section and it will be easier just to add a setting and update it rather than creating more tables etc, can I just use the code from the all settings page but somehow make it only update the settings I have pulled out on to the custom page?

Thanks again!

Dave


I'm pretty sure all of the Setting pages are just frontends for that table.  You could probably just add a new Action and View to the SettingController in Nop.Admin.
Hace 6 años
Hi,

Unable to access values on tabs at this path(Configurations >  Settings > Customer Settings) in my plugin controller.I want to access value "Registration Method" Select box.

Quick Response will be highly appreciated.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.