public ActionResult Configure(ConfigurationModel model) { if (!ModelState.IsValid) return Configure(); //load settings for a chosen store scope var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext); var settings = _settingService.LoadSetting<ExtendedVendorSettings>(storeScope); //save settings settings.DefaultShippingCharge = model.DefaultShippingCharge; settings.DefaultCommissionPercentage = model.DefaultCommissionPercentage; if (model.DefaultCommissionPercentage_OverrideForStore || storeScope == 0) _settingService.SaveSetting(settings, x => x.DefaultCommissionPercentage, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(settings, x => x.DefaultCommissionPercentage, storeScope); if (model.DefaultShippingCharge_OverrideForStore || storeScope == 0) _settingService.SaveSetting(settings, x => x.DefaultShippingCharge, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(settings, x => x.DefaultShippingCharge, storeScope); //now clear settings cache _settingService.ClearCache(); return Configure(); }
public ActionResult Configure() { //load settings for a chosen store scope var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext); var settings = _settingService.LoadSetting<ExtendedVendorSettings>(storeScope); var model = new ConfigurationModel { DefaultCommissionPercentage = settings.DefaultCommissionPercentage, DefaultShippingCharge = settings.DefaultShippingCharge, ActiveStoreScopeConfiguration = storeScope }; if (storeScope > 0) { model.DefaultCommissionPercentage_OverrideForStore = _settingService.SettingExists(settings, x => x.DefaultCommissionPercentage, storeScope); model.DefaultShippingCharge_OverrideForStore = _settingService.SettingExists(settings, x => x.DefaultShippingCharge, storeScope); } return View("ExtendedVendor/Configure", model); }