Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Plugin - Payments.CachOnDelivery - allow to set display order

KrzysztofPajak09581a8fc1ae
diff --git a/src/Plugins/Payments.CashOnDelivery/CashOnDeliveryPaymentPlugin.cs b/src/Plugins/Payments.CashOnDelivery/CashOnDeliveryPaymentPlugin.cs
index e88e22f23..618bf0469 100644
--- a/src/Plugins/Payments.CashOnDelivery/CashOnDeliveryPaymentPlugin.cs
+++ b/src/Plugins/Payments.CashOnDelivery/CashOnDeliveryPaymentPlugin.cs
@@ -60,6 +60,7 @@ namespace Payments.CashOnDelivery
await this.AddOrUpdatePluginTranslateResource(_translationService, _languageService, "Plugins.Payment.CashOnDelivery.AdditionalFeePercentage.Hint", "Determines whether to apply a percentage additional fee to the order total. If not enabled, a fixed value is used.");
await this.AddOrUpdatePluginTranslateResource(_translationService, _languageService, "Plugins.Payment.CashOnDelivery.ShippableProductRequired", "Shippable product required");
await this.AddOrUpdatePluginTranslateResource(_translationService, _languageService, "Plugins.Payment.CashOnDelivery.ShippableProductRequired.Hint", "An option indicating whether shippable products are required in order to display this payment method during checkout.");
+ await this.AddOrUpdatePluginTranslateResource(_translationService, _languageService, "Plugins.Payment.CashOnDelivery.DisplayOrder", "Display order");
await base.Install();
diff --git a/src/Plugins/Payments.CashOnDelivery/Controllers/PaymentCashOnDeliveryController.cs b/src/Plugins/Payments.CashOnDelivery/Controllers/PaymentCashOnDeliveryController.cs
index f2c14f370..74b9f17bd 100644
--- a/src/Plugins/Payments.CashOnDelivery/Controllers/PaymentCashOnDeliveryController.cs
+++ b/src/Plugins/Payments.CashOnDelivery/Controllers/PaymentCashOnDeliveryController.cs
@@ -65,7 +65,8 @@ namespace Payments.CashOnDelivery.Controllers
DescriptionText = cashOnDeliveryPaymentSettings.DescriptionText,
AdditionalFee = cashOnDeliveryPaymentSettings.AdditionalFee,
AdditionalFeePercentage = cashOnDeliveryPaymentSettings.AdditionalFeePercentage,
- ShippableProductRequired = cashOnDeliveryPaymentSettings.ShippableProductRequired
+ ShippableProductRequired = cashOnDeliveryPaymentSettings.ShippableProductRequired,
+ DisplayOrder = cashOnDeliveryPaymentSettings.DisplayOrder
};
model.DescriptionText = cashOnDeliveryPaymentSettings.DescriptionText;
@@ -89,6 +90,7 @@ namespace Payments.CashOnDelivery.Controllers
cashOnDeliveryPaymentSettings.AdditionalFee = model.AdditionalFee;
cashOnDeliveryPaymentSettings.AdditionalFeePercentage = model.AdditionalFeePercentage;
cashOnDeliveryPaymentSettings.ShippableProductRequired = model.ShippableProductRequired;
+ cashOnDeliveryPaymentSettings.DisplayOrder = model.DisplayOrder;
await _settingService.SaveSetting(cashOnDeliveryPaymentSettings, storeScope);
diff --git a/src/Plugins/Payments.CashOnDelivery/Models/ConfigurationModel.cs b/src/Plugins/Payments.CashOnDelivery/Models/ConfigurationModel.cs
index 0e649e939..35dc21ad4 100644
--- a/src/Plugins/Payments.CashOnDelivery/Models/ConfigurationModel.cs
+++ b/src/Plugins/Payments.CashOnDelivery/Models/ConfigurationModel.cs
@@ -27,6 +27,10 @@ namespace Payments.CashOnDelivery.Models
[GrandResourceDisplayName("Plugins.Payment.CashOnDelivery.ShippableProductRequired")]
public bool ShippableProductRequired { get; set; }
+ [GrandResourceDisplayName("Plugins.Payment.CashOnDelivery.DisplayOrder")]
+ public int DisplayOrder { get; set; }
+
+
public IList<ConfigurationLocalizedModel> Locales { get; set; }
#region Nested class
diff --git a/src/Plugins/Payments.CashOnDelivery/Views/PaymentCashOnDelivery/Configure.cshtml b/src/Plugins/Payments.CashOnDelivery/Views/PaymentCashOnDelivery/Configure.cshtml
index 3f67c3689..f6d36d1f0 100644
--- a/src/Plugins/Payments.CashOnDelivery/Views/PaymentCashOnDelivery/Configure.cshtml
+++ b/src/Plugins/Payments.CashOnDelivery/Views/PaymentCashOnDelivery/Configure.cshtml
@@ -66,6 +66,15 @@
<span asp-validation-for="ShippableProductRequired"></span>
</div>
</div>
+ <div class="form-group">
+ <div class="col-md-3 col-sm-3 text-right">
+ <admin-label asp-for="DisplayOrder" class="control-label" />
+ </div>
+ <div class="col-md-9 col-sm-9">
+ <admin-input asp-for="DisplayOrder" />
+ <span asp-validation-for="DisplayOrder"></span>
+ </div>
+ </div>
</div>
<div class="form-actions">
<div class="row">