Posted on 25/03/2019 11:10:58
Hi,
I have a service to add products to cart and we are using price module for product prices. I am adding orderlines like this
var builderConfig = new OrderLineBuilderConfig { ProductId = product.ProductID, Quantity = double.Parse(product.Quantity), UnitId = "", AddToCart = true, };
OrderLine ol = orderLineService.OrderLineBuilder(order, builderConfig);
orderLineService.Save(ol);
and getting the following error. DW version 9.5.6
<Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>
Object reference not set to an instance of an object.
</ExceptionMessage>
<ExceptionType>System.NullReferenceException</ExceptionType>
<StackTrace>
at Dynamicweb.Ecommerce.Prices.PriceInfo.Add(IPriceInfo info) at Dynamicweb.Ecommerce.Prices.PriceInfo.Add(IPriceReferenceInfo info) at Dynamicweb.Ecommerce.Orders.OrderLine.get_UnitPrice() at Dynamicweb.Ecommerce.Orders.OrderLine.get_Price() at Dynamicweb.Ecommerce.Orders.OrderLineRepository.Save(OrderLine orderline, DataRow dataRow) at Dynamicweb.Ecommerce.Orders.OrderLineRepository.Save(OrderLine orderLine) at Dynamicweb.Ecommerce.Orders.OrderLineService.Save(OrderLine orderLine) at Controllers.WebApi.designerController.Dealer(RecievedData Data) in C:\Solutions\Website\Controllers\WebApi\designerController.cs:line 199 at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 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.ExceptionServices.ExceptionDispatchInfo.Throw() 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.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()
</StackTrace>
</Error>