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 changes

supporta66a91ea1ce9
diff --git a/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartService.cs b/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartService.cs
index b77bb1f5c..8e40fada1 100644
--- a/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartService.cs
+++ b/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartService.cs
@@ -222,15 +222,10 @@ namespace Grand.Business.Checkout.Services.Orders
rentalStartDate, rentalEndDate);
var update = shoppingCartItem != null && product.ProductTypeId != ProductType.Reservation
- && String.IsNullOrEmpty(product.AllowedQuantities);
+ && string.IsNullOrEmpty(product.AllowedQuantities);
- if (update)
- {
- shoppingCartItem.Quantity += quantity;
- warnings.AddRange(await _shoppingCartValidator.GetShoppingCartItemWarnings(customer, shoppingCartItem, product, validator));
- }
- else
- {
+ if (update) shoppingCartItem.Quantity += quantity;
+ else {
DateTime now = DateTime.UtcNow;
shoppingCartItem = new ShoppingCartItem {
ShoppingCartTypeId = shoppingCartType,
@@ -253,23 +248,13 @@ namespace Grand.Business.Checkout.Services.Orders
Parameter = parameter,
Duration = duration
};
-
- warnings.AddRange(await _shoppingCartValidator.GetShoppingCartItemWarnings
- (customer, shoppingCartItem, product, validator));
}
+ warnings.AddRange(await _shoppingCartValidator.GetShoppingCartItemWarnings(customer, shoppingCartItem, product, validator));
if (!warnings.Any())
{
- if (update)
- {
- //update existing shopping cart item
- await UpdateExistingShoppingCartItem(shoppingCartItem, customer, attributes);
- }
- else
- {
- //insert new item
- shoppingCartItem = await InsertNewItem(customer, product, shoppingCartItem, automaticallyAddRequiredProductsIfEnabled);
- }
+ if (update) await UpdateExistingShoppingCartItem(shoppingCartItem, customer, attributes);
+ else shoppingCartItem = await InsertNewItem(customer, product, shoppingCartItem, automaticallyAddRequiredProductsIfEnabled);
if (product.ProductTypeId == ProductType.Reservation)
await _mediator.Send(new AddCustomerReservationCommand() {
@@ -280,7 +265,6 @@ namespace Grand.Business.Checkout.Services.Orders
RentalEndDate = rentalEndDate,
ReservationId = reservationId,
});
-
//reset checkout info
await _customerService.ResetCheckoutData(customer, storeId);
}
diff --git a/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartValidator.cs b/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartValidator.cs
index 77c390b9d..bf2550ca1 100644
--- a/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartValidator.cs
+++ b/src/Business/Grand.Business.Checkout/Services/Orders/ShoppingCartValidator.cs
@@ -1,12 +1,12 @@
-using Grand.Business.Core.Interfaces.Catalog.Prices;
+using Grand.Business.Core.Extensions;
+using Grand.Business.Core.Interfaces.Catalog.Prices;
using Grand.Business.Core.Interfaces.Catalog.Products;
using Grand.Business.Core.Interfaces.Checkout.CheckoutAttributes;
using Grand.Business.Core.Interfaces.Checkout.Orders;
-using Grand.Business.Core.Interfaces.Checkout.Shipping;
-using Grand.Business.Core.Extensions;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Security;
+using Grand.Business.Core.Utilities.Checkout;
using Grand.Business.Core.Utilities.Common.Security;
using Grand.Domain.Catalog;
using Grand.Domain.Common;
@@ -15,7 +15,6 @@ using Grand.Domain.Orders;
using Grand.Infrastructure;
using Grand.SharedKernel.Extensions;
using MediatR;
-using Grand.Business.Core.Utilities.Checkout;
namespace Grand.Business.Checkout.Services.Orders
{
@@ -35,7 +34,6 @@ namespace Grand.Business.Checkout.Services.Orders
private readonly IProductAttributeService _productAttributeService;
private readonly IProductReservationService _productReservationService;
private readonly IStockQuantityService _stockQuantityService;
- private readonly IWarehouseService _warehouseService;
private readonly ShoppingCartSettings _shoppingCartSettings;
@@ -53,7 +51,6 @@ namespace Grand.Business.Checkout.Services.Orders
IProductAttributeService productAttributeService,
IProductReservationService productReservationService,
IStockQuantityService stockQuantityService,
- IWarehouseService warehouseService,
ShoppingCartSettings shoppingCartSettings)
{
_workContext = workContext;
@@ -69,7 +66,6 @@ namespace Grand.Business.Checkout.Services.Orders
_productAttributeService = productAttributeService;
_productReservationService = productReservationService;
_stockQuantityService = stockQuantityService;
- _warehouseService = warehouseService;
_shoppingCartSettings = shoppingCartSettings;
}
@@ -439,13 +435,6 @@ namespace Grand.Business.Checkout.Services.Orders
var warehouseId = !string.IsNullOrEmpty(shoppingCartItem.WarehouseId) ? shoppingCartItem.WarehouseId : _workContext.CurrentStore?.DefaultWarehouseId;
- if (!string.IsNullOrEmpty(warehouseId))
- {
- var warehouse = await _warehouseService.GetWarehouseById(warehouseId);
- if (warehouse == null)
- warnings.Add(_translationService.GetResource("ShoppingCart.WarehouseNotExists"));
- }
-
if (!hasQtyWarnings)
{
switch (product.ManageInventoryMethodId)