public ActionResult AddShippingByWeightRecord(ShippingByWeightListModel model) { if (!ModelState.IsValid) { return(Configure()); } var sbw = new ShippingByWeightRecord() { StoreId = model.AddStoreId, ShippingMethodId = model.AddShippingMethodId, CountryId = model.AddCountryId, Zip = model.AddZip, //StateProvinceId = 0, From = model.AddFrom, To = model.AddTo, UsePercentage = model.AddUsePercentage, ShippingChargeAmount = model.AddShippingChargeAmount, ShippingChargePercentage = model.AddShippingChargePercentage, SmallQuantitySurcharge = model.SmallQuantitySurcharge, SmallQuantityThreshold = model.SmallQuantityThreshold, }; _shippingByWeightService.InsertShippingByWeightRecord(sbw); return(Configure()); }
public IActionResult SaveGeneralSettings(ShippingByWeightListModel model) { //save settings _shippingByWeightSettings.LimitMethodsToCreated = model.LimitMethodsToCreated; _settingService.SaveSetting(_shippingByWeightSettings); return(Json(new { Result = true })); }
public ActionResult SaveGeneralSettings(ShippingByWeightListModel model) { //save settings _shippingByWeightSettings.LimitMethodsToCreated = model.LimitMethodsToCreated; _settingService.SaveSetting(_shippingByWeightSettings); return(Configure()); }
public ActionResult Configure() { var model = new ShippingByWeightListModel(); //other settings model.LimitMethodsToCreated = _shippingByWeightSettings.LimitMethodsToCreated; return(View("Nop.Plugin.Shipping.ByWeight.Views.ShippingByWeight.Configure", model)); }
public IActionResult Configure() { var model = new ShippingByWeightListModel(); //other settings model.LimitMethodsToCreated = _shippingByWeightSettings.LimitMethodsToCreated; return(View("~/Plugins/Shipping.ByWeight/Views/Configure.cshtml", model)); }
public IActionResult Configure() { var model = new ShippingByWeightListModel(); model.LimitMethodsToCreated = _shippingByWeightSettings.LimitMethodsToCreated; model.DisplayOrder = _shippingByWeightSettings.DisplayOrder; return(View(model)); }
public async Task <IActionResult> SaveGeneralSettings(ShippingByWeightListModel model) { //save settings _shippingByWeightSettings.LimitMethodsToCreated = model.LimitMethodsToCreated; _shippingByWeightSettings.DisplayOrder = model.DisplayOrder; await _settingService.SaveSetting(_shippingByWeightSettings); return(Json(new { Result = true })); }
public ActionResult SaveGeneralSettings(ShippingByWeightListModel model) { //save settings _shippingByWeightSettings.LimitMethodsToCreated = model.LimitMethodsToCreated; _shippingByWeightSettings.CalculatePerWeightUnit = model.CalculatePerWeightUnit; _shippingByWeightSettings.IncludeWeightOfFreeShippingProducts = model.IncludeWeightOfFreeShippingProducts; _services.Settings.SaveSetting(_shippingByWeightSettings); return(Configure()); }
public ActionResult SaveGeneralSettings(ShippingByWeightListModel model) { //save settings _shippingByWeightSettings.LimitMethodsToCreated = model.LimitMethodsToCreated; _settingService.SaveSetting(_shippingByWeightSettings); //quick hack // _prodMapObjectContext.Install(); return(Json(new { Result = true })); }
public ActionResult Configure() { var shippingMethods = _shippingService.GetAllShippingMethods(); if (shippingMethods.Count == 0) { return(Content("No shipping methods can be loaded")); } var model = new ShippingByWeightListModel(); foreach (var sm in shippingMethods) { model.AvailableShippingMethods.Add(new SelectListItem() { Text = sm.Name, Value = sm.Id.ToString() }); } //stores model.AvailableStores.Add(new SelectListItem() { Text = "*", Value = "0" }); foreach (var store in _storeService.GetAllStores()) { model.AvailableStores.Add(new SelectListItem() { Text = store.Name, Value = store.Id.ToString() }); } model.AvailableCountries.Add(new SelectListItem() { Text = "*", Value = "0" }); var countries = _countryService.GetAllCountries(true); foreach (var c in countries) { model.AvailableCountries.Add(new SelectListItem() { Text = c.Name, Value = c.Id.ToString() }); } model.LimitMethodsToCreated = _shippingByWeightSettings.LimitMethodsToCreated; model.CalculatePerWeightUnit = _shippingByWeightSettings.CalculatePerWeightUnit; model.PrimaryStoreCurrencyCode = _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode; model.BaseWeightIn = _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId).Name; model.GridPageSize = _adminAreaSettings.GridPageSize; return(View(model)); }
public ActionResult Configure(ShippingByWeightListModel model) { _shippingByWeightSettings.LimitMethodsToCreated = model.LimitMethodsToCreated; _shippingByWeightSettings.CalculatePerWeightUnit = model.CalculatePerWeightUnit; _shippingByWeightSettings.IncludeWeightOfFreeShippingProducts = model.IncludeWeightOfFreeShippingProducts; _services.Settings.SaveSetting(_shippingByWeightSettings); NotifySuccess(T("Admin.Configuration.Updated")); return(Configure()); }
public ActionResult Configure() { var shippingMethods = _shippingService.GetAllShippingMethods(); if (shippingMethods.Count == 0) { return(Content(T("Admin.Configuration.Shipping.Methods.NoMethodsLoaded"))); } var model = new ShippingByWeightListModel(); var countries = _countryService.GetAllCountries(true); var allStores = _services.StoreService.GetAllStores(); foreach (var sm in shippingMethods) { model.AvailableShippingMethods.Add(new SelectListItem { Text = sm.Name, Value = sm.Id.ToString() }); } model.AvailableStores.Add(new SelectListItem { Text = "*", Value = "0" }); foreach (var store in allStores) { model.AvailableStores.Add(new SelectListItem { Text = store.Name, Value = store.Id.ToString() }); } model.AvailableCountries.Add(new SelectListItem { Text = "*", Value = "0" }); foreach (var c in countries) { model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString() }); } model.LimitMethodsToCreated = _shippingByWeightSettings.LimitMethodsToCreated; model.CalculatePerWeightUnit = _shippingByWeightSettings.CalculatePerWeightUnit; model.IncludeWeightOfFreeShippingProducts = _shippingByWeightSettings.IncludeWeightOfFreeShippingProducts; model.PrimaryStoreCurrencyCode = _services.StoreContext.CurrentStore.PrimaryStoreCurrency.CurrencyCode; model.BaseWeightIn = _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId)?.GetLocalized(x => x.Name) ?? string.Empty; model.GridPageSize = _adminAreaSettings.GridPageSize; return(View(model)); }
public ActionResult AddShippingRate(ShippingByWeightListModel model) { var sbw = new ShippingByWeightRecord() { ShippingMethodId = model.AddShippingMethodId, CountryId = model.AddCountryId, StateProvinceId = model.AddStateProvinceId, Zip = model.AddZip, From = model.AddFrom, To = model.AddTo, UsePercentage = model.AddUsePercentage, ShippingChargeAmount = model.AddShippingChargeAmount, ShippingChargePercentage = model.AddShippingChargePercentage }; _shippingByWeightService.InsertShippingByWeightRecord(sbw); return(Json(new { Result = true })); }
public ActionResult AddShippingByWeightRecord(ShippingByWeightListModel model) { if (!ModelState.IsValid) { return(Configure()); } var sbw = new ShippingByWeightRecord() { ShippingMethodId = model.AddShippingMethodId, CountryId = model.AddCountryId, From = model.AddFrom, To = model.AddTo, UsePercentage = model.AddUsePercentage, ShippingChargeAmount = model.AddShippingChargeAmount, ShippingChargePercentage = model.AddShippingChargePercentage }; _shippingByWeightService.InsertShippingByWeightRecord(sbw); return(Configure()); }
public ActionResult AddShippingByWeightRecord(ShippingByWeightListModel model) { var sbw = new ShippingByWeightRecord() { StoreId = model.AddStoreId, ShippingMethodId = model.AddShippingMethodId, CountryId = model.AddCountryId, Zip = model.AddZip, //StateProvinceId = 0, From = model.AddFrom, To = model.AddTo, UsePercentage = model.AddUsePercentage, ShippingChargeAmount = model.AddShippingChargeAmount, ShippingChargePercentage = model.AddShippingChargePercentage, SmallQuantitySurcharge = model.SmallQuantitySurcharge, SmallQuantityThreshold = model.SmallQuantityThreshold, }; _shippingByWeightService.InsertShippingByWeightRecord(sbw); NotifySuccess(T("Plugins.Shipping.ByWeight.AddNewRecord.Success")); return(Json(new { Result = true })); }
public ActionResult Configure() { var shippingMethods = _shippingService.GetAllShippingMethods(); if (shippingMethods.Count == 0) { return(Content("No shipping methods can be loaded")); } var model = new ShippingByWeightListModel(); foreach (var sm in shippingMethods) { model.AvailableShippingMethods.Add(new SelectListItem() { Text = sm.Name, Value = sm.Id.ToString() }); } model.AvailableCountries.Add(new SelectListItem() { Text = "*", Value = "0" }); var countries = _countryService.GetAllCountries(true); foreach (var c in countries) { model.AvailableCountries.Add(new SelectListItem() { Text = c.Name, Value = c.Id.ToString() }); } model.LimitMethodsToCreated = _shippingByWeightSettings.LimitMethodsToCreated; model.CalculatePerWeightUnit = _shippingByWeightSettings.CalculatePerWeightUnit; model.PrimaryStoreCurrencyCode = _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode; model.BaseWeightIn = _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId).Name; model.Records = _shippingByWeightService.GetAll() .Select(x => { var m = new ShippingByWeightModel() { Id = x.Id, ShippingMethodId = x.ShippingMethodId, CountryId = x.CountryId, From = x.From, To = x.To, UsePercentage = x.UsePercentage, ShippingChargePercentage = x.ShippingChargePercentage, ShippingChargeAmount = x.ShippingChargeAmount, }; var shippingMethodId = _shippingService.GetShippingMethodById(x.ShippingMethodId); m.ShippingMethodName = (shippingMethodId != null) ? shippingMethodId.Name : "Unavailable"; if (x.CountryId > 0) { var c = _countryService.GetCountryById(x.CountryId); m.CountryName = (c != null) ? c.Name : "Unavailable"; } else { m.CountryName = "*"; } return(m); }) .ToList(); return(View("Nop.Plugin.Shipping.ByWeight.Views.ShippingByWeight.Configure", model)); }
public ActionResult Configure() { var shippingMethods = _shippingService.GetAllShippingMethods(); if (shippingMethods.Count == 0) return Content("No shipping methods can be loaded"); var model = new ShippingByWeightListModel(); foreach (var sm in shippingMethods) model.AvailableShippingMethods.Add(new SelectListItem() { Text = sm.Name, Value = sm.Id.ToString() }); //stores model.AvailableStores.Add(new SelectListItem() { Text = "*", Value = "0" }); foreach (var store in _storeService.GetAllStores()) model.AvailableStores.Add(new SelectListItem() { Text = store.Name, Value = store.Id.ToString() }); model.AvailableCountries.Add(new SelectListItem() { Text = "*", Value = "0" }); var countries = _countryService.GetAllCountries(true); foreach (var c in countries) model.AvailableCountries.Add(new SelectListItem() { Text = c.Name, Value = c.Id.ToString() }); model.LimitMethodsToCreated = _shippingByWeightSettings.LimitMethodsToCreated; model.CalculatePerWeightUnit = _shippingByWeightSettings.CalculatePerWeightUnit; model.PrimaryStoreCurrencyCode = _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode; model.BaseWeightIn = _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId).Name; model.Records = _shippingByWeightService.GetAll() .Select(x => { var m = new ShippingByWeightModel() { Id = x.Id, StoreId = x.StoreId, ShippingMethodId = x.ShippingMethodId, CountryId = x.CountryId, From = x.From, To = x.To, UsePercentage = x.UsePercentage, ShippingChargePercentage = x.ShippingChargePercentage, ShippingChargeAmount = x.ShippingChargeAmount, }; //shipping method var shippingMethodId = _shippingService.GetShippingMethodById(x.ShippingMethodId); m.ShippingMethodName = (shippingMethodId != null) ? shippingMethodId.Name : "Unavailable"; //store var store = _storeService.GetStoreById(x.StoreId); m.StoreName = (store != null) ? store.Name : "*"; if (x.CountryId > 0) { var c = _countryService.GetCountryById(x.CountryId); m.CountryName = (c != null) ? c.Name : "Unavailable"; } else { m.CountryName = "*"; } return m; }) .ToList(); return View("SmartStore.Plugin.Shipping.ByWeight.Views.ShippingByWeight.Configure", model); }
public ActionResult SaveGeneralSettings(ShippingByWeightListModel model) { //save settings _shippingByWeightSettings.LimitMethodsToCreated = model.LimitMethodsToCreated; _shippingByWeightSettings.CalculatePerWeightUnit = model.CalculatePerWeightUnit; _settingService.SaveSetting(_shippingByWeightSettings); return Configure(); }
public ActionResult AddShippingByWeightRecord(ShippingByWeightListModel model) { if (!ModelState.IsValid) { return Configure(); } var sbw = new ShippingByWeightRecord() { StoreId = model.AddStoreId, ShippingMethodId = model.AddShippingMethodId, CountryId = model.AddCountryId, //StateProvinceId = 0, From = model.AddFrom, To = model.AddTo, UsePercentage = model.AddUsePercentage, ShippingChargeAmount = model.AddShippingChargeAmount, ShippingChargePercentage = model.AddShippingChargePercentage }; _shippingByWeightService.InsertShippingByWeightRecord(sbw); return Configure(); }