From 1de4b2618fae965af19a4965fb4632cb162ac632 Mon Sep 17 00:00:00 2001 From: skoshelev Date: Tue, 20 Feb 2018 17:33:36 +0300 Subject: [PATCH] #1955 Added "Shipping by Total" functionality to "Shipping by Weight" plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upgrade instructions: do not forget to manually delete "/Plugins/Shipping.FixedOrByWeight" directory (it's not used anymore) and replace the plugin «Shipping.FixedOrByWeight» by the plugin «Shipping.FixedByWeightByTotal» in the App_Data/installedPlugins.json file. --- .../CodeFirstInstallationService.cs | 8 +- src/NopCommerce.sln | 2 +- .../FixedByWeightByTotalController.cs} | 111 ++++--- .../Data/EfStartUpTask.cs | 4 +- .../ShippingByWeightByTotalObjectContext.cs} | 22 +- .../Data/ShippingByWeightByTotalRecordMap.cs | 16 + .../Domain/ShippingByWeightByTotalRecord.cs} | 22 +- .../FixedByWeightByTotalComputationMethod.cs} | 199 +++++------ .../FixedByWeightByTotalDefaults.cs} | 6 +- .../FixedByWeightByTotalSettings.cs} | 8 +- .../FixedByWeightByTotalEventConsumer.cs} | 8 +- .../Infrastructure/DependencyRegistrar.cs | 18 +- .../Models/ConfigurationModel.cs | 13 + .../Models/FixedRateModel.cs | 6 +- .../Models/ShippingByWeightByTotalModel.cs | 83 +++++ ...ugin.Shipping.FixedByWeightByTotal.csproj} | 20 +- .../Notes.txt | 0 .../IShippingByWeightByTotalService.cs} | 21 +- .../ShippingByWeightByTotalService.cs} | 63 ++-- .../Views/AddRateByWeightByTotalPopup.cshtml} | 6 +- .../Views/Configure.cshtml | 14 +- .../EditRateByWeightByTotalPopup.cshtml} | 6 +- .../Views/_ByWeightByTotal.cshtml} | 34 +- ..._CreateOrUpdateRateByWeightByTotal.cshtml} | 34 +- .../Views/_FixedRate.cshtml | 8 +- .../Views/_ViewImports.cshtml | 0 .../logo.jpg | Bin .../plugin.json | 11 + .../Data/ShippingByWeightRecordMap.cs | 16 - .../Models/ConfigurationModel.cs | 13 - .../Models/ShippingByWeightModel.cs | 77 ----- .../plugin.json | 11 - .../Install/Fast/create_required_data.sql | 2 +- .../Install/Fast/create_sample_data.sql | 6 +- .../4.00-4.10 (under development)/upgrade.sql | 308 ++++++++++++++++++ 35 files changed, 775 insertions(+), 401 deletions(-) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight/Controllers/FixedOrByWeightController.cs => Nop.Plugin.Shipping.FixedByWeightByTotal/Controllers/FixedByWeightByTotalController.cs} (76%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight => Nop.Plugin.Shipping.FixedByWeightByTotal}/Data/EfStartUpTask.cs (81%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight/Data/ShippingByWeightObjectContext.cs => Nop.Plugin.Shipping.FixedByWeightByTotal/Data/ShippingByWeightByTotalObjectContext.cs} (88%) create mode 100644 src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Data/ShippingByWeightByTotalRecordMap.cs rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight/Domain/ShippingByWeightRecord.cs => Nop.Plugin.Shipping.FixedByWeightByTotal/Domain/ShippingByWeightByTotalRecord.cs} (72%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight/FixedOrByWeightComputationMethod.cs => Nop.Plugin.Shipping.FixedByWeightByTotal/FixedByWeightByTotalComputationMethod.cs} (63%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight/FixedOrByWeightDefaults.cs => Nop.Plugin.Shipping.FixedByWeightByTotal/FixedByWeightByTotalDefaults.cs} (65%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight/FixedOrByWeightSettings.cs => Nop.Plugin.Shipping.FixedByWeightByTotal/FixedByWeightByTotalSettings.cs} (66%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight/Infrastructure/Cache/FixedOrByWeightEventConsumer.cs => Nop.Plugin.Shipping.FixedByWeightByTotal/Infrastructure/Cache/FixedByWeightByTotalEventConsumer.cs} (76%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight => Nop.Plugin.Shipping.FixedByWeightByTotal}/Infrastructure/DependencyRegistrar.cs (61%) create mode 100644 src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Models/ConfigurationModel.cs rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight => Nop.Plugin.Shipping.FixedByWeightByTotal}/Models/FixedRateModel.cs (54%) create mode 100644 src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Models/ShippingByWeightByTotalModel.cs rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight/Nop.Plugin.Shipping.FixedOrByWeight.csproj => Nop.Plugin.Shipping.FixedByWeightByTotal/Nop.Plugin.Shipping.FixedByWeightByTotal.csproj} (81%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight => Nop.Plugin.Shipping.FixedByWeightByTotal}/Notes.txt (100%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight/Services/IShippingByWeightService.cs => Nop.Plugin.Shipping.FixedByWeightByTotal/Services/IShippingByWeightByTotalService.cs} (68%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight/Services/ShippingByWeightService.cs => Nop.Plugin.Shipping.FixedByWeightByTotal/Services/ShippingByWeightByTotalService.cs} (67%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight/Views/AddRateByWeightPopup.cshtml => Nop.Plugin.Shipping.FixedByWeightByTotal/Views/AddRateByWeightByTotalPopup.cshtml} (63%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight => Nop.Plugin.Shipping.FixedByWeightByTotal}/Views/Configure.cshtml (82%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight/Views/EditRateByWeightPopup.cshtml => Nop.Plugin.Shipping.FixedByWeightByTotal/Views/EditRateByWeightByTotalPopup.cshtml} (63%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight/Views/_ByWeight.cshtml => Nop.Plugin.Shipping.FixedByWeightByTotal/Views/_ByWeightByTotal.cshtml} (87%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight/Views/_CreateOrUpdateRateByWeight.cshtml => Nop.Plugin.Shipping.FixedByWeightByTotal/Views/_CreateOrUpdateRateByWeightByTotal.cshtml} (81%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight => Nop.Plugin.Shipping.FixedByWeightByTotal}/Views/_FixedRate.cshtml (96%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight => Nop.Plugin.Shipping.FixedByWeightByTotal}/Views/_ViewImports.cshtml (100%) rename src/Plugins/{Nop.Plugin.Shipping.FixedOrByWeight => Nop.Plugin.Shipping.FixedByWeightByTotal}/logo.jpg (100%) create mode 100644 src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/plugin.json delete mode 100644 src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Data/ShippingByWeightRecordMap.cs delete mode 100644 src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Models/ConfigurationModel.cs delete mode 100644 src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Models/ShippingByWeightModel.cs delete mode 100644 src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/plugin.json diff --git a/src/Libraries/Nop.Services/Installation/CodeFirstInstallationService.cs b/src/Libraries/Nop.Services/Installation/CodeFirstInstallationService.cs index 8ce43bf073e..af84ce25ef0 100644 --- a/src/Libraries/Nop.Services/Installation/CodeFirstInstallationService.cs +++ b/src/Libraries/Nop.Services/Installation/CodeFirstInstallationService.cs @@ -4493,7 +4493,7 @@ protected virtual void InstallOrders() ShippingStatus = ShippingStatus.NotYetShipped, ShippingMethod = "Ground", PickUpInStore = false, - ShippingRateComputationMethodSystemName = "Shipping.FixedOrByWeight", + ShippingRateComputationMethodSystemName = "Shipping.FixedByWeightByTotal", CustomValuesXml = string.Empty, VatNumber = string.Empty, CreatedOnUtc = DateTime.UtcNow, @@ -4660,7 +4660,7 @@ protected virtual void InstallOrders() ShippingStatus = ShippingStatus.NotYetShipped, ShippingMethod = "Next Day Air", PickUpInStore = false, - ShippingRateComputationMethodSystemName = "Shipping.FixedOrByWeight", + ShippingRateComputationMethodSystemName = "Shipping.FixedByWeightByTotal", CustomValuesXml = string.Empty, VatNumber = string.Empty, CreatedOnUtc = DateTime.UtcNow, @@ -5132,7 +5132,7 @@ protected virtual void InstallOrders() ShippingStatus = ShippingStatus.Delivered, ShippingMethod = "Ground", PickUpInStore = false, - ShippingRateComputationMethodSystemName = "Shipping.FixedOrByWeight", + ShippingRateComputationMethodSystemName = "Shipping.FixedByWeightByTotal", CustomValuesXml = string.Empty, VatNumber = string.Empty, CreatedOnUtc = DateTime.UtcNow, @@ -6336,7 +6336,7 @@ protected virtual void InstallSettings(bool installSampleData) settingService.SaveSetting(new ShippingSettings { - ActiveShippingRateComputationMethodSystemNames = new List { "Shipping.FixedOrByWeight" }, + ActiveShippingRateComputationMethodSystemNames = new List { "Shipping.FixedByWeightByTotal" }, ActivePickupPointProviderSystemNames = new List { "Pickup.PickupInStore" }, ShipToSameAddress = true, AllowPickUpInStore = true, diff --git a/src/NopCommerce.sln b/src/NopCommerce.sln index e822426cc0e..7d453764bc4 100644 --- a/src/NopCommerce.sln +++ b/src/NopCommerce.sln @@ -53,7 +53,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nop.Plugin.ExchangeRate.Ecb EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nop.Plugin.Pickup.PickupInStore", "Plugins\Nop.Plugin.Pickup.PickupInStore\Nop.Plugin.Pickup.PickupInStore.csproj", "{06C88D0B-A276-4D3D-8BE5-7C58BF3072E3}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nop.Plugin.Shipping.FixedOrByWeight", "Plugins\Nop.Plugin.Shipping.FixedOrByWeight\Nop.Plugin.Shipping.FixedOrByWeight.csproj", "{560768D4-7E1D-4431-99F0-CC14C255E167}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nop.Plugin.Shipping.FixedByWeightByTotal", "Plugins\Nop.Plugin.Shipping.FixedByWeightByTotal\Nop.Plugin.Shipping.FixedByWeightByTotal.csproj", "{560768D4-7E1D-4431-99F0-CC14C255E167}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nop.Plugin.Tax.FixedOrByCountryStateZip", "Plugins\Nop.Plugin.Tax.FixedOrByCountryStateZip\Nop.Plugin.Tax.FixedOrByCountryStateZip.csproj", "{493761CB-5190-4283-8C6C-A8CEB5450CAB}" EndProject diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Controllers/FixedOrByWeightController.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Controllers/FixedByWeightByTotalController.cs similarity index 76% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Controllers/FixedOrByWeightController.cs rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Controllers/FixedByWeightByTotalController.cs index 6d00f607399..e20943fb533 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Controllers/FixedOrByWeightController.cs +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Controllers/FixedByWeightByTotalController.cs @@ -4,9 +4,9 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Nop.Core.Domain.Directory; -using Nop.Plugin.Shipping.FixedOrByWeight.Domain; -using Nop.Plugin.Shipping.FixedOrByWeight.Models; -using Nop.Plugin.Shipping.FixedOrByWeight.Services; +using Nop.Plugin.Shipping.FixedByWeightByTotal.Domain; +using Nop.Plugin.Shipping.FixedByWeightByTotal.Models; +using Nop.Plugin.Shipping.FixedByWeightByTotal.Services; using Nop.Services.Configuration; using Nop.Services.Directory; using Nop.Services.Localization; @@ -19,23 +19,23 @@ using Nop.Web.Framework.Mvc; using Nop.Web.Framework.Mvc.Filters; -namespace Nop.Plugin.Shipping.FixedOrByWeight.Controllers +namespace Nop.Plugin.Shipping.FixedByWeightByTotal.Controllers { [AuthorizeAdmin] [Area(AreaNames.Admin)] - public class FixedOrByWeightController : BasePluginController + public class FixedByWeightByTotalController : BasePluginController { #region Fields private readonly CurrencySettings _currencySettings; - private readonly FixedOrByWeightSettings _fixedOrByWeightSettings; + private readonly FixedByWeightByTotalSettings _fixedByWeightByTotalSettings; private readonly ICountryService _countryService; private readonly ICurrencyService _currencyService; private readonly ILocalizationService _localizationService; private readonly IMeasureService _measureService; private readonly IPermissionService _permissionService; private readonly ISettingService _settingService; - private readonly IShippingByWeightService _shippingByWeightService; + private readonly IShippingByWeightByTotalService _shippingByWeightService; private readonly IShippingService _shippingService; private readonly IStateProvinceService _stateProvinceService; private readonly IStoreService _storeService; @@ -45,22 +45,22 @@ public class FixedOrByWeightController : BasePluginController #region Ctor - public FixedOrByWeightController(CurrencySettings currencySettings, - FixedOrByWeightSettings fixedOrByWeightSettings, + public FixedByWeightByTotalController(CurrencySettings currencySettings, + FixedByWeightByTotalSettings fixedByWeightByTotalSettings, ICountryService countryService, ICurrencyService currencyService, ILocalizationService localizationService, IMeasureService measureService, IPermissionService permissionService, ISettingService settingService, - IShippingByWeightService shippingByWeightService, + IShippingByWeightByTotalService shippingByWeightService, IShippingService shippingService, IStateProvinceService stateProvinceService, IStoreService storeService, MeasureSettings measureSettings) { this._currencySettings = currencySettings; - this._fixedOrByWeightSettings = fixedOrByWeightSettings; + this._fixedByWeightByTotalSettings = fixedByWeightByTotalSettings; this._countryService = countryService; this._currencyService = currencyService; this._localizationService = localizationService; @@ -85,11 +85,11 @@ public IActionResult Configure() var model = new ConfigurationModel { - LimitMethodsToCreated = _fixedOrByWeightSettings.LimitMethodsToCreated, - ShippingByWeightEnabled = _fixedOrByWeightSettings.ShippingByWeightEnabled + LimitMethodsToCreated = _fixedByWeightByTotalSettings.LimitMethodsToCreated, + ShippingByWeightByTotalEnabled = _fixedByWeightByTotalSettings.ShippingByWeightByTotalEnabled }; - return View("~/Plugins/Shipping.FixedOrByWeight/Views/Configure.cshtml", model); + return View("~/Plugins/Shipping.FixedByWeightByTotal/Views/Configure.cshtml", model); } [HttpPost] @@ -100,8 +100,8 @@ public IActionResult Configure(ConfigurationModel model) return Content("Access denied"); //save settings - _fixedOrByWeightSettings.LimitMethodsToCreated = model.LimitMethodsToCreated; - _settingService.SaveSetting(_fixedOrByWeightSettings); + _fixedByWeightByTotalSettings.LimitMethodsToCreated = model.LimitMethodsToCreated; + _settingService.SaveSetting(_fixedByWeightByTotalSettings); return Json(new { Result = true }); } @@ -113,8 +113,8 @@ public IActionResult SaveMode(bool value) return Content("Access denied"); //save settings - _fixedOrByWeightSettings.ShippingByWeightEnabled = value; - _settingService.SaveSetting(_fixedOrByWeightSettings); + _fixedByWeightByTotalSettings.ShippingByWeightByTotalEnabled = value; + _settingService.SaveSetting(_fixedByWeightByTotalSettings); return Json(new { Result = true }); } @@ -131,7 +131,7 @@ public IActionResult FixedShippingRateList(DataSourceRequest command) { ShippingMethodId = shippingMethod.Id, ShippingMethodName = shippingMethod.Name, - Rate = _settingService.GetSettingByKey(string.Format(FixedOrByWeightDefaults.FixedRateSettingsKey, shippingMethod.Id)) + Rate = _settingService.GetSettingByKey(string.Format(FixedByWeightByTotalDefaults.FixedRateSettingsKey, shippingMethod.Id)) }).ToList(); var gridModel = new DataSourceResult @@ -150,7 +150,7 @@ public IActionResult UpdateFixedShippingRate(FixedRateModel model) if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings)) return Content("Access denied"); - _settingService.SetSetting(string.Format(FixedOrByWeightDefaults.FixedRateSettingsKey, model.ShippingMethodId), model.Rate); + _settingService.SetSetting(string.Format(FixedByWeightByTotalDefaults.FixedRateSettingsKey, model.ShippingMethodId), model.Rate); return new NullJsonResult(); } @@ -161,7 +161,7 @@ public IActionResult UpdateFixedShippingRate(FixedRateModel model) [HttpPost] [AdminAntiForgery] - public IActionResult RateByWeightList(DataSourceRequest command) + public IActionResult RateByWeightByTotalList(DataSourceRequest command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings)) return AccessDeniedKendoGridJson(); @@ -169,7 +169,7 @@ public IActionResult RateByWeightList(DataSourceRequest command) var records = _shippingByWeightService.GetAll(command.Page - 1, command.PageSize); var sbwModel = records.Select(record => { - var model = new ShippingByWeightModel + var model = new ShippingByWeightByTotalModel { Id = record.Id, StoreId = record.StoreId, @@ -182,8 +182,10 @@ public IActionResult RateByWeightList(DataSourceRequest command) CountryName = _countryService.GetCountryById(record.CountryId)?.Name ?? "*", StateProvinceId = record.StateProvinceId, StateProvinceName = _stateProvinceService.GetStateProvinceById(record.StateProvinceId)?.Name ?? "*", - From = record.From, - To = record.To, + WeightFrom = record.WeightFrom, + WeightTo = record.WeightTo, + OrderSubtotalFrom = record.OrderSubtotalFrom, + OrderSubtotalTo = record.OrderSubtotalTo, AdditionalFixedCost = record.AdditionalFixedCost, PercentageRateOfSubtotal = record.PercentageRateOfSubtotal, RatePerWeightUnit = record.RatePerWeightUnit, @@ -192,17 +194,21 @@ public IActionResult RateByWeightList(DataSourceRequest command) }; var htmlSb = new StringBuilder("
"); - htmlSb.AppendFormat("{0}: {1}", _localizationService.GetResource("Plugins.Shipping.FixedOrByWeight.Fields.From"), model.From); + htmlSb.AppendFormat("{0}: {1}", _localizationService.GetResource("Plugins.Shipping.FixedByWeightByTotal.Fields.WeightFrom"), model.WeightFrom); htmlSb.Append("
"); - htmlSb.AppendFormat("{0}: {1}", _localizationService.GetResource("Plugins.Shipping.FixedOrByWeight.Fields.To"), model.To); + htmlSb.AppendFormat("{0}: {1}", _localizationService.GetResource("Plugins.Shipping.FixedByWeightByTotal.Fields.WeightTo"), model.WeightTo); htmlSb.Append("
"); - htmlSb.AppendFormat("{0}: {1}", _localizationService.GetResource("Plugins.Shipping.FixedOrByWeight.Fields.AdditionalFixedCost"), model.AdditionalFixedCost); + htmlSb.AppendFormat("{0}: {1}", _localizationService.GetResource("Plugins.Shipping.FixedByWeightByTotal.Fields.OrderSubtotalFrom"), model.OrderSubtotalFrom); htmlSb.Append("
"); - htmlSb.AppendFormat("{0}: {1}", _localizationService.GetResource("Plugins.Shipping.FixedOrByWeight.Fields.RatePerWeightUnit"), model.RatePerWeightUnit); + htmlSb.AppendFormat("{0}: {1}", _localizationService.GetResource("Plugins.Shipping.FixedByWeightByTotal.Fields.OrderSubtotalTo"), model.OrderSubtotalTo); htmlSb.Append("
"); - htmlSb.AppendFormat("{0}: {1}", _localizationService.GetResource("Plugins.Shipping.FixedOrByWeight.Fields.LowerWeightLimit"), model.LowerWeightLimit); + htmlSb.AppendFormat("{0}: {1}", _localizationService.GetResource("Plugins.Shipping.FixedByWeightByTotal.Fields.AdditionalFixedCost"), model.AdditionalFixedCost); htmlSb.Append("
"); - htmlSb.AppendFormat("{0}: {1}", _localizationService.GetResource("Plugins.Shipping.FixedOrByWeight.Fields.PercentageRateOfSubtotal"), model.PercentageRateOfSubtotal); + htmlSb.AppendFormat("{0}: {1}", _localizationService.GetResource("Plugins.Shipping.FixedByWeightByTotal.Fields.RatePerWeightUnit"), model.RatePerWeightUnit); + htmlSb.Append("
"); + htmlSb.AppendFormat("{0}: {1}", _localizationService.GetResource("Plugins.Shipping.FixedByWeightByTotal.Fields.LowerWeightLimit"), model.LowerWeightLimit); + htmlSb.Append("
"); + htmlSb.AppendFormat("{0}: {1}", _localizationService.GetResource("Plugins.Shipping.FixedByWeightByTotal.Fields.PercentageRateOfSubtotal"), model.PercentageRateOfSubtotal); htmlSb.Append("
"); model.DataHtml = htmlSb.ToString(); @@ -219,16 +225,17 @@ public IActionResult RateByWeightList(DataSourceRequest command) return Json(gridModel); } - public IActionResult AddRateByWeighPopup() + public IActionResult AddRateByWeightByTotalPopup() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings)) return AccessDeniedView(); - var model = new ShippingByWeightModel + var model = new ShippingByWeightByTotalModel { PrimaryStoreCurrencyCode = _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId)?.CurrencyCode, BaseWeightIn = _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId)?.Name, - To = 1000000 + WeightTo = 1000000, + OrderSubtotalTo = 1000000 }; var shippingMethods = _shippingService.GetAllShippingMethods(); @@ -254,17 +261,17 @@ public IActionResult AddRateByWeighPopup() //states model.AvailableStates.Add(new SelectListItem { Text = "*", Value = "0" }); - return View("~/Plugins/Shipping.FixedOrByWeight/Views/AddRateByWeightPopup.cshtml", model); + return View("~/Plugins/Shipping.FixedByWeightByTotal/Views/AddRateByWeightByTotalPopup.cshtml", model); } [HttpPost] [AdminAntiForgery] - public IActionResult AddRateByWeighPopup(ShippingByWeightModel model) + public IActionResult AddRateByWeightByTotalPopup(ShippingByWeightByTotalModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings)) return AccessDeniedView(); - _shippingByWeightService.InsertShippingByWeightRecord(new ShippingByWeightRecord + _shippingByWeightService.InsertShippingByWeightRecord(new ShippingByWeightByTotalRecord { StoreId = model.StoreId, WarehouseId = model.WarehouseId, @@ -272,8 +279,10 @@ public IActionResult AddRateByWeighPopup(ShippingByWeightModel model) StateProvinceId = model.StateProvinceId, Zip = model.Zip == "*" ? null : model.Zip, ShippingMethodId = model.ShippingMethodId, - From = model.From, - To = model.To, + WeightFrom = model.WeightFrom, + WeightTo = model.WeightTo, + OrderSubtotalFrom = model.OrderSubtotalFrom, + OrderSubtotalTo = model.OrderSubtotalTo, AdditionalFixedCost = model.AdditionalFixedCost, RatePerWeightUnit = model.RatePerWeightUnit, PercentageRateOfSubtotal = model.PercentageRateOfSubtotal, @@ -282,10 +291,10 @@ public IActionResult AddRateByWeighPopup(ShippingByWeightModel model) ViewBag.RefreshPage = true; - return View("~/Plugins/Shipping.FixedOrByWeight/Views/AddRateByWeightPopup.cshtml", model); + return View("~/Plugins/Shipping.FixedByWeightByTotal/Views/AddRateByWeightByTotalPopup.cshtml", model); } - public IActionResult EditRateByWeighPopup(int id) + public IActionResult EditRateByWeightByTotalPopup(int id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings)) return AccessDeniedView(); @@ -295,7 +304,7 @@ public IActionResult EditRateByWeighPopup(int id) //no record found with the specified id return RedirectToAction("Configure"); - var model = new ShippingByWeightModel + var model = new ShippingByWeightByTotalModel { Id = sbw.Id, StoreId = sbw.StoreId, @@ -304,8 +313,10 @@ public IActionResult EditRateByWeighPopup(int id) StateProvinceId = sbw.StateProvinceId, Zip = sbw.Zip, ShippingMethodId = sbw.ShippingMethodId, - From = sbw.From, - To = sbw.To, + WeightFrom = sbw.WeightFrom, + WeightTo = sbw.WeightTo, + OrderSubtotalFrom = sbw.OrderSubtotalFrom, + OrderSubtotalTo = sbw.OrderSubtotalTo, AdditionalFixedCost = sbw.AdditionalFixedCost, PercentageRateOfSubtotal = sbw.PercentageRateOfSubtotal, RatePerWeightUnit = sbw.RatePerWeightUnit, @@ -345,12 +356,12 @@ public IActionResult EditRateByWeighPopup(int id) foreach (var s in states) model.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id.ToString(), Selected = (selectedState != null && s.Id == selectedState.Id) }); - return View("~/Plugins/Shipping.FixedOrByWeight/Views/EditRateByWeightPopup.cshtml", model); + return View("~/Plugins/Shipping.FixedByWeightByTotal/Views/EditRateByWeightByTotalPopup.cshtml", model); } [HttpPost] [AdminAntiForgery] - public IActionResult EditRateByWeighPopup(ShippingByWeightModel model) + public IActionResult EditRateByWeightByTotalPopup(ShippingByWeightByTotalModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings)) return AccessDeniedView(); @@ -366,8 +377,10 @@ public IActionResult EditRateByWeighPopup(ShippingByWeightModel model) sbw.StateProvinceId = model.StateProvinceId; sbw.Zip = model.Zip == "*" ? null : model.Zip; sbw.ShippingMethodId = model.ShippingMethodId; - sbw.From = model.From; - sbw.To = model.To; + sbw.WeightFrom = model.WeightFrom; + sbw.WeightTo = model.WeightTo; + sbw.OrderSubtotalFrom = model.OrderSubtotalFrom; + sbw.OrderSubtotalTo = model.OrderSubtotalTo; sbw.AdditionalFixedCost = model.AdditionalFixedCost; sbw.RatePerWeightUnit = model.RatePerWeightUnit; sbw.PercentageRateOfSubtotal = model.PercentageRateOfSubtotal; @@ -377,12 +390,12 @@ public IActionResult EditRateByWeighPopup(ShippingByWeightModel model) ViewBag.RefreshPage = true; - return View("~/Plugins/Shipping.FixedOrByWeight/Views/EditRateByWeightPopup.cshtml", model); + return View("~/Plugins/Shipping.FixedByWeightByTotal/Views/EditRateByWeightByTotalPopup.cshtml", model); } [HttpPost] [AdminAntiForgery] - public IActionResult DeleteRateByWeigh(int id) + public IActionResult DeleteRateByWeightByTotal(int id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings)) return Content("Access denied"); diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Data/EfStartUpTask.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Data/EfStartUpTask.cs similarity index 81% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Data/EfStartUpTask.cs rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Data/EfStartUpTask.cs index 9aa876865a5..4bcb77d6cde 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Data/EfStartUpTask.cs +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Data/EfStartUpTask.cs @@ -1,7 +1,7 @@ using System.Data.Entity; using Nop.Core.Infrastructure; -namespace Nop.Plugin.Shipping.FixedOrByWeight.Data +namespace Nop.Plugin.Shipping.FixedByWeightByTotal.Data { public class EfStartUpTask : IStartupTask { @@ -9,7 +9,7 @@ public void Execute() { //It's required to set initializer to null (for SQL Server Compact). //otherwise, you'll get something like "The model backing the 'your context name' context has changed since the database was created. Consider using Code First Migrations to update the database" - Database.SetInitializer(null); + Database.SetInitializer(null); } public int Order diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Data/ShippingByWeightObjectContext.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Data/ShippingByWeightByTotalObjectContext.cs similarity index 88% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Data/ShippingByWeightObjectContext.cs rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Data/ShippingByWeightByTotalObjectContext.cs index 3ba9e9cff36..8b8a051c56c 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Data/ShippingByWeightObjectContext.cs +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Data/ShippingByWeightByTotalObjectContext.cs @@ -4,18 +4,18 @@ using System.Data.Entity.Infrastructure; using Nop.Core; using Nop.Data; -using Nop.Plugin.Shipping.FixedOrByWeight.Domain; +using Nop.Plugin.Shipping.FixedByWeightByTotal.Domain; -namespace Nop.Plugin.Shipping.FixedOrByWeight.Data +namespace Nop.Plugin.Shipping.FixedByWeightByTotal.Data { /// /// Object context /// - public class ShippingByWeightObjectContext : DbContext, IDbContext + public class ShippingByWeightByTotalObjectContext : DbContext, IDbContext { #region Ctor - public ShippingByWeightObjectContext(string nameOrConnectionString) + public ShippingByWeightByTotalObjectContext(string nameOrConnectionString) : base(nameOrConnectionString) { //((IObjectContextAdapter) this).ObjectContext.ContextOptions.LazyLoadingEnabled = true; @@ -27,11 +27,11 @@ public ShippingByWeightObjectContext(string nameOrConnectionString) protected override void OnModelCreating(DbModelBuilder modelBuilder) { - modelBuilder.Configurations.Add(new ShippingByWeightRecordMap()); + modelBuilder.Configurations.Add(new ShippingByWeightByTotalRecordMap()); //disable EdmMetadata generation //modelBuilder.Conventions.Remove(); - base.OnModelCreating(modelBuilder); + base.OnModelCreating(modelBuilder); } #endregion @@ -65,7 +65,7 @@ public void Install() public void Uninstall() { //drop the table - var tableName = this.GetTableName(); + var tableName = this.GetTableName(); //var tableName = "ShippingByWeight"; this.DropPluginTable(tableName); } @@ -130,11 +130,11 @@ public virtual bool ProxyCreationEnabled { get { - return this.Configuration.ProxyCreationEnabled; + return Configuration.ProxyCreationEnabled; } set { - this.Configuration.ProxyCreationEnabled = value; + Configuration.ProxyCreationEnabled = value; } } @@ -145,11 +145,11 @@ public virtual bool AutoDetectChangesEnabled { get { - return this.Configuration.AutoDetectChangesEnabled; + return Configuration.AutoDetectChangesEnabled; } set { - this.Configuration.AutoDetectChangesEnabled = value; + Configuration.AutoDetectChangesEnabled = value; } } diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Data/ShippingByWeightByTotalRecordMap.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Data/ShippingByWeightByTotalRecordMap.cs new file mode 100644 index 00000000000..d55bf0a7fc2 --- /dev/null +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Data/ShippingByWeightByTotalRecordMap.cs @@ -0,0 +1,16 @@ +using Nop.Data.Mapping; +using Nop.Plugin.Shipping.FixedByWeightByTotal.Domain; + +namespace Nop.Plugin.Shipping.FixedByWeightByTotal.Data +{ + public partial class ShippingByWeightByTotalRecordMap : NopEntityTypeConfiguration + { + public ShippingByWeightByTotalRecordMap() + { + this.ToTable("ShippingByWeightByTotal"); + this.HasKey(x => x.Id); + + this.Property(x => x.Zip).HasMaxLength(400); + } + } +} \ No newline at end of file diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Domain/ShippingByWeightRecord.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Domain/ShippingByWeightByTotalRecord.cs similarity index 72% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Domain/ShippingByWeightRecord.cs rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Domain/ShippingByWeightByTotalRecord.cs index fb9a7c908b8..caafddc794b 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Domain/ShippingByWeightRecord.cs +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Domain/ShippingByWeightByTotalRecord.cs @@ -1,11 +1,11 @@ using Nop.Core; -namespace Nop.Plugin.Shipping.FixedOrByWeight.Domain +namespace Nop.Plugin.Shipping.FixedByWeightByTotal.Domain { /// /// Represents a shipping by weight record /// - public partial class ShippingByWeightRecord : BaseEntity + public partial class ShippingByWeightByTotalRecord : BaseEntity { /// /// Gets or sets the store identifier @@ -38,14 +38,24 @@ public partial class ShippingByWeightRecord : BaseEntity public int ShippingMethodId { get; set; } /// - /// Gets or sets the "from" value + /// Gets or sets the "Weight from" value /// - public decimal From { get; set; } + public decimal WeightFrom { get; set; } /// - /// Gets or sets the "to" value + /// Gets or sets the "Weight to" value /// - public decimal To { get; set; } + public decimal WeightTo { get; set; } + + /// + /// Gets or sets the "Order subtotal from" value + /// + public decimal OrderSubtotalFrom { get; set; } + + /// + /// Gets or sets the "Order subtotal to" value + /// + public decimal OrderSubtotalTo { get; set; } /// /// Gets or sets the additional fixed cost diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/FixedOrByWeightComputationMethod.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/FixedByWeightByTotalComputationMethod.cs similarity index 63% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/FixedOrByWeightComputationMethod.cs rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/FixedByWeightByTotalComputationMethod.cs index 80c7c018b5d..6b2a4cedbb2 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/FixedOrByWeightComputationMethod.cs +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/FixedByWeightByTotalComputationMethod.cs @@ -3,8 +3,8 @@ using Nop.Core; using Nop.Core.Domain.Shipping; using Nop.Core.Plugins; -using Nop.Plugin.Shipping.FixedOrByWeight.Data; -using Nop.Plugin.Shipping.FixedOrByWeight.Services; +using Nop.Plugin.Shipping.FixedByWeightByTotal.Data; +using Nop.Plugin.Shipping.FixedByWeightByTotal.Services; using Nop.Services.Catalog; using Nop.Services.Configuration; using Nop.Services.Localization; @@ -12,47 +12,47 @@ using Nop.Services.Shipping; using Nop.Services.Shipping.Tracking; -namespace Nop.Plugin.Shipping.FixedOrByWeight +namespace Nop.Plugin.Shipping.FixedByWeightByTotal { /// /// Fixed rate or by weight shipping computation method /// - public class FixedOrByWeightComputationMethod : BasePlugin, IShippingRateComputationMethod + public class FixedByWeightByTotalComputationMethod : BasePlugin, IShippingRateComputationMethod { #region Fields - private readonly FixedOrByWeightSettings _fixedOrByWeightSettings; + private readonly FixedByWeightByTotalSettings _fixedByWeightByTotalSettings; private readonly IPriceCalculationService _priceCalculationService; private readonly IProductAttributeParser _productAttributeParser; private readonly IProductService _productService; private readonly ISettingService _settingService; - private readonly IShippingByWeightService _shippingByWeightService; + private readonly IShippingByWeightByTotalService _shippingByWeightByTotalService; private readonly IShippingService _shippingService; private readonly IStoreContext _storeContext; private readonly IWebHelper _webHelper; - private readonly ShippingByWeightObjectContext _objectContext; + private readonly ShippingByWeightByTotalObjectContext _objectContext; #endregion #region Ctor - public FixedOrByWeightComputationMethod(FixedOrByWeightSettings fixedOrByWeightSettings, + public FixedByWeightByTotalComputationMethod(FixedByWeightByTotalSettings fixedByWeightByTotalSettings, IPriceCalculationService priceCalculationService, IProductAttributeParser productAttributeParser, IProductService productService, ISettingService settingService, - IShippingByWeightService shippingByWeightService, + IShippingByWeightByTotalService shippingByWeightByTotalService, IShippingService shippingService, IStoreContext storeContext, IWebHelper webHelper, - ShippingByWeightObjectContext objectContext) + ShippingByWeightByTotalObjectContext objectContext) { - this._fixedOrByWeightSettings = fixedOrByWeightSettings; + this._fixedByWeightByTotalSettings = fixedByWeightByTotalSettings; this._priceCalculationService = priceCalculationService; this._productAttributeParser = productAttributeParser; this._productService = productService; this._settingService = settingService; - this._shippingByWeightService = shippingByWeightService; + this._shippingByWeightByTotalService = shippingByWeightByTotalService; this._shippingService = shippingService; this._storeContext = storeContext; this._webHelper = webHelper; @@ -70,11 +70,11 @@ public class FixedOrByWeightComputationMethod : BasePlugin, IShippingRateComputa /// Rate private decimal GetRate(int shippingMethodId) { - return _settingService.GetSettingByKey(string.Format(FixedOrByWeightDefaults.FixedRateSettingsKey, shippingMethodId)); + return _settingService.GetSettingByKey(string.Format(FixedByWeightByTotalDefaults.FixedRateSettingsKey, shippingMethodId)); } /// - /// Get rate by weight + /// Get rate by weight and by total /// /// Subtotal /// Weight @@ -88,29 +88,29 @@ private decimal GetRate(int shippingMethodId) private decimal? GetRate(decimal subTotal, decimal weight, int shippingMethodId, int storeId, int warehouseId, int countryId, int stateProvinceId, string zip) { - var shippingByWeightRecord = _shippingByWeightService.FindRecord(shippingMethodId, storeId, warehouseId, countryId, stateProvinceId, zip, weight); - if (shippingByWeightRecord == null) + var shippingByWeightByTotalRecord = _shippingByWeightByTotalService.FindRecord(shippingMethodId, storeId, warehouseId, countryId, stateProvinceId, zip, weight, subTotal); + if (shippingByWeightByTotalRecord == null) { - if (_fixedOrByWeightSettings.LimitMethodsToCreated) + if (_fixedByWeightByTotalSettings.LimitMethodsToCreated) return null; return decimal.Zero; } //additional fixed cost - var shippingTotal = shippingByWeightRecord.AdditionalFixedCost; + var shippingTotal = shippingByWeightByTotalRecord.AdditionalFixedCost; //charge amount per weight unit - if (shippingByWeightRecord.RatePerWeightUnit > decimal.Zero) + if (shippingByWeightByTotalRecord.RatePerWeightUnit > decimal.Zero) { - var weightRate = Math.Max(weight - shippingByWeightRecord.LowerWeightLimit, decimal.Zero); - shippingTotal += shippingByWeightRecord.RatePerWeightUnit * weightRate; + var weightRate = Math.Max(weight - shippingByWeightByTotalRecord.LowerWeightLimit, decimal.Zero); + shippingTotal += shippingByWeightByTotalRecord.RatePerWeightUnit * weightRate; } //percentage rate of subtotal - if (shippingByWeightRecord.PercentageRateOfSubtotal > decimal.Zero) + if (shippingByWeightByTotalRecord.PercentageRateOfSubtotal > decimal.Zero) { - shippingTotal += Math.Round((decimal)((((float)subTotal) * ((float)shippingByWeightRecord.PercentageRateOfSubtotal)) / 100f), 2); + shippingTotal += Math.Round((decimal)((((float)subTotal) * ((float)shippingByWeightByTotalRecord.PercentageRateOfSubtotal)) / 100f), 2); } return Math.Max(shippingTotal, decimal.Zero); @@ -139,7 +139,7 @@ public GetShippingOptionResponse GetShippingOptions(GetShippingOptionRequest get } //choose the shipping rate calculation method - if (_fixedOrByWeightSettings.ShippingByWeightEnabled) + if (_fixedByWeightByTotalSettings.ShippingByWeightByTotalEnabled) { //shipping rate calculation by products weight @@ -209,7 +209,7 @@ public GetShippingOptionResponse GetShippingOptions(GetShippingOptionRequest get throw new ArgumentNullException(nameof(getShippingOptionRequest)); //if the "shipping calculation by weight" method is selected, the fixed rate isn't calculated - if (_fixedOrByWeightSettings.ShippingByWeightEnabled) + if (_fixedByWeightByTotalSettings.ShippingByWeightByTotalEnabled) return null; var restrictByCountryId = getShippingOptionRequest.ShippingAddress?.Country?.Id; @@ -228,7 +228,7 @@ public GetShippingOptionResponse GetShippingOptions(GetShippingOptionRequest get /// public override string GetConfigurationPageUrl() { - return $"{_webHelper.GetStoreLocation()}Admin/FixedOrByWeight/Configure"; + return $"{_webHelper.GetStoreLocation()}Admin/FixedByWeightByTotal/Configure"; } /// @@ -237,60 +237,65 @@ public override string GetConfigurationPageUrl() public override void Install() { //settings - _settingService.SaveSetting(new FixedOrByWeightSettings()); + _settingService.SaveSetting(new FixedByWeightByTotalSettings()); //database objects _objectContext.Install(); //locales - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.ShippingByWeight", "By Weight"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fixed", "Fixed Rate"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Rate", "Rate"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Store", "Store"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Store.Hint", "If an asterisk is selected, then this shipping rate will apply to all stores."); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Warehouse", "Warehouse"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Warehouse.Hint", "If an asterisk is selected, then this shipping rate will apply to all warehouses."); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Country", "Country"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Country.Hint", "If an asterisk is selected, then this shipping rate will apply to all customers, regardless of the country."); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.StateProvince", "State / province"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.StateProvince.Hint", "If an asterisk is selected, then this shipping rate will apply to all customers from the given country, regardless of the state."); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Zip", "Zip"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Zip.Hint", "Zip / postal code. If zip is empty, then this shipping rate will apply to all customers from the given country or state, regardless of the zip code."); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.ShippingMethod", "Shipping method"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.ShippingMethod.Hint", "Choose shipping method"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.From", "Order weight from"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.From.Hint", "Order weight from."); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.To", "Order weight to"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.To.Hint", "Order weight to."); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.AdditionalFixedCost", "Additional fixed cost"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.AdditionalFixedCost.Hint", "Specify an additional fixed cost per shopping cart for this option. Set to 0 if you don't want an additional fixed cost to be applied."); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.LowerWeightLimit", "Lower weight limit"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.LowerWeightLimit.Hint", "Lower weight limit. This field can be used for \"per extra weight unit\" scenarios."); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.PercentageRateOfSubtotal", "Charge percentage (of subtotal)"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.PercentageRateOfSubtotal.Hint", "Charge percentage (of subtotal)."); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.RatePerWeightUnit", "Rate per weight unit"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.RatePerWeightUnit.Hint", "Rate per weight unit."); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.LimitMethodsToCreated", "Limit shipping methods to configured ones"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.LimitMethodsToCreated.Hint", "If you check this option, then your customers will be limited to shipping options configured here. Otherwise, they'll be able to choose any existing shipping options even they've not configured here (zero shipping fee in this case)."); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.DataHtml", "Data"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.AddRecord", "Add record"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Formula", "Formula to calculate rates"); - this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Formula.Value", "[additional fixed cost] + ([order total weight] - [lower weight limit]) * [rate per weight unit] + [order subtotal] * [charge percentage]"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.AddRecord", "Add record"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.AdditionalFixedCost", "Additional fixed cost"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.AdditionalFixedCost.Hint", "Specify an additional fixed cost per shopping cart for this option. Set to 0 if you don't want an additional fixed cost to be applied."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Country", "Country"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Country.Hint", "If an asterisk is selected, then this shipping rate will apply to all customers, regardless of the country."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.DataHtml", "Data"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.LimitMethodsToCreated", "Limit shipping methods to configured ones"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.LimitMethodsToCreated.Hint", "If you check this option, then your customers will be limited to shipping options configured here. Otherwise, they'll be able to choose any existing shipping options even they are not configured here (zero shipping fee in this case)."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.LowerWeightLimit", "Lower weight limit"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.LowerWeightLimit.Hint", "Lower weight limit. This field can be used for \"per extra weight unit\" scenarios."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.OrderSubtotalFrom", "Order subtotal from"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.OrderSubtotalFrom.Hint", "Order subtotal from."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.OrderSubtotalTo", "Order subtotal to"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.OrderSubtotalTo.Hint", "Order subtotal to."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.PercentageRateOfSubtotal", "Charge percentage (of subtotal)"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.PercentageRateOfSubtotal.Hint", "Charge percentage (of subtotal)."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Rate", "Rate"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.RatePerWeightUnit", "Rate per weight unit"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.RatePerWeightUnit.Hint", "Rate per weight unit."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.ShippingMethod", "Shipping method"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.ShippingMethod.Hint", "Choose shipping method."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.StateProvince", "State / province"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.StateProvince.Hint", "If an asterisk is selected, then this shipping rate will apply to all customers from the given country, regardless of the state."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Store", "Store"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Store.Hint", "If an asterisk is selected, then this shipping rate will apply to all stores."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Warehouse", "Warehouse"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Warehouse.Hint", "If an asterisk is selected, then this shipping rate will apply to all warehouses."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.WeightFrom", "Order weight from"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.WeightFrom.Hint", "Order weight from."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.WeightTo", "Order weight to"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.WeightTo.Hint", "Order weight to."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Zip", "Zip"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Zip.Hint", "Zip / postal code. If zip is empty, then this shipping rate will apply to all customers from the given country or state, regardless of the zip code."); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fixed", "Fixed Rate"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Formula", "Formula to calculate rates"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Formula.Value", "[additional fixed cost] + ([order total weight] - [lower weight limit]) * [rate per weight unit] + [order subtotal] * [charge percentage]"); + this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.ShippingByWeight", "By Weight"); base.Install(); } - + /// /// Uninstall plugin /// public override void Uninstall() { //settings - _settingService.DeleteSetting(); + _settingService.DeleteSetting(); //fixed rates var fixedRates = _shippingService.GetAllShippingMethods() - .Select(shippingMethod => _settingService.GetSetting(string.Format(FixedOrByWeightDefaults.FixedRateSettingsKey, shippingMethod.Id))) + .Select(shippingMethod => _settingService.GetSetting( + string.Format(FixedByWeightByTotalDefaults.FixedRateSettingsKey, shippingMethod.Id))) .Where(setting => setting != null).ToList(); _settingService.DeleteSettings(fixedRates); @@ -298,37 +303,43 @@ public override void Uninstall() _objectContext.Uninstall(); //locales - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Rate"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Store"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Store.Hint"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Warehouse"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Warehouse.Hint"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Country"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Country.Hint"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.StateProvince"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.StateProvince.Hint"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Zip"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Zip.Hint"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.ShippingMethod"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.ShippingMethod.Hint"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.From"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.From.Hint"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.To"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.To.Hint"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.AdditionalFixedCost"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.AdditionalFixedCost.Hint"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.LowerWeightLimit"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.LowerWeightLimit.Hint"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.PercentageRateOfSubtotal"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.PercentageRateOfSubtotal.Hint"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.RatePerWeightUnit"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.RatePerWeightUnit.Hint"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.LimitMethodsToCreated"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.LimitMethodsToCreated.Hint"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.DataHtml"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.AddRecord"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Formula"); - this.DeletePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Formula.Value"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.AddRecord"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.AdditionalFixedCost"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.AdditionalFixedCost.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Country"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Country.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.DataHtml"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.LimitMethodsToCreated"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.LimitMethodsToCreated.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.LowerWeightLimit"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.LowerWeightLimit.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.OrderSubtotalFrom"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.OrderSubtotalFrom.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.OrderSubtotalTo"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.OrderSubtotalTo.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.PercentageRateOfSubtotal"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.PercentageRateOfSubtotal.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Rate"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.RatePerWeightUnit"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.RatePerWeightUnit.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.ShippingMethod"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.ShippingMethod.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.StateProvince"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.StateProvince.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Store"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Store.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Warehouse"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Warehouse.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.WeightFrom"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.WeightFrom.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.WeightTo"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.WeightTo.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Zip"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fields.Zip.Hint"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Fixed"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Formula"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.Formula.Value"); + this.DeletePluginLocaleResource("Plugins.Shipping.FixedByWeightByTotal.ShippingByWeight"); base.Uninstall(); } diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/FixedOrByWeightDefaults.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/FixedByWeightByTotalDefaults.cs similarity index 65% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/FixedOrByWeightDefaults.cs rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/FixedByWeightByTotalDefaults.cs index 7c774fe912c..3543aac0430 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/FixedOrByWeightDefaults.cs +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/FixedByWeightByTotalDefaults.cs @@ -1,14 +1,14 @@  -namespace Nop.Plugin.Shipping.FixedOrByWeight +namespace Nop.Plugin.Shipping.FixedByWeightByTotal { /// /// Represents constants of the "Fixed or by weight" shipping plugin /// - public static class FixedOrByWeightDefaults + public static class FixedByWeightByTotalDefaults { /// /// The key of the settings to save fixed rate of the shipping method /// - public const string FixedRateSettingsKey = "ShippingRateComputationMethod.FixedOrByWeight.Rate.ShippingMethodId{0}"; + public const string FixedRateSettingsKey = "ShippingRateComputationMethod.FixedByWeightByTotal.Rate.ShippingMethodId{0}"; } } diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/FixedOrByWeightSettings.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/FixedByWeightByTotalSettings.cs similarity index 66% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/FixedOrByWeightSettings.cs rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/FixedByWeightByTotalSettings.cs index 5f2b64195e9..b711bc84d14 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/FixedOrByWeightSettings.cs +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/FixedByWeightByTotalSettings.cs @@ -1,11 +1,11 @@ using Nop.Core.Configuration; -namespace Nop.Plugin.Shipping.FixedOrByWeight +namespace Nop.Plugin.Shipping.FixedByWeightByTotal { /// /// Represents settings of the "Fixed or by weight" shipping plugin /// - public class FixedOrByWeightSettings : ISettings + public class FixedByWeightByTotalSettings : ISettings { /// /// Gets or sets a value indicating whether to limit shipping methods to configured ones @@ -13,8 +13,8 @@ public class FixedOrByWeightSettings : ISettings public bool LimitMethodsToCreated { get; set; } /// - /// Gets or sets a value indicating whether the "shipping calculation by weight" method is selected + /// Gets or sets a value indicating whether the "shipping calculation by weight and by total" method is selected /// - public bool ShippingByWeightEnabled { get; set; } + public bool ShippingByWeightByTotalEnabled { get; set; } } } \ No newline at end of file diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Infrastructure/Cache/FixedOrByWeightEventConsumer.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Infrastructure/Cache/FixedByWeightByTotalEventConsumer.cs similarity index 76% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Infrastructure/Cache/FixedOrByWeightEventConsumer.cs rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Infrastructure/Cache/FixedByWeightByTotalEventConsumer.cs index bf70f148f29..50d6cd418d3 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Infrastructure/Cache/FixedOrByWeightEventConsumer.cs +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Infrastructure/Cache/FixedByWeightByTotalEventConsumer.cs @@ -3,12 +3,12 @@ using Nop.Services.Configuration; using Nop.Services.Events; -namespace Nop.Plugin.Shipping.FixedOrByWeight.Infrastructure.Cache +namespace Nop.Plugin.Shipping.FixedByWeightByTotal.Infrastructure.Cache { /// /// Event consumer of the "Fixed or by weight" shipping plugin (used for removing unused settings) /// - public partial class FixedOrByWeightEventConsumer : IConsumer> + public partial class FixedByWeightByTotalEventConsumer : IConsumer> { #region Fields @@ -18,7 +18,7 @@ public partial class FixedOrByWeightEventConsumer : IConsumer eventMessage) return; //delete saved fixed rate if exists - var setting = _settingService.GetSetting(string.Format(FixedOrByWeightDefaults.FixedRateSettingsKey, shippingMethod.Id)); + var setting = _settingService.GetSetting(string.Format(FixedByWeightByTotalDefaults.FixedRateSettingsKey, shippingMethod.Id)); if (setting != null) _settingService.DeleteSetting(setting); } diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Infrastructure/DependencyRegistrar.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Infrastructure/DependencyRegistrar.cs similarity index 61% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Infrastructure/DependencyRegistrar.cs rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Infrastructure/DependencyRegistrar.cs index 9e2464e0512..e0c47ac3621 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Infrastructure/DependencyRegistrar.cs +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Infrastructure/DependencyRegistrar.cs @@ -5,12 +5,12 @@ using Nop.Core.Infrastructure; using Nop.Core.Infrastructure.DependencyManagement; using Nop.Data; -using Nop.Plugin.Shipping.FixedOrByWeight.Data; -using Nop.Plugin.Shipping.FixedOrByWeight.Domain; -using Nop.Plugin.Shipping.FixedOrByWeight.Services; +using Nop.Plugin.Shipping.FixedByWeightByTotal.Data; +using Nop.Plugin.Shipping.FixedByWeightByTotal.Domain; +using Nop.Plugin.Shipping.FixedByWeightByTotal.Services; using Nop.Web.Framework.Infrastructure; -namespace Nop.Plugin.Shipping.FixedOrByWeight.Infrastructure +namespace Nop.Plugin.Shipping.FixedByWeightByTotal.Infrastructure { /// /// Dependency registrar @@ -25,15 +25,15 @@ public class DependencyRegistrar : IDependencyRegistrar /// Config public virtual void Register(ContainerBuilder builder, ITypeFinder typeFinder, NopConfig config) { - builder.RegisterType().As().InstancePerLifetimeScope(); + builder.RegisterType().As().InstancePerLifetimeScope(); //data context - this.RegisterPluginDataContext(builder, "nop_object_context_shipping_weight_zip"); + this.RegisterPluginDataContext(builder, "nop_object_context_shipping_weight_total_zip"); //override required repository with our custom context - builder.RegisterType>() - .As>() - .WithParameter(ResolvedParameter.ForNamed("nop_object_context_shipping_weight_zip")) + builder.RegisterType>() + .As>() + .WithParameter(ResolvedParameter.ForNamed("nop_object_context_shipping_weight_total_zip")) .InstancePerLifetimeScope(); } diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Models/ConfigurationModel.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Models/ConfigurationModel.cs new file mode 100644 index 00000000000..7ec11fd6ac4 --- /dev/null +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Models/ConfigurationModel.cs @@ -0,0 +1,13 @@ +using Nop.Web.Framework.Mvc.ModelBinding; +using Nop.Web.Framework.Mvc.Models; + +namespace Nop.Plugin.Shipping.FixedByWeightByTotal.Models +{ + public class ConfigurationModel : BaseNopModel + { + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.LimitMethodsToCreated")] + public bool LimitMethodsToCreated { get; set; } + + public bool ShippingByWeightByTotalEnabled { get; set; } + } +} \ No newline at end of file diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Models/FixedRateModel.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Models/FixedRateModel.cs similarity index 54% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Models/FixedRateModel.cs rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Models/FixedRateModel.cs index 4a76dd41735..825641dcbba 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Models/FixedRateModel.cs +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Models/FixedRateModel.cs @@ -1,16 +1,16 @@ using Nop.Web.Framework.Mvc.ModelBinding; using Nop.Web.Framework.Mvc.Models; -namespace Nop.Plugin.Shipping.FixedOrByWeight.Models +namespace Nop.Plugin.Shipping.FixedByWeightByTotal.Models { public class FixedRateModel : BaseNopModel { public int ShippingMethodId { get; set; } - [NopResourceDisplayName("Plugins.Shipping.FixedOrByWeight.Fields.ShippingMethod")] + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.ShippingMethod")] public string ShippingMethodName { get; set; } - [NopResourceDisplayName("Plugins.Shipping.FixedOrByWeight.Fields.Rate")] + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.Rate")] public decimal Rate { get; set; } } } \ No newline at end of file diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Models/ShippingByWeightByTotalModel.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Models/ShippingByWeightByTotalModel.cs new file mode 100644 index 00000000000..c193fd34fc7 --- /dev/null +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Models/ShippingByWeightByTotalModel.cs @@ -0,0 +1,83 @@ +using System.Collections.Generic; +using Microsoft.AspNetCore.Mvc.Rendering; +using Nop.Web.Framework.Mvc.ModelBinding; +using Nop.Web.Framework.Mvc.Models; + +namespace Nop.Plugin.Shipping.FixedByWeightByTotal.Models +{ + public class ShippingByWeightByTotalModel : BaseNopEntityModel + { + public ShippingByWeightByTotalModel() + { + AvailableCountries = new List(); + AvailableStates = new List(); + AvailableShippingMethods = new List(); + AvailableStores = new List(); + AvailableWarehouses = new List(); + } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.Store")] + public int StoreId { get; set; } + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.Store")] + public string StoreName { get; set; } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.Warehouse")] + public int WarehouseId { get; set; } + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.Warehouse")] + public string WarehouseName { get; set; } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.Country")] + public int CountryId { get; set; } + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.Country")] + public string CountryName { get; set; } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.StateProvince")] + public int StateProvinceId { get; set; } + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.StateProvince")] + public string StateProvinceName { get; set; } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.Zip")] + public string Zip { get; set; } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.ShippingMethod")] + public int ShippingMethodId { get; set; } + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.ShippingMethod")] + public string ShippingMethodName { get; set; } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.WeightFrom")] + public decimal WeightFrom { get; set; } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.WeightTo")] + public decimal WeightTo { get; set; } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.OrderSubtotalFrom")] + public decimal OrderSubtotalFrom { get; set; } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.OrderSubtotalTo")] + public decimal OrderSubtotalTo { get; set; } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.AdditionalFixedCost")] + public decimal AdditionalFixedCost { get; set; } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.PercentageRateOfSubtotal")] + public decimal PercentageRateOfSubtotal { get; set; } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.RatePerWeightUnit")] + public decimal RatePerWeightUnit { get; set; } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.LowerWeightLimit")] + public decimal LowerWeightLimit { get; set; } + + [NopResourceDisplayName("Plugins.Shipping.FixedByWeightByTotal.Fields.DataHtml")] + public string DataHtml { get; set; } + + public string PrimaryStoreCurrencyCode { get; set; } + public string BaseWeightIn { get; set; } + + public IList AvailableCountries { get; set; } + public IList AvailableStates { get; set; } + public IList AvailableShippingMethods { get; set; } + public IList AvailableStores { get; set; } + public IList AvailableWarehouses { get; set; } + } +} \ No newline at end of file diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Nop.Plugin.Shipping.FixedOrByWeight.csproj b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Nop.Plugin.Shipping.FixedByWeightByTotal.csproj similarity index 81% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Nop.Plugin.Shipping.FixedOrByWeight.csproj rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Nop.Plugin.Shipping.FixedByWeightByTotal.csproj index 1893a80f45c..8943c4e4369 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Nop.Plugin.Shipping.FixedOrByWeight.csproj +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Nop.Plugin.Shipping.FixedByWeightByTotal.csproj @@ -14,22 +14,22 @@ - + - - - + + + - ..\..\Presentation\Nop.Web\Plugins\Shipping.FixedOrByWeight + ..\..\Presentation\Nop.Web\Plugins\Shipping.FixedByWeightByTotal $(OutputPath) - ..\..\Presentation\Nop.Web\Plugins\Shipping.FixedOrByWeight + ..\..\Presentation\Nop.Web\Plugins\Shipping.FixedByWeightByTotal $(OutputPath) @@ -40,19 +40,19 @@ PreserveNewest - + PreserveNewest PreserveNewest - + PreserveNewest - + PreserveNewest - + PreserveNewest diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Notes.txt b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Notes.txt similarity index 100% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Notes.txt rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Notes.txt diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Services/IShippingByWeightService.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Services/IShippingByWeightByTotalService.cs similarity index 68% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Services/IShippingByWeightService.cs rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Services/IShippingByWeightByTotalService.cs index ce3bc38e6e1..1210c437d02 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Services/IShippingByWeightService.cs +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Services/IShippingByWeightByTotalService.cs @@ -1,12 +1,12 @@ using Nop.Core; -using Nop.Plugin.Shipping.FixedOrByWeight.Domain; +using Nop.Plugin.Shipping.FixedByWeightByTotal.Domain; -namespace Nop.Plugin.Shipping.FixedOrByWeight.Services +namespace Nop.Plugin.Shipping.FixedByWeightByTotal.Services { /// /// Represents service shipping by weight service /// - public partial interface IShippingByWeightService + public partial interface IShippingByWeightByTotalService { /// /// Get all shipping by weight records @@ -14,7 +14,7 @@ public partial interface IShippingByWeightService /// Page index /// Page size /// List of the shipping by weight record - IPagedList GetAll(int pageIndex = 0, int pageSize = int.MaxValue); + IPagedList GetAll(int pageIndex = 0, int pageSize = int.MaxValue); /// /// Get a shipping by weight record by passed parameters @@ -26,33 +26,34 @@ public partial interface IShippingByWeightService /// State identifier /// Zip postal code /// Weight + /// Order subtotal /// Shipping by weight record - ShippingByWeightRecord FindRecord(int shippingMethodId, int storeId, int warehouseId, - int countryId, int stateProvinceId, string zip, decimal weight); + ShippingByWeightByTotalRecord FindRecord(int shippingMethodId, int storeId, int warehouseId, + int countryId, int stateProvinceId, string zip, decimal weight, decimal orderSubtotal); /// /// Get a shipping by weight record by identifier /// /// Record identifier /// Shipping by weight record - ShippingByWeightRecord GetById(int shippingByWeightRecordId); + ShippingByWeightByTotalRecord GetById(int shippingByWeightRecordId); /// /// Insert the shipping by weight record /// /// Shipping by weight record - void InsertShippingByWeightRecord(ShippingByWeightRecord shippingByWeightRecord); + void InsertShippingByWeightRecord(ShippingByWeightByTotalRecord shippingByWeightRecord); /// /// Update the shipping by weight record /// /// Shipping by weight record - void UpdateShippingByWeightRecord(ShippingByWeightRecord shippingByWeightRecord); + void UpdateShippingByWeightRecord(ShippingByWeightByTotalRecord shippingByWeightRecord); /// /// Delete the shipping by weight record /// /// Shipping by weight record - void DeleteShippingByWeightRecord(ShippingByWeightRecord shippingByWeightRecord); + void DeleteShippingByWeightRecord(ShippingByWeightByTotalRecord shippingByWeightRecord); } } diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Services/ShippingByWeightService.cs b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Services/ShippingByWeightByTotalService.cs similarity index 67% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Services/ShippingByWeightService.cs rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Services/ShippingByWeightByTotalService.cs index 7401c31af0c..2b587948d52 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Services/ShippingByWeightService.cs +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Services/ShippingByWeightByTotalService.cs @@ -3,14 +3,14 @@ using Nop.Core; using Nop.Core.Caching; using Nop.Core.Data; -using Nop.Plugin.Shipping.FixedOrByWeight.Domain; +using Nop.Plugin.Shipping.FixedByWeightByTotal.Domain; -namespace Nop.Plugin.Shipping.FixedOrByWeight.Services +namespace Nop.Plugin.Shipping.FixedByWeightByTotal.Services { /// /// Represents service shipping by weight service implementation /// - public partial class ShippingByWeightService : IShippingByWeightService + public partial class ShippingByWeightByTotalService : IShippingByWeightByTotalService { #region Constants @@ -21,24 +21,24 @@ public partial class ShippingByWeightService : IShippingByWeightService /// {0} : page index /// {1} : page size /// - private const string SHIPPINGBYWEIGHT_ALL_KEY = "Nop.shippingbyweight.all-{0}-{1}"; - private const string SHIPPINGBYWEIGHT_PATTERN_KEY = "Nop.shippingbyweight."; + private const string SHIPPINGBYWEIGHTBYTOTAL_ALL_KEY = "Nop.shippingbyweightbytotal.all-{0}-{1}"; + private const string SHIPPINGBYWEIGHTBYTOTAL_PATTERN_KEY = "Nop.shippingbyweightbytotal."; #endregion #region Fields private readonly ICacheManager _cacheManager; - private readonly IRepository _sbwRepository; + private readonly IRepository _sbwtRepository; #endregion #region Ctor - public ShippingByWeightService(IRepository sbwRepository, + public ShippingByWeightByTotalService(IRepository sbwtRepository, ICacheManager cacheManager) { - this._sbwRepository = sbwRepository; + this._sbwtRepository = sbwtRepository; this._cacheManager = cacheManager; } @@ -52,16 +52,16 @@ public partial class ShippingByWeightService : IShippingByWeightService /// Page index /// Page size /// List of the shipping by weight record - public virtual IPagedList GetAll(int pageIndex = 0, int pageSize = int.MaxValue) + public virtual IPagedList GetAll(int pageIndex = 0, int pageSize = int.MaxValue) { - var key = string.Format(SHIPPINGBYWEIGHT_ALL_KEY, pageIndex, pageSize); + var key = string.Format(SHIPPINGBYWEIGHTBYTOTAL_ALL_KEY, pageIndex, pageSize); return _cacheManager.Get(key, () => { - var query = from sbw in _sbwRepository.Table - orderby sbw.StoreId, sbw.CountryId, sbw.StateProvinceId, sbw.Zip, sbw.ShippingMethodId, sbw.From + var query = from sbw in _sbwtRepository.Table + orderby sbw.StoreId, sbw.CountryId, sbw.StateProvinceId, sbw.Zip, sbw.ShippingMethodId, sbw.WeightFrom, sbw.OrderSubtotalFrom select sbw; - var records = new PagedList(query, pageIndex, pageSize); + var records = new PagedList(query, pageIndex, pageSize); return records; }); } @@ -76,21 +76,26 @@ public virtual IPagedList GetAll(int pageIndex = 0, int /// State identifier /// Zip postal code /// Weight + /// Order subtotal /// Shipping by weight record - public virtual ShippingByWeightRecord FindRecord(int shippingMethodId, int storeId, int warehouseId, - int countryId, int stateProvinceId, string zip, decimal weight) + public virtual ShippingByWeightByTotalRecord FindRecord(int shippingMethodId, int storeId, int warehouseId, + int countryId, int stateProvinceId, string zip, decimal weight, decimal orderSubtotal) { zip = zip?.Trim() ?? string.Empty; //filter by weight and shipping method var existingRates = GetAll() - .Where(sbw => sbw.ShippingMethodId == shippingMethodId && weight >= sbw.From && weight <= sbw.To) + .Where(sbw => sbw.ShippingMethodId == shippingMethodId && weight >= sbw.WeightFrom && weight <= sbw.WeightTo) .ToList(); + //filter by order subtotal + var matchedBySubtotal = + existingRates.Where(sbw => orderSubtotal >= sbw.OrderSubtotalFrom && orderSubtotal <= sbw.OrderSubtotalTo); + //filter by store var matchedByStore = storeId == 0 - ? existingRates - : existingRates.Where(r => r.StoreId == storeId || r.StoreId == 0); + ? matchedBySubtotal + : matchedBySubtotal.Where(r => r.StoreId == storeId || r.StoreId == 0); //filter by warehouse var matchedByWarehouse = warehouseId == 0 @@ -125,54 +130,54 @@ public virtual IPagedList GetAll(int pageIndex = 0, int /// /// Record identifier /// Shipping by weight record - public virtual ShippingByWeightRecord GetById(int shippingByWeightRecordId) + public virtual ShippingByWeightByTotalRecord GetById(int shippingByWeightRecordId) { if (shippingByWeightRecordId == 0) return null; - return _sbwRepository.GetById(shippingByWeightRecordId); + return _sbwtRepository.GetById(shippingByWeightRecordId); } /// /// Insert the shipping by weight record /// /// Shipping by weight record - public virtual void InsertShippingByWeightRecord(ShippingByWeightRecord shippingByWeightRecord) + public virtual void InsertShippingByWeightRecord(ShippingByWeightByTotalRecord shippingByWeightRecord) { if (shippingByWeightRecord == null) throw new ArgumentNullException(nameof(shippingByWeightRecord)); - _sbwRepository.Insert(shippingByWeightRecord); + _sbwtRepository.Insert(shippingByWeightRecord); - _cacheManager.RemoveByPattern(SHIPPINGBYWEIGHT_PATTERN_KEY); + _cacheManager.RemoveByPattern(SHIPPINGBYWEIGHTBYTOTAL_PATTERN_KEY); } /// /// Update the shipping by weight record /// /// Shipping by weight record - public virtual void UpdateShippingByWeightRecord(ShippingByWeightRecord shippingByWeightRecord) + public virtual void UpdateShippingByWeightRecord(ShippingByWeightByTotalRecord shippingByWeightRecord) { if (shippingByWeightRecord == null) throw new ArgumentNullException(nameof(shippingByWeightRecord)); - _sbwRepository.Update(shippingByWeightRecord); + _sbwtRepository.Update(shippingByWeightRecord); - _cacheManager.RemoveByPattern(SHIPPINGBYWEIGHT_PATTERN_KEY); + _cacheManager.RemoveByPattern(SHIPPINGBYWEIGHTBYTOTAL_PATTERN_KEY); } /// /// Delete the shipping by weight record /// /// Shipping by weight record - public virtual void DeleteShippingByWeightRecord(ShippingByWeightRecord shippingByWeightRecord) + public virtual void DeleteShippingByWeightRecord(ShippingByWeightByTotalRecord shippingByWeightRecord) { if (shippingByWeightRecord == null) throw new ArgumentNullException(nameof(shippingByWeightRecord)); - _sbwRepository.Delete(shippingByWeightRecord); + _sbwtRepository.Delete(shippingByWeightRecord); - _cacheManager.RemoveByPattern(SHIPPINGBYWEIGHT_PATTERN_KEY); + _cacheManager.RemoveByPattern(SHIPPINGBYWEIGHTBYTOTAL_PATTERN_KEY); } #endregion diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Views/AddRateByWeightPopup.cshtml b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Views/AddRateByWeightByTotalPopup.cshtml similarity index 63% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Views/AddRateByWeightPopup.cshtml rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Views/AddRateByWeightByTotalPopup.cshtml index 560230b4ed9..e321da34b66 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Views/AddRateByWeightPopup.cshtml +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Views/AddRateByWeightByTotalPopup.cshtml @@ -1,9 +1,9 @@ @{ Layout = "_AdminPopupLayout"; } -@model Nop.Plugin.Shipping.FixedOrByWeight.Models.ShippingByWeightModel +@model Nop.Plugin.Shipping.FixedByWeightByTotal.Models.ShippingByWeightByTotalModel -
@@ -17,7 +17,7 @@
- @await Html.PartialAsync("~/Plugins/Shipping.FixedOrByWeight/Views/_CreateOrUpdateRateByWeight.cshtml", Model) + @await Html.PartialAsync("~/Plugins/Shipping.FixedByWeightByTotal/Views/_CreateOrUpdateRateByWeightByTotal.cshtml", Model)
\ No newline at end of file diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Views/Configure.cshtml b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Views/Configure.cshtml similarity index 82% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Views/Configure.cshtml rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Views/Configure.cshtml index 741c52bb756..521166c5930 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Views/Configure.cshtml +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Views/Configure.cshtml @@ -1,4 +1,4 @@ -@model Nop.Plugin.Shipping.FixedOrByWeight.Models.ConfigurationModel +@model Nop.Plugin.Shipping.FixedByWeightByTotal.Models.ConfigurationModel @{ Layout = "_ConfigurePlugin"; } @@ -6,11 +6,11 @@
- +
@@ -48,7 +48,7 @@ checkAdvancedSettingsMode($(this).is(':checked')); $.ajax({ cache: false, - url: '@Url.Action("SaveMode", "FixedOrByWeight")', + url: '@Url.Action("SaveMode", "FixedByWeightByTotal")', type: 'post', data: { value: $(this).is(':checked') }, dataType: 'json', @@ -60,5 +60,5 @@ }); -@await Html.PartialAsync("~/Plugins/Shipping.FixedOrByWeight/Views/_FixedRate.cshtml") -@await Html.PartialAsync("~/Plugins/Shipping.FixedOrByWeight/Views/_ByWeight.cshtml", Model) \ No newline at end of file +@await Html.PartialAsync("~/Plugins/Shipping.FixedByWeightByTotal/Views/_FixedRate.cshtml") +@await Html.PartialAsync("~/Plugins/Shipping.FixedByWeightByTotal/Views/_ByWeightByTotal.cshtml", Model) diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Views/EditRateByWeightPopup.cshtml b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Views/EditRateByWeightByTotalPopup.cshtml similarity index 63% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Views/EditRateByWeightPopup.cshtml rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Views/EditRateByWeightByTotalPopup.cshtml index 72498a175c2..ca7e06e2951 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Views/EditRateByWeightPopup.cshtml +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Views/EditRateByWeightByTotalPopup.cshtml @@ -1,9 +1,9 @@ @{ Layout = "_AdminPopupLayout"; } -@model Nop.Plugin.Shipping.FixedOrByWeight.Models.ShippingByWeightModel +@model Nop.Plugin.Shipping.FixedByWeightByTotal.Models.ShippingByWeightByTotalModel -
@@ -17,7 +17,7 @@
- @await Html.PartialAsync("~/Plugins/Shipping.FixedOrByWeight/Views/_CreateOrUpdateRateByWeight.cshtml", Model) + @await Html.PartialAsync("~/Plugins/Shipping.FixedByWeightByTotal/Views/_CreateOrUpdateRateByWeightByTotal.cshtml", Model)
\ No newline at end of file diff --git a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Views/_ByWeight.cshtml b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Views/_ByWeightByTotal.cshtml similarity index 87% rename from src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Views/_ByWeight.cshtml rename to src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Views/_ByWeightByTotal.cshtml index f6a90104325..9f0c05b3be8 100644 --- a/src/Plugins/Nop.Plugin.Shipping.FixedOrByWeight/Views/_ByWeight.cshtml +++ b/src/Plugins/Nop.Plugin.Shipping.FixedByWeightByTotal/Views/_ByWeightByTotal.cshtml @@ -1,17 +1,17 @@ -@model Nop.Plugin.Shipping.FixedOrByWeight.Models.ConfigurationModel +@model Nop.Plugin.Shipping.FixedByWeightByTotal.Models.ConfigurationModel @inject Nop.Core.Domain.Common.AdminAreaSettings adminAreaSettings @inject Nop.Services.Stores.IStoreService storeService @{ var stores = storeService.GetAllStores(); } -
+

- @T("Plugins.Shipping.FixedOrByWeight.Formula") - @T("Plugins.Shipping.FixedOrByWeight.Formula.Value") + @T("Plugins.Shipping.FixedByWeightByTotal.Formula") + @T("Plugins.Shipping.FixedByWeightByTotal.Formula.Value")