Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofPajak committed Mar 27, 2020
1 parent 35ea9ab commit 33422d9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Grand.Web/App_Data/Localization/Upgrade/EN_460_470.nopres.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,8 @@
<LocaleResource Name="ShoppingCart.Combination.BundleProduct.NotExist">
<Value>For product {0} combination doesn't exist</Value>
</LocaleResource>
<LocaleResource Name="Checkout.MinOrderOneProduct">
<Value>You need to have at least one product marked to checkout</Value>
</LocaleResource>
</Language>

7 changes: 5 additions & 2 deletions Grand.Web/App_Data/Localization/defaultResources.grandres.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17342,8 +17342,11 @@
<LocaleResource Name="Checkout.MinOrderSubtotalAmount">
<Value>Minimum order sub-total amount is {0}</Value>
</LocaleResource>
<LocaleResource Name="Checkout.MinOrderTotalAmount">
<Value>Minimum order total amount is {0}</Value>
<LocaleResource Name="Checkout.MinOrderSubtotalAmount">
<Value>Minimum order sub-total amount is {0}</Value>
</LocaleResource>
<LocaleResource Name="Checkout.MinOrderOneProduct">
<Value>You need to have at least one product marked to checkout</Value>
</LocaleResource>
<LocaleResource Name="Checkout.NewAddress">
<Value>New Address</Value>
Expand Down
15 changes: 11 additions & 4 deletions Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,18 @@ private async Task PrepareSimpleProperties(ShoppingCartModel model, GetShoppingC
model.ShowCheckoutAsGuestButton = model.IsGuest && _orderSettings.AnonymousCheckoutAllowed;
var checkoutAttributesXml = request.Customer.GetAttributeFromEntity<string>(SystemCustomerAttributeNames.CheckoutAttributes, request.Store.Id);
model.CheckoutAttributeInfo = await _checkoutAttributeFormatter.FormatAttributes(checkoutAttributesXml, request.Customer);
bool minOrderSubtotalAmountOk = await _orderProcessingService.ValidateMinOrderSubtotalAmount(request.Cart.Where(x=>x.ShoppingCartType == ShoppingCartType.ShoppingCart || x.ShoppingCartType == ShoppingCartType.Auctions).ToList());
if (!minOrderSubtotalAmountOk)
if (!request.Cart.Where(x => x.ShoppingCartType == ShoppingCartType.ShoppingCart || x.ShoppingCartType == ShoppingCartType.Auctions).ToList().Any())
{
decimal minOrderSubtotalAmount = await _currencyService.ConvertFromPrimaryStoreCurrency(_orderSettings.MinOrderSubtotalAmount, request.Currency);
model.MinOrderSubtotalWarning = string.Format(_localizationService.GetResource("Checkout.MinOrderSubtotalAmount"), _priceFormatter.FormatPrice(minOrderSubtotalAmount, true, false));
model.MinOrderSubtotalWarning = _localizationService.GetResource("Checkout.MinOrderOneProduct");
}
else
{
bool minOrderSubtotalAmountOk = await _orderProcessingService.ValidateMinOrderSubtotalAmount(request.Cart.Where(x => x.ShoppingCartType == ShoppingCartType.ShoppingCart || x.ShoppingCartType == ShoppingCartType.Auctions).ToList());
if (!minOrderSubtotalAmountOk)
{
decimal minOrderSubtotalAmount = await _currencyService.ConvertFromPrimaryStoreCurrency(_orderSettings.MinOrderSubtotalAmount, request.Currency);
model.MinOrderSubtotalWarning = string.Format(_localizationService.GetResource("Checkout.MinOrderSubtotalAmount"), _priceFormatter.FormatPrice(minOrderSubtotalAmount, true, false));
}
}
model.TermsOfServiceOnShoppingCartPage = _orderSettings.TermsOfServiceOnShoppingCartPage;
model.TermsOfServiceOnOrderConfirmPage = _orderSettings.TermsOfServiceOnOrderConfirmPage;
Expand Down

0 comments on commit 33422d9

Please sign in to comment.