Error executing template "Designs/Plus/_parsed/Dw_AddToBasketOverlay.parsed.cshtml"System.NullReferenceException: Objektreferencen er ikke indstillet til en forekomst af et objekt.ved CompiledRazorTemplates.Dynamic.RazorEngine_96cb47f0a2344855afec880d59352a27.Execute() i C:\inetpub\wwwroot\plus-live\Files\Templates\Designs\Plus\_parsed\Dw_AddToBasketOverlay.parsed.cshtml:linje 12ved RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)ved RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)ved RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)ved RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)ved Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @using Dynamicweb.Ecommerce.Orders 2 @using Dynamicweb.Ecommerce.Common 3 @using Dynamicweb.Ecommerce 4 @using System.Web; 5 @using Plus.CustomModules.AddMultipleProducts; 6 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7 8 @{ 9 string basketLink = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("default.aspx?id=" + GetString("Item.Area.CartPageId")); 10 string hidePrices = Pageview.Area.Item["Hide_Prices"].ToString(); 11 12 var prods = HttpContext.Current.Request.QueryString["products"].Split(',').ToList(); 13 var quantities = HttpContext.Current.Request.QueryString["quantities"].Split(',').ToList(); 14 15 MultiAdd.Addmulti(prods, quantities); 16 //Order cart; 17 //if (Dynamicweb.Ecommerce.Common.Context.Cart != null) 18 //{ 19 // cart = Dynamicweb.Ecommerce.Common.Context.Cart; 20 //} 21 //else 22 //{ 23 // cart = new Order(); 24 // Dynamicweb.Ecommerce.Common.Context.SetCart(cart); 25 //} 26 27 //for (int i = 0; i < prods.Count; i++) 28 //{ 29 // var builderConfig = new OrderLineBuilderConfig { ProductId = prods[i], Quantity = double.Parse(quantities[i]), AddToCart = true }; 30 // cart.OrderLineBuilder(builderConfig); 31 // cart.CalculateDiscounts(); 32 // cart.Save(); 33 34 //} 35 double totalAddedPrice = 0; 36 } 37 <!--Her skal være noget AJAX til at opdater kurv i header--> 38 39 <section class="overlay-products-added"> 40 <header class="overlay-products-added__header"> 41 <h3 class="heading heading--fw-element">@Translate("Følgende er tilføjet til indkøbslisten", "Følgende er tilføjet til indkøbslisten")</h3> 42 </header> 43 <table class="products-table"> 44 <thead> 45 <tr class="products-table__row products-table__row--head"> 46 <th class="products-table__cell products-table__cell--amount">@Translate("Antal", "Antal")</th> 47 <th class="products-table__cell products-table__cell--product">@Translate("Produkter", "Produkter")</th> 48 @if (hidePrices == "False") 49 { 50 <th class="products-table__cell products-table__cell--price">@Translate("Vejledende priser fra", "Vejledende priser fra")</th> 51 } 52 </tr> 53 </thead> 54 <tbody> 55 56 57 @for (int i = 0; i < prods.Count; i++) 58 { 59 var prod = Dynamicweb.Ecommerce.Products.Product.GetProductById(prods[i]); 60 totalAddedPrice += (prod.Price.PriceWithoutVAT * double.Parse(quantities[i])); 61 62 <tr class="products-table__row"> 63 <td class="products-table__cell products-table__cell--amount" data-header="Antal">@quantities[i] @Translate("stk.", "stk.")</td> 64 <td class="products-table__cell products-table__cell--product">@prod.Name</td> 65 @if (hidePrices == "False") 66 { 67 <td class="products-table__cell products-table__cell--price"> 68 <div class="price price--products-table"> 69 70 <span class="price__unit">@Translate("DKK", "DKK")</span> 71 <span class="price__price">@prod.Price.PriceWithoutVATFormattedNoSymbol</span> 72 </div> 73 </td> 74 } 75 </tr> 76 } 77 @if (hidePrices == "False") 78 { 79 <tr class="products-table__row products-table__row--sum"> 80 <td class="products-table__cell products-table__cell--sum" colspan="3"> 81 <div class="price price--products-table-sum"> 82 <div class="price__header">@Translate("I alt", "I alt")</div> 83 <span class="price__unit">@Translate("DKK", "DKK")</span> 84 <span class="price__price">@Math.Round(totalAddedPrice, 2)</span> 85 </div> 86 </td> 87 </tr> 88 } 89 </tbody> 90 </table> 91 <div class="overlay-products-added__buttons"> 92 <a class="button button--overlay-products-added" href="@basketLink" title="" property="url"> 93 <span class="button__text">@Translate("Gå til indkøbslisten", "Gå til indkøbslisten")</span> 94 </a> 95 </div> 96 <div id="content">@GetValue("DwContent(content)")</div> 97 </section>