I think I found the issue… in GetPriceLists()
I use _requestModelAccessor.RequestModel?.ChannelModel?.Channel
to check the current channel and when the call comes from Cart.SetChannel
(see the stack trace below to see the call stack) the _requestModelAccessor.RequestModel
is null which cause the issue. I think I will change to fetch the current channel from either the orderCarrier or store it in the http session from ControllerBase.
The call stack:
vid Litium.Accelerator.Mvc.Routing.PriceCalculatorDecorator.GetPriceLists(PriceCalculatorArgs calculatorArgs) i Src\\Litium.Accelerator.Mvc\\Routing\\PriceCalculatorDecorator.cs:rad 42
vid Litium.Accelerator.Mvc.Routing.PriceCalculatorDecorator.GetListPrices(PriceCalculatorArgs calculatorArgs, PriceCalculatorItemArgs[] itemArgs) i Src\\Litium.Accelerator.Mvc\\Routing\\PriceCalculatorDecorator.cs:rad 33
vid Litium.Foundation.Modules.ECommerce.Plugins.Orders.OrderRowFactory.GetProductCatalogEntities(ShoppingCartItemCarrier shoppingCartCarrier, Guid websiteId, Guid currencyId, Guid customerId, SecurityToken token, PriceCalculatorResult& listPriceResult, Guid countryId)
vid Litium.Foundation.Modules.ECommerce.Plugins.Orders.OrderRowFactory.Create(ShoppingCartItemCarrier shoppingCartRow, Guid websiteId, Guid currencyId, Guid customerId, Guid countryId, SecurityToken token)
vid Litium.Foundation.Modules.ECommerce.ShoppingCarts.Cart.SetProductUnitListPrices(OrderCarrier orderCarrier, SecurityToken token)
vid Litium.Foundation.Modules.ECommerce.ShoppingCarts.Cart.SetChannel(Channel channel, Country country, SecurityToken securityToken)
vid Litium.Accelerator.Mvc.Controllers.ControllerBase.Initialize(RequestContext requestContext) i Src\\Litium.Accelerator.Mvc\\Controllers\\ControllerBase.cs:rad 41
vid System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state)\r\n vid System.Web.Mvc.MvcHandler.<>c.<BeginProcessRequest>b__20_0(AsyncCallback asyncCallback, Object asyncState, ProcessRequestState innerState)
vid System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState)
vid System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout)
vid System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
vid Litium.Web.Mvc.Routing.MvcPageHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
vid System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
vid System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
vid System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
vid System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
vid System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
vid System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
vid System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
vid System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
vid System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)
vid System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)
vid System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
vid System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)