Posted on 22/01/2016 03:27:12
Hi,
I've tried to reproduce the problem, but get exception on the start of your code:
System.NullReferenceException: Object reference not set to an instance of an object. at Dynamicweb.eCommerce.Orders.OrderLine.set_Product(Product Value) in E:\dynamicweb.net\Dynamicweb\Dynamicweb\eCommerce\Orders\OrderLine.vb:line 219 at Dynamicweb.eCommerce.Cart.CheckoutHandlers.QuickPayPaymentWindow.StartCheckout(Order order) in e:\dynamicweb.net\Dynamicweb\Dynamicweb.eCommerce.Cart.CheckoutHandlers\QuickPayPaymentWindow.cs:line 184 at Dynamicweb.eCommerce.Cart.Frontend.RenderCheckoutStep(Order order, Int32 stepIndex) in E:\dynamicweb.net\Dynamicweb\Dynamicweb\eCommerce\Cart\Frontend.vb:line 1246 at Dynamicweb.eCommerce.Cart.Frontend.GetContent() in E:\dynamicweb.net\Dynamicweb\Dynamicweb\eCommerce\Cart\Frontend.vb:line 246
That exception happened on setting orderline.Product equal to NULL, I have no idea how you dodged this.
I actually get same situation that you have but only when Context.Cart is present and contains orderlines with type product and if those orderline has not related to order I.e. orderLine.Order == null. I am not sure that it is a bug, if yes we will fix it.
Anyway you can escape the exception by simple refering to the order on creating of orderlines:
var Cart = Context.Cart ?? new Order();
var line = new OrderLine();
line.Product = null;
line.ProductName = "Modul test.";
line.ProductNumber = "0001";
line.ProductID = "0";
line.SetUnitPrice(100);
line.SetOrderLineType(OrderLine.OrderLineType.Fixed);
line.Quantity = 1;
line.ProductVariantText = "Beskrivelse.";
line.Order = Cart ;
Cart.OrderLines.Add(line);
Cart.ClearCachedPrices();
Context.SetCart(Cart);
Best regards,Viktor Letavin
DynamicWEB Software A/S, Russian team