We have a situation where a salesperson can create a quote for a user with items that are outside the assortment of the user, and the user should then be able to accept the quote with these items.
When impersonating we can give the salesperson access to items from outside the user's assortment with this subscriber: AssortmentsCalculateUserAssortments, but when the user is going to accept the quote, we cannot figure out have to avoid having these products removed.
My thought is to be able to cancel the remove handling in: RemoveNoneActiveProducts before the line is actually removed. Current snippet from the function
If doRemove Then order.OrderLines.Remove(productLine) Services.OrderLines.Delete(productLine.Id) Services.Carts.NotifyCartLineRemoved(productLine, order, True) End If
A second thought would be to know before a cart is loaded in the following section in: LoadCart:
Services.Carts.SetCurrentCart(cart, user, orderContext) 'Remove cached prices Services.Orders.ClearCachedPrices(cart) 'Check if all the products are still available Services.Orders.RemoveNoneActiveProducts(cart, user, orderContext, Common.Context.StockLocation) NotificationManager.Notify(Notifications.Ecommerce.Cart.InitiallyLoaded, New Notifications.Ecommerce.Cart.InitiallyLoadedArgs(cart))
Because then we can set a flag in the context and remove it again in: Notifications.Ecommerce.Cart.InitiallyLoaded, a by this flag we can in the AssortmentsCalculateUserAssortments-subscriber extend the user's assortment a aviod having the products removed.
Please let me know your thoughts about this?
Best regards, Anders