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.

Minor improvements - save checkout attributes

KrzysztofPajak4dc0c79ca337
diff --git a/src/Web/Grand.Web/Commands/Handler/ShoppingCart/SaveCheckoutAttributesCommandHandler.cs b/src/Web/Grand.Web/Commands/Handler/ShoppingCart/SaveCheckoutAttributesCommandHandler.cs
index 863643067..9fdd8205f 100644
--- a/src/Web/Grand.Web/Commands/Handler/ShoppingCart/SaveCheckoutAttributesCommandHandler.cs
+++ b/src/Web/Grand.Web/Commands/Handler/ShoppingCart/SaveCheckoutAttributesCommandHandler.cs
@@ -91,6 +91,7 @@ namespace Grand.Web.Commands.Handler.ShoppingCart
break;
case AttributeControlType.TextBox:
case AttributeControlType.MultilineTextbox:
+ case AttributeControlType.Datepicker:
{
request.Form.TryGetValue(controlId, out var ctrlAttributes);
if (!string.IsNullOrEmpty(ctrlAttributes))
@@ -101,13 +102,6 @@ namespace Grand.Web.Commands.Handler.ShoppingCart
}
}
break;
- case AttributeControlType.Datepicker:
- {
- request.Form.TryGetValue(controlId, out var dateAttributes);
- customAttributes = _checkoutAttributeParser.AddCheckoutAttribute(customAttributes,
- attribute, dateAttributes).ToList();
- }
- break;
case AttributeControlType.FileUpload:
{
Guid downloadGuid;
diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetParseProductAttributesHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetParseProductAttributesHandler.cs
index 2eb6d2566..b02acc264 100644
--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetParseProductAttributesHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetParseProductAttributesHandler.cs
@@ -93,23 +93,17 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
break;
case AttributeControlType.TextBox:
case AttributeControlType.MultilineTextbox:
+ case AttributeControlType.Datepicker:
{
request.Form.TryGetValue(controlId, out var ctrlAttributes);
if (!string.IsNullOrEmpty(ctrlAttributes))
{
- string enteredText = ctrlAttributes.ToString().Trim();
+ var enteredText = ctrlAttributes.ToString().Trim();
customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
attribute, enteredText).ToList();
}
}
break;
- case AttributeControlType.Datepicker:
- {
- request.Form.TryGetValue(controlId, out var dateAttributes);
- customAttributes = _productAttributeParser.AddProductAttribute(customAttributes,
- attribute, dateAttributes).ToList();
- }
- break;
case AttributeControlType.FileUpload:
{
request.Form.TryGetValue(controlId, out var guid);
diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs
index 5a9909ad1..fd6ec44c4 100644
--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs
@@ -301,6 +301,7 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
break;
case AttributeControlType.TextBox:
case AttributeControlType.MultilineTextbox:
+ case AttributeControlType.Datepicker:
{
if (selectedCheckoutAttributes != null && selectedCheckoutAttributes.Any())
{
@@ -310,19 +311,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
}
}
break;
- case AttributeControlType.Datepicker:
- {
- if (selectedCheckoutAttributes != null && selectedCheckoutAttributes.Any())
- {
- //keep in mind my that the code below works only in the current culture
- var selectedDateStr = selectedCheckoutAttributes.Where(x => x.Key == attribute.Id).Select(x => x.Value).ToList();
- if (selectedDateStr.Any())
- {
- attributeModel.DefaultValue = selectedDateStr[0];
- }
- }
- }
- break;
case AttributeControlType.FileUpload:
{
if (selectedCheckoutAttributes != null && selectedCheckoutAttributes.Any())