Hi! I'm having some problems on payment error when re-rendering the cart. I get a null value exception in the checkout handler when using:
string message = GeneralFunctions.AddTransaction(order, customer, int.Parse(EstoreID), Secret, int.Parse(campaignId), Url); int transactionNumber = -1; if (!int.TryParse(message, out transactionNumber)) { var formErrorTemplate = new Template("eCom7/CartV2/Step/ShowCart.html"); formErrorTemplate.SetTag("Softgear:Klarna:Error", message); var orderRenderer = new Dynamicweb.eCommerce.Frontend.Renderer(); orderRenderer.RenderOrder(order, formErrorTemplate); //<-- Exception return formErrorTemplate.Output(); }
I have traced it down to us listing related products in the cart, if I remove all related products everything is ok.
We have something similar to this in the cart:
<!--@LoopStart(OrderLines)--> <!--@LoopStart(ProductRelatedGroups)--> <!--@LoopStart(Products)--> <span class="col1"><img src="/admin/public/getimage.aspx?Image=<!--@Ecom:Product.ImageSmall.Default.Clean-->&Format=jpg&Width=40&Height=40&Crop=5" alt="image description" /></span> <span class="col2"><strong><!--@Ecom:Product.Name--></strong></span> <span class="col3"><strong><!--@Ecom:Product.Price.Price--> <span><!--@Translate(kr, "kr", Global)--></span></strong></span> <!--@LoopEnd(Products)--> <!--@LoopEnd(ProductRelatedGroups)--> <!--@LoopEnd(OrderLines)-->
The exception:
at Dynamicweb.eCommerce.Frontend.Renderer.RenderProductRelatedGroups(Product product, Template parentTemplate, String loopName) at Dynamicweb.eCommerce.Frontend.Renderer.RenderProduct(Product Product, Boolean ExtendedProperties, Template Template, Int32 loopCounter, Boolean renderRelated, String productURL) at Dynamicweb.eCommerce.Frontend.Renderer.RenderProduct(Product Product, Boolean ExtendedProperties, Template Template, Int32 loopCounter, Boolean renderRelated) at Dynamicweb.eCommerce.Frontend.Renderer.RenderProduct(Product Product, Boolean ExtendedProperties, Template Template, Int32 loopCounter) at Dynamicweb.eCommerce.Frontend.Renderer.RenderProduct(Product Product, Boolean ExtendedProperties, Template Template) at Dynamicweb.eCommerce.Frontend.Renderer.RenderOrderLine(OrderLine OrderLine, Template Template) at Dynamicweb.eCommerce.Frontend.Renderer.RenderOrderLines(OrderLineCollection OrderLines, Template ParentTemplate, String LoopName) at Dynamicweb.eCommerce.Frontend.Renderer.RenderOrderLine(OrderLine OrderLine, Template Template) at Dynamicweb.eCommerce.Frontend.Renderer.RenderOrderLines(OrderLineCollection OrderLines, Template ParentTemplate, String LoopName) at Dynamicweb.eCommerce.Frontend.Renderer.RenderOrderDetails(Template template, Order order, Boolean extendedProperties, OrderContext OrderContext) at Dynamicweb.eCommerce.Frontend.Renderer.RenderOrder(Order Order, Template Template, Boolean ExtendedProperties, Int32 stepReq, OrderContext OrderContext) at Dynamicweb.eCommerce.Frontend.Renderer.RenderOrder(Order Order, Template Template)