November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
nik2911 ,
you don't have to create a new thread for same problem. I will delete your other (older) thread.
This look like you didn't set the price for the lineitem. You should call cart.UpdatePlacedPriceOrRemoveLineItems(), or even better OrderValidationService.ValidateOrder
Also you should not use PurchaseOrderManager.RemoveLineItemFromOrder to remove the lineitem, just remove it from Shipment.LineItems
Even after setting the price to the LineItem I get the following error
at EPiServer.Commerce.Marketing.Internal.MoneyExtensions.ThrowIfNegative(Money money, String validationErrorMessage)
at EPiServer.Commerce.Order.Calculator.DefaultOrderGroupCalculator.ValidateTotal(Money money)
at EPiServer.Commerce.Order.Calculator.DefaultOrderGroupCalculator.GetTotal(IOrderGroup orderGroup)
at EPiServer.Commerce.Order.Calculator.DefaultOrderGroupCalculator.GetOrderGroupTotals(IOrderGroup orderGroup)
at EPiServer.Commerce.Order.OrderGroupExtensions.CalculateTotals(OrderGroup orderGroup, IOrderGroupCalculator orderGroupCalculator, ReferenceConverter referenceConverter, IContentLoader contentLoader, ICatalogSystem catalogSystem, IRelationRepository relationRepository, LanguageResolver languageResolver)
at EPiServer.Commerce.Order.Internal.CartProvider.Save(ICart cart)
at EPiServer.Commerce.Order.Internal.DefaultOrderRepository.Save(IOrderGroup order)
at SnS.Infrastructure.Services.Implementations.CartService.SaveCartChanges(ICart cart)
at SnS.Infrastructure.Services.Implementations.CartService.UpdateCart(IEnumerable`1 cartDetails)
at SnS.Infrastructure.ApiControllers.CartController.<UpdateCart>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__3`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()
We use custom price logic and we have order promotions applied to the cart also. Does this have any impact?
Once the promotions are removed and tested the products quantity are updating appropriately.Kindly help resolving this issue.
Hi,
When i update the qunatity of a line item, the following error occurs on saving the cart. This product is provided with valid quantity and price but still this error occurs:
"Invalid order group total calculation"
The following code is used for updating the cart:
var lineItem = GetLineItem(cartDetail.Code);
if (lineItem != null)
{
status.Success = true;
if (cartDetail.Quantity > 0)
{
lineItem.Quantity = cartDetail.Quantity;
}
else
{
PurchaseOrderManager.RemoveLineItemFromOrder(Cart as OrderGroup, lineItem.LineItemId);
}
lineItem.SetCustomField(MetaFieldNames.LineComment, cartDetail.LineComment);
}
else
{
status.WarningMessage = "Can't find product with code " + cartDetail.Code;
updateActionStatus.Success = false;
}
updateActionStatus.CartActionStatuses.Add(status);
orderRepository.Save(cart);
Please help in resolving this issue.
Commerce Version Used : 13.7.1
Thanks in Advance.