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.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
CheckoutModel - remove unused properties (HasSinglePaymentMethod)
supportda55e3b16270
diff --git a/src/Web/Grand.Web/Controllers/CheckoutController.cs b/src/Web/Grand.Web/Controllers/CheckoutController.csindex 5ed26b2fc..42e56f655 100644--- a/src/Web/Grand.Web/Controllers/CheckoutController.cs+++ b/src/Web/Grand.Web/Controllers/CheckoutController.cs@@ -130,29 +130,7 @@ namespace Grand.Web.Controllersreturn warnings;}- private async Task<CheckoutPaymentMethodModel> GetCheckoutPaymentMethodModel(IList<ShoppingCartItem> cart)- {- var filterByCountryId = "";- if (_addressSettings.CountryEnabled &&- _workContext.CurrentCustomer.BillingAddress != null &&- !string.IsNullOrWhiteSpace(_workContext.CurrentCustomer.BillingAddress.CountryId))- {- filterByCountryId = _workContext.CurrentCustomer.BillingAddress.CountryId;- }-- var paymentMethodModel = await _mediator.Send(new GetPaymentMethod {- Cart = cart,- Currency = _workContext.WorkingCurrency,- Customer = _workContext.CurrentCustomer,- FilterByCountryId = filterByCountryId,- Language = _workContext.WorkingLanguage,- Store = _workContext.CurrentStore- });-- return paymentMethodModel;- }-- protected IList<string> SerializeModelState(ModelStateDictionary modelState)+ private IList<string> SerializeModelState(ModelStateDictionary modelState){var errors = new List<string>();var valuerrors = modelState.Where(entry => entry.Value.Errors.Any());@@ -395,8 +373,7 @@ namespace Grand.Web.Controllersif (sciWarnings.Any())return RedirectToRoute("ShoppingCart", new { checkoutAttributes = true });}-- var paymentMethodModel = await GetCheckoutPaymentMethodModel(cart);+var requiresShipping = cart.RequiresShipping();var model = new CheckoutModel {ShippingRequired = requiresShipping,@@ -414,8 +391,7 @@ namespace Grand.Web.ControllersLanguage = _workContext.WorkingLanguage,Store = _workContext.CurrentStore,PrePopulateNewAddressWithCustomerFields = true- }),- HasSinglePaymentMethod = paymentMethodModel.PaymentMethods?.Count == 1+ })};if (!requiresShipping && !model.BillingAddress.ExistingAddresses.Any()){diff --git a/src/Web/Grand.Web/Models/Checkout/CheckoutModel.cs b/src/Web/Grand.Web/Models/Checkout/CheckoutModel.csindex 0395137a8..ffdfc0798 100644--- a/src/Web/Grand.Web/Models/Checkout/CheckoutModel.cs+++ b/src/Web/Grand.Web/Models/Checkout/CheckoutModel.cs@@ -7,6 +7,5 @@ namespace Grand.Web.Models.Checkoutpublic bool ShippingRequired { get; set; }public CheckoutBillingAddressModel BillingAddress { get; set; }public CheckoutShippingAddressModel ShippingAddress { get; set; }- public bool HasSinglePaymentMethod { get; set; }}}\ No newline at end of file