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.

Further changes with the order summary

support156285ce94ca
diff --git a/src/Web/Grand.Web/Controllers/CheckoutController.cs b/src/Web/Grand.Web/Controllers/CheckoutController.cs
index c3fbd3350..9070427b1 100644
--- a/src/Web/Grand.Web/Controllers/CheckoutController.cs
+++ b/src/Web/Grand.Web/Controllers/CheckoutController.cs
@@ -370,7 +370,7 @@ namespace Grand.Web.Controllers
await _userFieldService.SaveField<string>(_workContext.CurrentCustomer,
SystemCustomerFieldNames.SelectedPaymentMethod, null, _workContext.CurrentStore.Id);
- var confirmOrderModel = await _mediator.Send(new GetConfirmOrder() { Cart = cart, Customer = _workContext.CurrentCustomer });
+ var confirmOrderModel = await _mediator.Send(new GetConfirmOrder() { Cart = cart, Customer = _workContext.CurrentCustomer, Language = _workContext.WorkingLanguage, Store = _workContext.CurrentStore });
return Json(new
{
update_section = new UpdateSectionJsonModel {
@@ -397,7 +397,7 @@ namespace Grand.Web.Controllers
(paymentMethod.PaymentMethodType == PaymentMethodType.Redirection
&& _paymentSettings.SkipPaymentInfo))
{
- var confirmOrderModel = await _mediator.Send(new GetConfirmOrder() { Cart = cart, Customer = _workContext.CurrentCustomer });
+ var confirmOrderModel = await _mediator.Send(new GetConfirmOrder() { Cart = cart, Customer = _workContext.CurrentCustomer, Language = _workContext.WorkingLanguage, Store = _workContext.CurrentStore });
return Json(new
{
update_section = new UpdateSectionJsonModel {
@@ -854,7 +854,7 @@ namespace Grand.Web.Controllers
await _userFieldService.SaveField<string>(_workContext.CurrentCustomer,
SystemCustomerFieldNames.SelectedPaymentMethod, null, _workContext.CurrentStore.Id);
- var confirmOrderModel = await _mediator.Send(new GetConfirmOrder() { Cart = cart, Customer = _workContext.CurrentCustomer });
+ var confirmOrderModel = await _mediator.Send(new GetConfirmOrder() { Cart = cart, Customer = _workContext.CurrentCustomer, Language = _workContext.WorkingLanguage, Store = _workContext.CurrentStore });
return Json(new
{
update_section = new UpdateSectionJsonModel {
@@ -923,7 +923,7 @@ namespace Grand.Web.Controllers
SystemCustomerFieldNames.PaymentTransaction, paymentTransaction.Id, _workContext.CurrentStore.Id);
}
- var confirmOrderModel = await _mediator.Send(new GetConfirmOrder() { Cart = cart, Customer = _workContext.CurrentCustomer });
+ var confirmOrderModel = await _mediator.Send(new GetConfirmOrder() { Cart = cart, Customer = _workContext.CurrentCustomer, Language = _workContext.WorkingLanguage, Store = _workContext.CurrentStore });
return Json(new
{
update_section = new UpdateSectionJsonModel {
diff --git a/src/Web/Grand.Web/Controllers/ShoppingCartController.cs b/src/Web/Grand.Web/Controllers/ShoppingCartController.cs
index 2b33160f3..680fff7ca 100644
--- a/src/Web/Grand.Web/Controllers/ShoppingCartController.cs
+++ b/src/Web/Grand.Web/Controllers/ShoppingCartController.cs
@@ -284,14 +284,13 @@ namespace Grand.Web.Controllers
}
[DenySystemAccount]
- public async Task<IActionResult> CartSummary(bool? prepareAndDisplayOrderReviewData)
+ public async Task<IActionResult> CartSummary()
{
var cart = await _shoppingCartService.GetShoppingCart(_workContext.CurrentStore.Id, ShoppingCartType.ShoppingCart, ShoppingCartType.Auctions);
var model = await _mediator.Send(new GetShoppingCart() {
Cart = cart,
IsEditable = false,
- PrepareAndDisplayOrderReviewData = prepareAndDisplayOrderReviewData.GetValueOrDefault(),
Customer = _workContext.CurrentCustomer,
Currency = _workContext.WorkingCurrency,
Language = _workContext.WorkingLanguage,
diff --git a/src/Web/Grand.Web/Features/Handlers/Checkout/GetConfirmOrderHandler.cs b/src/Web/Grand.Web/Features/Handlers/Checkout/GetConfirmOrderHandler.cs
index 6a04aaedd..f742a7581 100644
--- a/src/Web/Grand.Web/Features/Handlers/Checkout/GetConfirmOrderHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/Checkout/GetConfirmOrderHandler.cs
@@ -1,40 +1,121 @@
using Grand.Business.Core.Commands.Checkout.Orders;
+using Grand.Business.Core.Extensions;
+using Grand.Business.Core.Interfaces.Checkout.Payments;
+using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
+using Grand.Business.Core.Queries.Checkout.Orders;
+using Grand.Domain.Common;
+using Grand.Domain.Customers;
using Grand.Domain.Orders;
+using Grand.Domain.Shipping;
using Grand.Web.Features.Models.Checkout;
+using Grand.Web.Features.Models.Common;
using Grand.Web.Models.Checkout;
+using Grand.Web.Models.Common;
using MediatR;
namespace Grand.Web.Features.Handlers.Checkout
{
public class GetConfirmOrderHandler : IRequestHandler<GetConfirmOrder, CheckoutConfirmModel>
{
- private readonly IMediator _mediator;
+ private readonly ICountryService _countryService;
+ private readonly IPaymentService _paymentService;
private readonly ITranslationService _translationService;
+ private readonly IMediator _mediator;
private readonly OrderSettings _orderSettings;
+ private readonly ShippingSettings _shippingSettings;
public GetConfirmOrderHandler(
- IMediator mediator,
+ ICountryService countryService,
+ IPaymentService paymentService,
ITranslationService translationService,
- OrderSettings orderSettings)
+ IMediator mediator,
+ OrderSettings orderSettings,
+ ShippingSettings shippingSettings)
+
{
- _mediator = mediator;
+ _countryService = countryService;
+ _paymentService = paymentService;
_translationService = translationService;
+ _mediator = mediator;
_orderSettings = orderSettings;
+ _shippingSettings = shippingSettings;
}
public async Task<CheckoutConfirmModel> Handle(GetConfirmOrder request, CancellationToken cancellationToken)
{
- var model = new CheckoutConfirmModel();
- //terms of service
- model.TermsOfServiceOnOrderConfirmPage = _orderSettings.TermsOfServiceOnOrderConfirmPage;
+ var model = new CheckoutConfirmModel {
+ //terms of service
+ TermsOfServiceOnOrderConfirmPage = _orderSettings.TermsOfServiceOnOrderConfirmPage
+ };
//min order amount validation
- var minOrderTotalAmountOk = await _mediator.Send(new ValidateShoppingCartTotalAmountCommand() { Customer = request.Customer, Cart = request.Cart });
+ var minOrderTotalAmountOk = await _mediator.Send(new ValidateShoppingCartTotalAmountCommand() { Customer = request.Customer, Cart = request.Cart }, cancellationToken);
if (!minOrderTotalAmountOk)
{
model.MinOrderTotalWarning = string.Format(_translationService.GetResource("Checkout.MinMaxOrderTotalAmount"));
}
+
+ await PrepareOrderReviewData(model, request);
+
return model;
}
+
+ private async Task PrepareOrderReviewData(CheckoutConfirmModel model, GetConfirmOrder request)
+ {
+ //billing info
+ var billingAddress = request.Customer.BillingAddress;
+ if (billingAddress != null)
+ model.OrderReviewData.BillingAddress = await _mediator.Send(new GetAddressModel() {
+ Language = request.Language,
+ Address = billingAddress,
+ ExcludeProperties = false,
+ });
+ //shipping info
+ if (request.Cart.RequiresShipping())
+ {
+ model.OrderReviewData.IsShippable = true;
+
+ var pickupPoint = request.Customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.SelectedPickupPoint, request.Store.Id);
+
+ model.OrderReviewData.SelectedPickUpInStore = _shippingSettings.AllowPickUpInStore && !string.IsNullOrEmpty(pickupPoint);
+
+ if (!model.OrderReviewData.SelectedPickUpInStore)
+ {
+ var shippingAddress = request.Customer.ShippingAddress;
+ if (shippingAddress != null)
+ model.OrderReviewData.ShippingAddress = await _mediator.Send(new GetAddressModel() {
+ Language = request.Language,
+ Address = shippingAddress,
+ ExcludeProperties = false,
+ });
+ }
+ else
+ {
+ var pickup = await _mediator.Send(new GetPickupPointById() { Id = pickupPoint });
+ if (pickup != null)
+ {
+ var country = await _countryService.GetCountryById(pickup.Address.CountryId);
+ model.OrderReviewData.PickupAddress = new AddressModel {
+ Address1 = pickup.Address.Address1,
+ City = pickup.Address.City,
+ CountryName = country != null ? country.Name : string.Empty,
+ ZipPostalCode = pickup.Address.ZipPostalCode
+ };
+ }
+ }
+ //selected shipping method
+ var shippingOption = request.Customer.GetUserFieldFromEntity<ShippingOption>(SystemCustomerFieldNames.SelectedShippingOption, request.Store.Id);
+ if (shippingOption != null)
+ {
+ model.OrderReviewData.ShippingMethod = shippingOption.Name;
+ model.OrderReviewData.ShippingAdditionDescription = request.Customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.ShippingOptionAttributeDescription, request.Store.Id);
+ }
+ }
+ //payment info
+ var selectedPaymentMethodSystemName = request.Customer.GetUserFieldFromEntity<string>(
+ SystemCustomerFieldNames.SelectedPaymentMethod, request.Store.Id);
+ var paymentMethod = _paymentService.LoadPaymentMethodBySystemName(selectedPaymentMethodSystemName);
+ model.OrderReviewData.PaymentMethod = paymentMethod != null ? paymentMethod.FriendlyName : "";
+ }
}
}
diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs
index e4936bc6b..411442493 100644
--- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetShoppingCartHandler.cs
@@ -7,9 +7,7 @@ using Grand.Business.Core.Utilities.Catalog;
using Grand.Business.Core.Commands.Checkout.Orders;
using Grand.Business.Core.Interfaces.Checkout.CheckoutAttributes;
using Grand.Business.Core.Interfaces.Checkout.Orders;
-using Grand.Business.Core.Interfaces.Checkout.Payments;
using Grand.Business.Core.Interfaces.Checkout.Shipping;
-using Grand.Business.Core.Queries.Checkout.Orders;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Security;
@@ -21,10 +19,7 @@ using Grand.Domain.Common;
using Grand.Domain.Customers;
using Grand.Domain.Media;
using Grand.Domain.Orders;
-using Grand.Domain.Shipping;
-using Grand.Web.Features.Models.Common;
using Grand.Web.Features.Models.ShoppingCart;
-using Grand.Web.Models.Common;
using Grand.Web.Models.Media;
using Grand.Web.Models.ShoppingCart;
using MediatR;
@@ -37,7 +32,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
{
public class GetShoppingCartHandler : IRequestHandler<GetShoppingCart, ShoppingCartModel>
{
- private readonly IPaymentService _paymentService;
private readonly IProductService _productService;
private readonly IPictureService _pictureService;
private readonly IProductAttributeParser _productAttributeParser;
@@ -51,7 +45,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
private readonly IPriceFormatter _priceFormatter;
private readonly ICheckoutAttributeParser _checkoutAttributeParser;
private readonly IDownloadService _downloadService;
- private readonly ICountryService _countryService;
private readonly IWarehouseService _warehouseService;
private readonly IProductAttributeFormatter _productAttributeFormatter;
private readonly IPricingService _pricingService;
@@ -66,11 +59,9 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
private readonly OrderSettings _orderSettings;
private readonly ShoppingCartSettings _shoppingCartSettings;
private readonly CatalogSettings _catalogSettings;
- private readonly ShippingSettings _shippingSettings;
private readonly CommonSettings _commonSettings;
public GetShoppingCartHandler(
- IPaymentService paymentService,
IProductService productService,
IPictureService pictureService,
IProductAttributeParser productAttributeParser,
@@ -84,7 +75,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
IPriceFormatter priceFormatter,
ICheckoutAttributeParser checkoutAttributeParser,
IDownloadService downloadService,
- ICountryService countryService,
IWarehouseService warehouseService,
IProductAttributeFormatter productAttributeFormatter,
IPricingService priceCalculationService,
@@ -99,10 +89,8 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
OrderSettings orderSettings,
ShoppingCartSettings shoppingCartSettings,
CatalogSettings catalogSettings,
- ShippingSettings shippingSettings,
CommonSettings commonSettings)
{
- _paymentService = paymentService;
_productService = productService;
_pictureService = pictureService;
_productAttributeParser = productAttributeParser;
@@ -116,7 +104,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
_priceFormatter = priceFormatter;
_checkoutAttributeParser = checkoutAttributeParser;
_downloadService = downloadService;
- _countryService = countryService;
_warehouseService = warehouseService;
_productAttributeFormatter = productAttributeFormatter;
_pricingService = priceCalculationService;
@@ -131,7 +118,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
_orderSettings = orderSettings;
_shoppingCartSettings = shoppingCartSettings;
_catalogSettings = catalogSettings;
- _shippingSettings = shippingSettings;
_commonSettings = commonSettings;
}
@@ -148,8 +134,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
await PrepareCartItems(model, request);
- await PrepareOrderReview(model, request);
-
return model;
}
@@ -482,73 +466,6 @@ namespace Grand.Web.Features.Handlers.ShoppingCart
}
- private async Task PrepareOrderReview(ShoppingCartModel model, GetShoppingCart request)
- {
- #region Order review data
-
- if (request.PrepareAndDisplayOrderReviewData)
- {
- model.OrderReviewData.Display = true;
-
- //billing info
- var billingAddress = request.Customer.BillingAddress;
- if (billingAddress != null)
- model.OrderReviewData.BillingAddress = await _mediator.Send(new GetAddressModel() {
- Language = request.Language,
- Address = billingAddress,
- ExcludeProperties = false,
- });
- //shipping info
- if (request.Cart.RequiresShipping())
- {
- model.OrderReviewData.IsShippable = true;
-
- var pickupPoint = request.Customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.SelectedPickupPoint, request.Store.Id);
-
- model.OrderReviewData.SelectedPickUpInStore = _shippingSettings.AllowPickUpInStore && !String.IsNullOrEmpty(pickupPoint);
-
- if (!model.OrderReviewData.SelectedPickUpInStore)
- {
- var shippingAddress = request.Customer.ShippingAddress;
- if (shippingAddress != null)
- model.OrderReviewData.ShippingAddress = await _mediator.Send(new GetAddressModel() {
- Language = request.Language,
- Address = shippingAddress,
- ExcludeProperties = false,
- });
- }
- else
- {
- var pickup = await _mediator.Send(new GetPickupPointById() { Id = pickupPoint });
- if (pickup != null)
- {
- var country = await _countryService.GetCountryById(pickup.Address.CountryId);
- model.OrderReviewData.PickupAddress = new AddressModel {
- Address1 = pickup.Address.Address1,
- City = pickup.Address.City,
- CountryName = country != null ? country.Name : string.Empty,
- ZipPostalCode = pickup.Address.ZipPostalCode
- };
- }
- }
- //selected shipping method
- var shippingOption = request.Customer.GetUserFieldFromEntity<ShippingOption>(SystemCustomerFieldNames.SelectedShippingOption, request.Store.Id);
- if (shippingOption != null)
- {
- model.OrderReviewData.ShippingMethod = shippingOption.Name;
- model.OrderReviewData.ShippingAdditionDescription = request.Customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.ShippingOptionAttributeDescription, request.Store.Id);
- }
- }
- //payment info
- var selectedPaymentMethodSystemName = request.Customer.GetUserFieldFromEntity<string>(
- SystemCustomerFieldNames.SelectedPaymentMethod, request.Store.Id);
- var paymentMethod = _paymentService.LoadPaymentMethodBySystemName(selectedPaymentMethodSystemName);
- model.OrderReviewData.PaymentMethod = paymentMethod != null ? paymentMethod.FriendlyName : "";
-
- }
- #endregion
- }
-
private async Task<PictureModel> PrepareCartItemPicture(Product product, IList<CustomAttribute> attributes)
{
var sciPicture = await product.GetProductPicture(attributes, _productService, _pictureService, _productAttributeParser);
diff --git a/src/Web/Grand.Web/Features/Models/Checkout/GetConfirmOrder.cs b/src/Web/Grand.Web/Features/Models/Checkout/GetConfirmOrder.cs
index 77f1fd707..86aad05a8 100644
--- a/src/Web/Grand.Web/Features/Models/Checkout/GetConfirmOrder.cs
+++ b/src/Web/Grand.Web/Features/Models/Checkout/GetConfirmOrder.cs
@@ -1,5 +1,7 @@
using Grand.Domain.Customers;
+using Grand.Domain.Localization;
using Grand.Domain.Orders;
+using Grand.Domain.Stores;
using Grand.Web.Models.Checkout;
using MediatR;
@@ -8,6 +10,8 @@ namespace Grand.Web.Features.Models.Checkout
public class GetConfirmOrder : IRequest<CheckoutConfirmModel>
{
public Customer Customer { get; set; }
+ public Language Language { get; set; }
+ public Store Store { get; set; }
public IList<ShoppingCartItem> Cart { get; set; }
}
}
diff --git a/src/Web/Grand.Web/Features/Models/ShoppingCart/GetShoppingCart.cs b/src/Web/Grand.Web/Features/Models/ShoppingCart/GetShoppingCart.cs
index 522214c65..949c8ec3e 100644
--- a/src/Web/Grand.Web/Features/Models/ShoppingCart/GetShoppingCart.cs
+++ b/src/Web/Grand.Web/Features/Models/ShoppingCart/GetShoppingCart.cs
@@ -20,6 +20,5 @@ namespace Grand.Web.Features.Models.ShoppingCart
public bool IsEditable { get; set; } = true;
public bool ValidateCheckoutAttributes { get; set; } = false;
public bool SetEstimateShippingDefaultAddress { get; set; } = true;
- public bool PrepareAndDisplayOrderReviewData { get; set; } = false;
}
}
diff --git a/src/Web/Grand.Web/Models/Checkout/CheckoutConfirmModel.cs b/src/Web/Grand.Web/Models/Checkout/CheckoutConfirmModel.cs
index 99151bd4a..27c1eb608 100644
--- a/src/Web/Grand.Web/Models/Checkout/CheckoutConfirmModel.cs
+++ b/src/Web/Grand.Web/Models/Checkout/CheckoutConfirmModel.cs
@@ -1,4 +1,5 @@
using Grand.Infrastructure.Models;
+using Grand.Web.Models.Common;
namespace Grand.Web.Models.Checkout
{
@@ -7,11 +8,35 @@ namespace Grand.Web.Models.Checkout
public CheckoutConfirmModel()
{
Warnings = new List<string>();
+ OrderReviewData = new OrderReviewDataModel();
}
public bool TermsOfServiceOnOrderConfirmPage { get; set; }
public string MinOrderTotalWarning { get; set; }
public IList<string> Warnings { get; set; }
+ public OrderReviewDataModel OrderReviewData { get; set; }
+
+ public partial class OrderReviewDataModel : BaseModel
+ {
+ public OrderReviewDataModel()
+ {
+ BillingAddress = new AddressModel();
+ ShippingAddress = new AddressModel();
+ PickupAddress = new AddressModel();
+ }
+
+ public AddressModel BillingAddress { get; set; }
+
+ public bool IsShippable { get; set; }
+ public AddressModel ShippingAddress { get; set; }
+ public bool SelectedPickUpInStore { get; set; }
+ public AddressModel PickupAddress { get; set; }
+ public string ShippingMethod { get; set; }
+ public string ShippingAdditionDescription { get; set; }
+
+ public string PaymentMethod { get; set; }
+
+ }
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web/Models/ShoppingCart/ShoppingCartModel.cs b/src/Web/Grand.Web/Models/ShoppingCart/ShoppingCartModel.cs
index ddaf70722..d37a12a02 100644
--- a/src/Web/Grand.Web/Models/ShoppingCart/ShoppingCartModel.cs
+++ b/src/Web/Grand.Web/Models/ShoppingCart/ShoppingCartModel.cs
@@ -1,6 +1,5 @@
using Grand.Domain.Catalog;
using Grand.Infrastructure.Models;
-using Grand.Web.Models.Common;
using Grand.Web.Models.Media;
using Microsoft.AspNetCore.Mvc.Rendering;
@@ -15,8 +14,7 @@ namespace Grand.Web.Models.ShoppingCart
DiscountBox = new DiscountBoxModel();
GiftVoucherBox = new GiftVoucherBoxModel();
CheckoutAttributes = new List<CheckoutAttributeModel>();
- OrderReviewData = new OrderReviewDataModel();
- }
+ }
public bool ShowSku { get; set; }
public bool ShowProductImages { get; set; }
public bool IsEditable { get; set; }
@@ -35,8 +33,6 @@ namespace Grand.Web.Models.ShoppingCart
public bool TermsOfServiceOnOrderConfirmPage { get; set; }
public DiscountBoxModel DiscountBox { get; set; }
public GiftVoucherBoxModel GiftVoucherBox { get; set; }
- public OrderReviewDataModel OrderReviewData { get; set; }
-
#region Nested Classes
public partial class ShoppingCartItemModel : BaseEntityModel
@@ -50,7 +46,7 @@ namespace Grand.Web.Models.ShoppingCart
}
public string Sku { get; set; }
public bool IsCart { get; set; }
- public PictureModel Picture {get;set;}
+ public PictureModel Picture { get; set; }
public string ProductId { get; set; }
public string ProductName { get; set; }
public string ProductSeName { get; set; }
@@ -118,7 +114,7 @@ namespace Grand.Web.Models.ShoppingCart
public bool IsPreSelected { get; set; }
}
- public partial class DiscountBoxModel: BaseModel
+ public partial class DiscountBoxModel : BaseModel
{
public DiscountBoxModel()
{
@@ -141,28 +137,6 @@ namespace Grand.Web.Models.ShoppingCart
public bool IsApplied { get; set; }
}
- public partial class OrderReviewDataModel : BaseModel
- {
- public OrderReviewDataModel()
- {
- BillingAddress = new AddressModel();
- ShippingAddress = new AddressModel();
- PickupAddress = new AddressModel();
- }
- public bool Display { get; set; }
-
- public AddressModel BillingAddress { get; set; }
-
- public bool IsShippable { get; set; }
- public AddressModel ShippingAddress { get; set; }
- public bool SelectedPickUpInStore { get; set; }
- public AddressModel PickupAddress { get; set; }
- public string ShippingMethod { get; set; }
- public string ShippingAdditionDescription { get; set; }
-
- public string PaymentMethod { get; set; }
-
- }
- #endregion
+ #endregion
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web/Views/Checkout/_ReviewData.cshtml b/src/Web/Grand.Web/Views/Checkout/_ReviewData.cshtml
index 557682f31..48702a6f8 100644
--- a/src/Web/Grand.Web/Views/Checkout/_ReviewData.cshtml
+++ b/src/Web/Grand.Web/Views/Checkout/_ReviewData.cshtml
@@ -4,53 +4,52 @@
<div class="card-body">
<ul class="billing-info pl-0">
<li class="name">
- {{vmorder.cart.OrderReviewData.BillingAddress.FirstName}} {{vmorder.cart.OrderReviewData.BillingAddress.LastName}}
+ {{vmorder.OrderReviewData.BillingAddress.FirstName}} {{vmorder.OrderReviewData.BillingAddress.LastName}}
</li>
<li class="email">
- <span>@Loc["Order.Email"]:</span> {{vmorder.cart.OrderReviewData.BillingAddress.Email}}
+ <span>@Loc["Order.Email"]:</span> {{vmorder.OrderReviewData.BillingAddress.Email}}
</li>
- <li class="phone" v-if="vmorder.cart.OrderReviewData.BillingAddress.PhoneEnabled">
- <span>@Loc["Order.Phone"]:</span> {{vmorder.cart.OrderReviewData.BillingAddress.PhoneNumber}}
+ <li class="phone" v-if="vmorder.OrderReviewData.BillingAddress.PhoneEnabled">
+ <span>@Loc["Order.Phone"]:</span> {{vmorder.OrderReviewData.BillingAddress.PhoneNumber}}
</li>
- <li class="fax" v-if="vmorder.cart.OrderReviewData.BillingAddress.FaxEnabled">
- <span>@Loc["Order.Fax"]:</span> {{vmorder.cart.OrderReviewData.BillingAddress.FaxNumber}}
+ <li class="fax" v-if="vmorder.OrderReviewData.BillingAddress.FaxEnabled">
+ <span>@Loc["Order.Fax"]:</span> {{vmorder.OrderReviewData.BillingAddress.FaxNumber}}
</li>
- <li class="company" v-if="vmorder.cart.OrderReviewData.BillingAddress.CompanyEnabled && vmorder.cart.OrderReviewData.BillingAddress.Company !== null">
- {{vmorder.cart.OrderReviewData.BillingAddress.Company}}
+ <li class="company" v-if="vmorder.OrderReviewData.BillingAddress.CompanyEnabled && vmorder.OrderReviewData.BillingAddress.Company !== null">
+ {{vmorder.OrderReviewData.BillingAddress.Company}}
</li>
- <li class="vatnumber" v-if="vmorder.cart.OrderReviewData.BillingAddress.VatNumberEnabled && vmorder.cart.OrderReviewData.BillingAddress.VatNumber !== null">
- {{vmorder.cart.OrderReviewData.BillingAddress.VatNumber}}
+ <li class="vatnumber" v-if="vmorder.OrderReviewData.BillingAddress.VatNumberEnabled && vmorder.OrderReviewData.BillingAddress.VatNumber !== null">
+ {{vmorder.OrderReviewData.BillingAddress.VatNumber}}
</li>
- <li class="address1" v-if="vmorder.cart.OrderReviewData.BillingAddress.StreetAddressEnabled">
- {{vmorder.cart.OrderReviewData.BillingAddress.Address1}}
+ <li class="address1" v-if="vmorder.OrderReviewData.BillingAddress.StreetAddressEnabled">
+ {{vmorder.OrderReviewData.BillingAddress.Address1}}
</li>
- <li class="address2" v-if="vmorder.cart.OrderReviewData.BillingAddress.StreetAddress2Enabled && vmorder.cart.OrderReviewData.BillingAddress.Address2 !== null">
- {{vmorder.cart.OrderReviewData.BillingAddress.Address2}}
+ <li class="address2" v-if="vmorder.OrderReviewData.BillingAddress.StreetAddress2Enabled && vmorder.OrderReviewData.BillingAddress.Address2 !== null">
+ {{vmorder.OrderReviewData.BillingAddress.Address2}}
</li>
- <template v-if="vmorder.cart.OrderReviewData.BillingAddress.CityEnabled && vmorder.cart.OrderReviewData.BillingAddress.StateProvinceEnabled && vmorder.cart.OrderReviewData.BillingAddress.ZipPostalCodeEnabled">
+ <template v-if="vmorder.OrderReviewData.BillingAddress.CityEnabled && vmorder.OrderReviewData.BillingAddress.StateProvinceEnabled && vmorder.OrderReviewData.BillingAddress.ZipPostalCodeEnabled">
<li class="city-state-zip">
- <template v-if="vmorder.cart.OrderReviewData.BillingAddress.CityEnabled">
- {{vmorder.cart.OrderReviewData.BillingAddress.City}}
+ <template v-if="vmorder.OrderReviewData.BillingAddress.CityEnabled">
+ {{vmorder.OrderReviewData.BillingAddress.City}}
</template>
- <template v-if="vmorder.cart.OrderReviewData.BillingAddress.CityEnabled && (vmorder.cart.OrderReviewData.BillingAddress.StateProvinceEnabled || vmorder.cart.OrderReviewData.BillingAddress.ZipPostalCodeEnabled)">
+ <template v-if="vmorder.OrderReviewData.BillingAddress.CityEnabled && (vmorder.OrderReviewData.BillingAddress.StateProvinceEnabled || vmorder.OrderReviewData.BillingAddress.ZipPostalCodeEnabled)">
,
</template>
- <template v-if="vmorder.cart.OrderReviewData.BillingAddress.StateProvinceEnabled">
- {{vmorder.cart.OrderReviewData.BillingAddress.StateProvinceName}}
+ <template v-if="vmorder.OrderReviewData.BillingAddress.StateProvinceEnabled">
+ {{vmorder.OrderReviewData.BillingAddress.StateProvinceName}}
</template>
-
- <template v-if="vmorder.cart.OrderReviewData.BillingAddress.ZipPostalCodeEnabled">
- {{vmorder.cart.OrderReviewData.BillingAddress.ZipPostalCode}}
+ <template v-if="vmorder.OrderReviewData.BillingAddress.ZipPostalCodeEnabled">
+ {{vmorder.OrderReviewData.BillingAddress.ZipPostalCode}}
</template>
</li>
</template>
- <li class="country" v-if="vmorder.cart.OrderReviewData.BillingAddress.CountryEnabled && vmorder.cart.OrderReviewData.BillingAddress.CountryName !== null">
- {{vmorder.cart.OrderReviewData.BillingAddress.CountryName}}
+ <li class="country" v-if="vmorder.OrderReviewData.BillingAddress.CountryEnabled && vmorder.OrderReviewData.BillingAddress.CountryName !== null">
+ {{vmorder.OrderReviewData.BillingAddress.CountryName}}
</li>
- <li class="custom-attributes-view" v-if="vmorder.cart.OrderReviewData.BillingAddress.FormattedCustomAddressAttributes">
- <div v-html="vmorder.cart.OrderReviewData.BillingAddress.FormattedCustomAddressAttributes"></div>
+ <li class="custom-attributes-view" v-if="vmorder.OrderReviewData.BillingAddress.FormattedCustomAddressAttributes">
+ <div v-html="vmorder.OrderReviewData.BillingAddress.FormattedCustomAddressAttributes"></div>
</li>
- <template v-if="vmorder.cart.OrderReviewData.PaymentMethod !== null">
+ <template v-if="vmorder.OrderReviewData.PaymentMethod !== null">
<li class="title">
<h5>@Loc["Order.Payment"]</h5>
</li>
@@ -59,82 +58,82 @@
@Loc["Order.Payment.Method"]:
</span>
<span class="value">
- {{vmorder.cart.OrderReviewData.PaymentMethod}}
+ {{vmorder.OrderReviewData.PaymentMethod}}
</span>
</li>
</template>
</ul>
</div>
</div>
- <div class="card" v-if="vmorder.cart.OrderReviewData.IsShippable" title="@Loc["Order.ShippingAddress"]">
+ <div class="card" v-if="vmorder.OrderReviewData.IsShippable" title="@Loc["Order.ShippingAddress"]">
<div class="card-body">
<ul class="shipping-info pl-0">
- <template v-if="!vmorder.cart.OrderReviewData.SelectedPickUpInStore">
+ <template v-if="!vmorder.OrderReviewData.SelectedPickUpInStore">
<li class="name">
- {{vmorder.cart.OrderReviewData.ShippingAddress.FirstName}} {{vmorder.cart.OrderReviewData.ShippingAddress.LastName}}
+ {{vmorder.OrderReviewData.ShippingAddress.FirstName}} {{vmorder.OrderReviewData.ShippingAddress.LastName}}
</li>
<li class="email">
- <span>@Loc["Order.Email"]:</span> {{vmorder.cart.OrderReviewData.ShippingAddress.Email}}
+ <span>@Loc["Order.Email"]:</span> {{vmorder.OrderReviewData.ShippingAddress.Email}}
</li>
- <li class="phone" v-if="vmorder.cart.OrderReviewData.ShippingAddress.PhoneEnabled">
- <span>@Loc["Order.Phone"]:</span> {{vmorder.cart.OrderReviewData.ShippingAddress.PhoneNumber}}
+ <li class="phone" v-if="vmorder.OrderReviewData.ShippingAddress.PhoneEnabled">
+ <span>@Loc["Order.Phone"]:</span> {{vmorder.OrderReviewData.ShippingAddress.PhoneNumber}}
</li>
- <li class="fax" v-if="vmorder.cart.OrderReviewData.ShippingAddress.FaxEnabled">
- <span>@Loc["Order.Fax"]:</span> {{vmorder.cart.OrderReviewData.ShippingAddress.FaxNumber}}
+ <li class="fax" v-if="vmorder.OrderReviewData.ShippingAddress.FaxEnabled">
+ <span>@Loc["Order.Fax"]:</span> {{vmorder.OrderReviewData.ShippingAddress.FaxNumber}}
</li>
- <li class="company" v-if="vmorder.cart.OrderReviewData.ShippingAddress.CompanyEnabled && vmorder.cart.OrderReviewData.ShippingAddress.Company !== null">
- {{vmorder.cart.OrderReviewData.ShippingAddress.Company}}
+ <li class="company" v-if="vmorder.OrderReviewData.ShippingAddress.CompanyEnabled && vmorder.OrderReviewData.ShippingAddress.Company !== null">
+ {{vmorder.OrderReviewData.ShippingAddress.Company}}
</li>
- <li class="address1" v-if="vmorder.cart.OrderReviewData.ShippingAddress.StreetAddressEnabled">
- {{vmorder.cart.OrderReviewData.ShippingAddress.Address1}}
+ <li class="address1" v-if="vmorder.OrderReviewData.ShippingAddress.StreetAddressEnabled">
+ {{vmorder.OrderReviewData.ShippingAddress.Address1}}
</li>
- <li class="address2" v-if="vmorder.cart.OrderReviewData.ShippingAddress.StreetAddress2Enabled && vmorder.cart.OrderReviewData.ShippingAddress.Address2 !== null">
- {{vmorder.cart.OrderReviewData.ShippingAddress.Address2}}
+ <li class="address2" v-if="vmorder.OrderReviewData.ShippingAddress.StreetAddress2Enabled && vmorder.OrderReviewData.ShippingAddress.Address2 !== null">
+ {{vmorder.OrderReviewData.ShippingAddress.Address2}}
</li>
- <template v-if="vmorder.cart.OrderReviewData.ShippingAddress.CityEnabled && vmorder.cart.OrderReviewData.ShippingAddress.StateProvinceEnabled && vmorder.cart.OrderReviewData.ShippingAddress.ZipPostalCodeEnabled">
+ <template v-if="vmorder.OrderReviewData.ShippingAddress.CityEnabled && vmorder.OrderReviewData.ShippingAddress.StateProvinceEnabled && vmorder.OrderReviewData.ShippingAddress.ZipPostalCodeEnabled">
<li class="city-state-zip">
- <template v-if="vmorder.cart.OrderReviewData.ShippingAddress.CityEnabled">
- {{vmorder.cart.OrderReviewData.ShippingAddress.City}}
+ <template v-if="vmorder.OrderReviewData.ShippingAddress.CityEnabled">
+ {{vmorder.OrderReviewData.ShippingAddress.City}}
</template>
- <template v-if="vmorder.cart.OrderReviewData.ShippingAddress.CityEnabled && (vmorder.cart.OrderReviewData.ShippingAddress.StateProvinceEnabled || vmorder.cart.OrderReviewData.ShippingAddress.ZipPostalCodeEnabled)">
+ <template v-if="vmorder.OrderReviewData.ShippingAddress.CityEnabled && (vmorder.OrderReviewData.ShippingAddress.StateProvinceEnabled || vmorder.OrderReviewData.ShippingAddress.ZipPostalCodeEnabled)">
,
</template>
- <template v-if="vmorder.cart.OrderReviewData.ShippingAddress.StateProvinceEnabled">
- {{vmorder.cart.OrderReviewData.ShippingAddress.StateProvinceName}}
+ <template v-if="vmorder.OrderReviewData.ShippingAddress.StateProvinceEnabled">
+ {{vmorder.OrderReviewData.ShippingAddress.StateProvinceName}}
</template>
- <template v-if="vmorder.cart.OrderReviewData.ShippingAddress.ZipPostalCodeEnabled">
- {{vmorder.cart.OrderReviewData.ShippingAddress.ZipPostalCode}}
+ <template v-if="vmorder.OrderReviewData.ShippingAddress.ZipPostalCodeEnabled">
+ {{vmorder.OrderReviewData.ShippingAddress.ZipPostalCode}}
</template>
</li>
</template>
- <li class="country" v-if="vmorder.cart.OrderReviewData.ShippingAddress.CountryName && vmorder.cart.OrderReviewData.ShippingAddress.CountryName !== null">
- {{vmorder.cart.OrderReviewData.ShippingAddress.CountryName}}
+ <li class="country" v-if="vmorder.OrderReviewData.ShippingAddress.CountryName && vmorder.OrderReviewData.ShippingAddress.CountryName !== null">
+ {{vmorder.OrderReviewData.ShippingAddress.CountryName}}
</li>
- <li class="custom-attributes-view" v-if="!vmorder.cart.OrderReviewData.ShippingAddress.FormattedCustomAddressAttributes !== null">
- <div v-html="vmorder.cart.OrderReviewData.ShippingAddress.FormattedCustomAddressAttributes"></div>
+ <li class="custom-attributes-view" v-if="!vmorder.OrderReviewData.ShippingAddress.FormattedCustomAddressAttributes !== null">
+ <div v-html="vmorder.OrderReviewData.ShippingAddress.FormattedCustomAddressAttributes"></div>
</li>
</template>
<template v-else>
<li class="title">
<h5>@Loc["Order.PickupAddress"]</h5>
</li>
- <li class="address1" v-if="vmorder.cart.OrderReviewData.PickupAddress.Address1 !== null">
- {{vmorder.cart.OrderReviewData.PickupAddress.Address1}}
+ <li class="address1" v-if="vmorder.OrderReviewData.PickupAddress.Address1 !== null">
+ {{vmorder.OrderReviewData.PickupAddress.Address1}}
</li>
- <li class="city-state-zip" v-if="vmorder.cart.OrderReviewData.ShippingAddress.City || !vmorder.cart.OrderReviewData.ShippingAddress.ZipPostalCode !== null">
- <template v-if="!vmorder.cart.OrderReviewData.PickupAddress.City !== null">
- {{vmorder.cart.OrderReviewData.PickupAddress.City}}
+ <li class="city-state-zip" v-if="vmorder.OrderReviewData.ShippingAddress.City || !vmorder.OrderReviewData.ShippingAddress.ZipPostalCode !== null">
+ <template v-if="!vmorder.OrderReviewData.PickupAddress.City !== null">
+ {{vmorder.OrderReviewData.PickupAddress.City}}
</template>
- <template v-if="!vmorder.cart.OrderReviewData.PickupAddress.City !== null">
- {{vmorder.cart.OrderReviewData.PickupAddress.City}}
+ <template v-if="!vmorder.OrderReviewData.PickupAddress.City !== null">
+ {{vmorder.OrderReviewData.PickupAddress.City}}
</template>
- <template v-if="!vmorder.cart.OrderReviewData.PickupAddress.ZipPostalCode !== null">
- , {{vmorder.cart.OrderReviewData.PickupAddress.ZipPostalCode}}
+ <template v-if="!vmorder.OrderReviewData.PickupAddress.ZipPostalCode !== null">
+ , {{vmorder.OrderReviewData.PickupAddress.ZipPostalCode}}
</template>
</li>
- <li class="country" v-if="!vmorder.cart.OrderReviewData.PickupAddress.CountryName !== null">
- {{vmorder.cart.OrderReviewData.PickupAddress.CountryName}}
+ <li class="country" v-if="!vmorder.OrderReviewData.PickupAddress.CountryName !== null">
+ {{vmorder.OrderReviewData.PickupAddress.CountryName}}
</li>
</template>
<li class="title">
@@ -145,10 +144,10 @@
@Loc["Order.Shipping.Name"]:
</span>
<span class="value">
- {{vmorder.cart.OrderReviewData.ShippingMethod}}
+ {{vmorder.OrderReviewData.ShippingMethod}}
</span>
- <template v-if="!vmorder.cart.OrderReviewData.ShippingAdditionDescription !== null">
- <div v-html="vmorder.cart.OrderReviewData.ShippingAdditionDescription"></div>
+ <template v-if="!vmorder.OrderReviewData.ShippingAdditionDescription !== null">
+ <div v-html="vmorder.OrderReviewData.ShippingAdditionDescription"></div>
</template>
</li>
</ul>
diff --git a/src/Web/Grand.Web/Views/Checkout/_Summary.cshtml b/src/Web/Grand.Web/Views/Checkout/_Summary.cshtml
index daf872401..55728772a 100644
--- a/src/Web/Grand.Web/Views/Checkout/_Summary.cshtml
+++ b/src/Web/Grand.Web/Views/Checkout/_Summary.cshtml
@@ -5,7 +5,7 @@
<div class="order-summary-content mt-3" id="ordersummarypagecart" v-if="vmorder.cart">
@await Component.InvokeAsync("Widget", new { widgetZone = "checkout_summary_content_before" })
<div v-if="typeof vmorder.cart.Items !== 'undefined' && vmorder.cart.Items.length > 0">
- <template v-if="vmorder.cart.OrderReviewData.Display && vmorder.Confirm">
+ <template v-if="vmorder.OrderReviewData && vmorder.Confirm">
<partial name="_ReviewData" />
</template>
<ul v-if="typeof vmorder.cart.Warnings !== 'undefined' && vmorder.cart.Warnings.length > 0" class="px-0 mb-3">
diff --git a/src/Web/Grand.Web/Views/ShoppingCart/_ModelScript.cshtml b/src/Web/Grand.Web/Views/ShoppingCart/_ModelScript.cshtml
index ae67bcfcb..02258a75e 100644
--- a/src/Web/Grand.Web/Views/ShoppingCart/_ModelScript.cshtml
+++ b/src/Web/Grand.Web/Views/ShoppingCart/_ModelScript.cshtml
@@ -32,6 +32,7 @@
body.classList.add("cart-view");
},
updateCart() {
+ alert('updatecart');
axios({
baseURL: '@Url.RouteUrl("ShoppingCartSummary")',
method: 'get',
diff --git a/src/Web/Grand.Web/wwwroot/theme/script/public.checkout.js b/src/Web/Grand.Web/wwwroot/theme/script/public.checkout.js
index cd5d43895..cd205cef1 100644
--- a/src/Web/Grand.Web/wwwroot/theme/script/public.checkout.js
+++ b/src/Web/Grand.Web/wwwroot/theme/script/public.checkout.js
@@ -37,6 +37,7 @@ var vmorder = new Vue({
// payment info
PaymentViewComponentName: null,
// confirm order
+ OrderReviewData: null,
MinOrderTotalWarning: null,
TermsOfServiceOnOrderConfirmPage: null,
ConfirmWarnings: null,
@@ -106,6 +107,17 @@ var vmorder = new Vue({
button.classList.remove('disabled');
}, 600);
},
+ vmShipping() {
+ this.vShipping = {
+ form: false,
+ saveUrl: false,
+
+ init: function (form, saveUrl) {
+ this.form = form;
+ this.saveUrl = saveUrl;
+ },
+ }
+ },
vmCheckout() {
this.Checkout = {
loadWaiting: false,
@@ -249,9 +261,7 @@ var vmorder = new Vue({
}
}).then(function () {
document.querySelector(".payment-info-next-step-button").classList.remove("disabled");
- });
-
- this.updateOrderSummary(false);
+ });
vmorder.updateTotals();
}
@@ -259,10 +269,8 @@ var vmorder = new Vue({
var model = response.data.update_section.model;
vmorder.MinOrderTotalWarning = model.MinOrderTotalWarning;
vmorder.ConfirmWarnings = model.Warnings;
-
+ vmorder.OrderReviewData = model.OrderReviewData;
vmorder.Confirm = true;
-
- this.updateOrderSummary(true);
vmorder.updateTotals();
}
@@ -292,19 +300,6 @@ var vmorder = new Vue({
}
return false;
},
- updateOrderSummary: function (displayOrderReviewData) {
- axios({
- baseURL: '/cart/summary?prepareAndDisplayOrderReviewData='+displayOrderReviewData,
- method: 'get',
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json',
- 'X-Response-View': 'Json'
- }
- }).then(response => {
- vmorder.cart.OrderReviewData = response.data.OrderReviewData
- });
- },
};
},
vmShipping() {