Exception in template (Designs/sacbiler.dk/_parsed/sacContentPage.parsed.cshtml): System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.aedcedcfbcadbfccaf.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag)
   at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
   at Dynamicweb.Rendering.Template.Output()
@using System @using System.Web @using System.Text.RegularExpressions @using System.Web @functions{ public class WrapMethods { //Gets the contrasting color public static string getContrastYIQ(string hexcolor) { if (hexcolor != "") { hexcolor = Regex.Replace(hexcolor, "[^0-9a-zA-Z]+", ""); int r = Convert.ToByte(hexcolor.Substring(0, 2), 16); int g = Convert.ToByte(hexcolor.Substring(2, 2), 16); int b = Convert.ToByte(hexcolor.Substring(4, 2), 16); int yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; if (yiq >= 128) { return "black"; } else { return "white"; } } else { return "black"; } } //Truncate text public static string Truncate (string value, int count, bool strip=true) { if (strip == true){ value = StripHtmlTagByCharArray(value); } if (value.Length > count) { value = value.Substring(0, count - 1) + "..."; } return value; } //Strip text from HTML public static string StripHtmlTagByCharArray(string htmlString) { char[] array = new char[htmlString.Length]; int arrayIndex = 0; bool inside = false; for (int i = 0; i < htmlString.Length; i++) { char let = htmlString[i]; if (let == '<') { inside = true; continue; } if (let == '>') { inside = false; continue; } if (!inside) { array[arrayIndex] = let; arrayIndex++; } } return new string(array, 0, arrayIndex); } //Make the correct count of columns public static string ColumnMaker(int Col, string ScreenSize) { string Columns = ""; switch (Col) { case 1: Columns = "col-"+ScreenSize+"-12"; break; case 2: Columns = "col-"+ScreenSize+"-6"; break; case 3: Columns = "col-"+ScreenSize+"-4"; break; case 4: Columns = "col-"+ScreenSize+"-3"; break; default: Columns = "col-"+ScreenSize+"-3"; break; } return Columns; } private string Custom(string firstoption, string secondoption) { if (firstoption == "custom") { return secondoption; } else { return firstoption; } } } } @using System.Globalization @helper MiniCartCompleteCost() { <div class="dropdown-cart"> @if (GetInteger("Ecom:Order.OrderLines.TotalProductQuantity") > 0) { <div class="col-md-12 col-sm-12 col-xs-12"> <div class="row"> <span class="cart-items">@Translate("You have", "You have")<strong> @GetValue("Ecom:Order.OrderLines.TotalProductQuantity")</strong> @Translate("items in your cart", "items in your cart")</span> <table class="table table-cart"> <tbody> <tr> <!-- <th></th> --> <th>@Translate("Product", "Product")</th> <th class="text-center">@Translate("Qty", "Qty")</th> <th style="text-align: right;">@Translate("Total", "Total")</th> </tr> @foreach (LoopItem orderline in GetLoop("OrderLines")) { var image = orderline.GetString("Ecom:Product.ImageLarge.Clean"); <tr> <!-- <td><img src="/Admin/Public/GetImage.ashx?width=50&image=@image&Compression=99" class="img-center hidden" alt=""></td> --> <td>@orderline.GetValue("Ecom:Order:OrderLine.ProductName")<br><small>@orderline.GetString("Ecom:Order:OrderLine.ProductVariantText")</small></td> <td class="text-center">@orderline.GetString("Ecom:Order:OrderLine.Quantity")</td> <td> <nobr> @if(orderline.GetInteger("Ecom:Order:OrderLine.Points")>0){ @orderline.GetDouble("Ecom:Order:OrderLine.Points"); <text> </text>@Translate("orderline_points","points") }else{ @*@orderline.GetValue("Ecom:Order:olPrice.PriceWithVATFormatted")*@ <span class="pull-right"> @orderline.GetValue("Ecom:Order:olPrice.PriceWithoutVATFormatted") </span> } </nobr> </td> </tr> } @* <tr> <td class="text-center"><i class="fa fa-credit-card"></i></td> <td>@GetValue("Ecom:Order.PaymentMethod")</td> <td class="text-center"></td> <td>@GetValue("Ecom:Order.PaymentFee")</td> </tr> <tr> <td class="text-center"><i class="fa fa-truck"></i></td> <td>@GetValue("Ecom:Order.ShippingMethod")</td> <td class="text-center"></td> <td>@GetValue("Ecom:Order.ShippingFee")</td> </tr> *@ <tr> <td colspan="2"> @{ var edittextstring = Translate("Edit cart", "Edit cart"); var cartid = GetValue("DwAreaCartPageID"); } </td> <td> <a href="Default.aspx?ID=@cartid" onclick="ga('send', 'pageview', '/cart/kurv');" class="btn orange product pull-right">@Translate("Proceed to checkout", "Proceed to checkout")</a> <span class="clearfix"></span> </td> </tr> </tbody> </table> </div> </div> }else{ <span class="cart-items">@Translate("Your shopping cart is empty.", "Your shopping cart is empty.")</span> } </div> } @helper MiniCart() { <div class="dropdown-cart"> @if (GetInteger("Ecom:Order.OrderLines.TotalProductQuantity") > 0) { <div class="col-md-12 col-sm-12 col-xs-12"> <div class="row"> <span class="cart-items">@Translate("You have", "You have")<strong> @GetValue("Ecom:Order.OrderLines.TotalProductQuantity")</strong> @Translate("items in your cart", "items in your cart")</span> <table class="table table-cart"> <tbody> <tr> <th>@Translate("Product", "Product")</th> <th class="text-center">@Translate("Qty", "Qty")</th> <th style="text-align: right;">@Translate("Total", "Total") @Translate("SacPerMonth")</th> </tr> @{ int currRunningCosts = 0; int currStartUpCosts = 0; int currUnitPrice = 0; int currItemQuantity = 0; bool currItemQuantityStatus = false; } @foreach (LoopItem orderline in GetLoop("OrderLines")) { string productId = orderline.GetString("Ecom:Order:OrderLine.ProductID"); string productName = orderline.GetString("Ecom:Order:OrderLine.ProductName"); // LOAD PRODUCT var currProduct = Dynamicweb.eCommerce.Products.Product.GetProductByID(productId); currRunningCosts = 0; currStartUpCosts = 0; currUnitPrice = orderline.GetInteger("Ecom:Product.DBPrice"); currStartUpCosts += currUnitPrice; currItemQuantityStatus = int.TryParse(orderline.GetString("Ecom:Order:OrderLine.Quantity"), out currItemQuantity); int currBomPrice; foreach (LoopItem bomitem in orderline.GetLoop("BOMItems")) { currBomPrice = bomitem.GetInteger("Ecom:Order:OrderLine.UnitPrice.PricePIP") != 0 ? bomitem.GetInteger("Ecom:Order:OrderLine.UnitPrice.PricePIP") / 100 : 0; if(bomitem.GetString("Ecom:Product:Field.StartUp.Value.Clean") == "1") { currStartUpCosts += currBomPrice; }else{ currRunningCosts += currBomPrice; } } <tr> <td>@orderline.GetValue("Ecom:Order:OrderLine.ProductName")<br><small>@orderline.GetString("Ecom:Order:OrderLine.ProductVariantText")</small></td> <td class="text-center">@orderline.GetString("Ecom:Order:OrderLine.Quantity")</td> <td> <nobr> <span class="pull-right"> @{ currRunningCosts = currRunningCosts * currItemQuantity; } @Translate("SacPricePrefix") @currRunningCosts.ToString("#,##0.00", CultureInfo.CreateSpecificCulture("da-DK")) @*orderline.GetValue("Ecom:Order:olPrice.PriceWithoutVATFormatted")*@ </span> </nobr> </td> </tr> } <tr> <td colspan="2"> @{ var edittextstring = Translate("Edit cart", "Edit cart"); var cartid = GetValue("DwAreaCartPageID"); } </td> <td> <a href="Default.aspx?ID=@cartid" onclick="ga('send', 'pageview', '/cart/kurv');" class="btn orange product pull-right">@Translate("Proceed to checkout", "Proceed to checkout")</a> <span class="clearfix"></span> </td> </tr> </tbody> </table> </div> </div> }else{ <span class="cart-items">@Translate("Your shopping cart is empty.", "Your shopping cart is empty.")</span> } </div> } @{ string MetaTitle = GetGlobalValue("Global:Page.Top.Name").ToString(); string MetaDescription = GetString("Meta.Description"); string MetaKeywords = GetString("Meta.Keywords"); string loginpageid = "xxxx"; string searchPlaceholder = Translate("SearchPage", "S&oslash;g biler"); string searchPageId = Translate("searchPageId", "100"); var cartid = GetValue("DwAreaCartPageID"); } <!DOCTYPE html> <html> <head> <title>@GetValue("Title")</title> @GetValue("MetaTags") @GetValue("CopyRightNotice") <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="apple-mobile-web-app-capable" content="yes"> @* FACEBOOK OPEN GRAPH *@ @{ string currUrl = Translate("SacURL"); string pagePath = currUrl + "/Default.aspx?ID=" + GetValue("Global:Page.ID").ToString(); string imagePath = GetValue("Item.Page.Facebook_image").ToString(); string ogImageUrl = currUrl + imagePath; } <meta property="og:title" content="@MetaTitle"> <meta property="og:url" content="@pagePath"> <meta property="og:type" content="article"> <meta property="og:description" content="@MetaDescription"> <meta property="og:image" content="@ogImageUrl"> @* FACEBOOK OPEN GRAPH *@ <link href="/Files/Templates/Designs/sacbiler.dk/styles/bootstrap.min.css" rel="stylesheet"> <link href="/Files/Templates/Designs/sacbiler.dk/styles/jquery-ui.min.css" rel="stylesheet"> <link href="/Files/Templates/Designs/sacbiler.dk/styles/jquery-ui-slider-pips.css" rel="stylesheet"> <link href="/Files/Templates/Designs/sacbiler.dk/styles/DWGlobalStyles.custom.css" rel="stylesheet"> <link href="/Files/Templates/Designs/sacbiler.dk/styles/font-awesome.min.css" rel="stylesheet"> <link href="/Files/Templates/Designs/sacbiler.dk/styles/styles.css" rel="stylesheet"> @Translate("SacLocalizedStyles") <link rel="icon" href="/Files/Templates/Designs/sacbiler.dk/../../favicon.ico"> <!--Start of Zopim Live Chat Script--> <script type="text/javascript"> window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s= d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set. _.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute("charset","utf-8"); $.src="//v2.zopim.com/?3hTlORFLGH2ogcTRlVUq90u5ejwV2Ban";z.t=+new Date;$. type="text/javascript";e.parentNode.insertBefore($,e)})(document,"script"); </script> <!--End of Zopim Live Chat Script--> <!-- Facebook Pixel Code --> <script> !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, document,'script','https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '1076036332516698'); fbq('track', 'PageView'); </script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1076036332516698&ev=PageView&noscript=1"></noscript> <!-- DO NOT MODIFY --> <!-- End Facebook Pixel Code --> <!-- Google Analytics --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '@Translate("SacAnalytics")', 'auto'); ga('set', 'forceSSL', true); ga('require', 'displayfeatures'); ga('require', 'linkid'); ga('send', 'pageview'); </script> <!-- End Google Analytics --> @GetValue("Stylesheets") @GetValue("Javascripts") </head> <body> <div class="wrapper"> <nav class="navbar"> <div class="container"> <div class="content-container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> @{ string linkTitleStr = Translate("SacLinkTitle", "S.A.C"); string logoTitleStr = Translate("SacLogoAlt", "S.A.C"); string frontPath = Translate("SacLocalizedFrontPath"); } <a class="navbar-brand" href="@frontPath" title="linkTitleStr"> <img src="/Files/Templates/Designs/sacbiler.dk/images/interface/SAC_logo.svg" alt="@logoTitleStr" title="@logoTitleStr"> </a> </div> <div id="navbar" class="navbar-collapse collapse pull-right no-padding"> @GetValue("DwNavigation(drawernavigation)") <div class="flag-container"> <ul> <li><a href="/"><img src="/Files/Templates/Designs/sacbiler.dk/images/interface/dansk.png" alt="SAC - Dansk" title="SAC - Dansk"></a></li> <li><a href="/uk"><img src="/Files/Templates/Designs/sacbiler.dk/images/interface/english.png" alt="SAC - English" title="SAC - English"></a></li> </ul> </div> <div class="cart-container"> <div class="cart"> <!-- MINICART --> @{ string localizedCart = Translate("SacAjaxCartGoToCartURL"); } <nav class="top-header-menu"> <ul class="top-menu"> <li class="dropdown animate-hover" data-animate="animated fadeInUp"> <a href="@localizedCart" title="" id="minipagecart" class="dw-minicart"> <img src="/Files/Templates/Designs/sacbiler.dk/images/interface/SAC_ikon_cart.svg" alt="SAC - Indkøbskurv" title="SAC - Indkøbskurv"> </a> <ul class="sub-menu"> <li id="minicart"> @MiniCart() </li> </ul> </li> </ul> </nav> <!-- MINICART --> </div> </div> </div> </div> </div> </nav> <div class="container"> <div class="row extra-light-grey"> <div class="content-container"> <div class="col-sm-6 col-xs-12 top-box-heading left"> @Translate("SacMainTop", "Udlejning af kasse- og varebiler") </div> <div class="col-sm-6 col-xs-12 top-box-heading right"> @Translate("SacMainOpen", "Åbent lige nu") </div> </div> </div> @GetValue("Title(SAC Content page)") @GetValue("Description(SAC Content page with text content)") <div class="SacEcomContainer" id="ContentContainer">@GetValue("DwContent(ContentContainer)")</div> <div class="row"> <div class="content-container"> <div id="ContactContainer">@GetValue("DwContent(ContactContainer)")</div> </div> </div> <div class="row"> <div class="content-container"> <div class="special-needs"> @Translate("SacSpecialNeeds", "Ring til os på 5656 0000") </div> </div> </div> </div> <footer> <div class="container"> <div class="row"> <div class="content-container"> <div class="col-md-2 col-sm-6 col-xs-12 footer"> <img src="/Files/Templates/Designs/sacbiler.dk/images/interface/SAC_logo_hvid.svg" alt="SAC" title="SAC" class="img-responsive"> </div> <div class="col-md-2 col-sm-6 col-xs-12 footer"> <address> @Translate("SacAddress", "S.A.C A/S") </address> </div> <div class="col-md-4 col-sm-6 col-xs-12 footer"> <a target="_blank" href="http://eepurl.com/b4ndTH">@Translate("SacNewsletterSignup", "")</a> </div> <div class="col-md-4 col-sm-12 col-xs-12 footer"> <div class="phone pull-right"> @Translate("SacPhoneNo", "Telefonnr") </div> <div class="so-me pull-right"> <a href="https://www.facebook.com/sacbiler/" target="_blank"><img src="/Files/Templates/Designs/sacbiler.dk/images/interface/facebook.svg" alt="S.A.C - Følg os på Facebook" title="S.A.C - Følg os på Facebook"></a> <a href="https://www.linkedin.com/company/s-a-c-a-s" target="_blank"><img src="/Files/Templates/Designs/sacbiler.dk/images/interface/linkedin.svg" alt="S.A.C - Følg os på LinkedIn" title="S.A.C - Følg os på LinkedIn"></a> </div> </div> </div> </div> </div> </footer> </div> <div class="cart-modal item-in-basket"> <div id="splash-centre-container"> <div class="container"> <span class="heading">@Translate("SacAjaxCartHeading")</span> <span class="text"> @Translate("SacAjaxCartText") </span> @{ string orderMoreUrl = Translate("SacAjaxCartOrderMoreURL"); string goToCartUrl = Translate("SacAjaxCartGoToCartURL"); } <a id="order-more" class="btn orange pull-left" href="@orderMoreUrl">@Translate("SacAjaxCartOrderMore")</a> <br><br> <a id="go-to-cart" class="btn orange pull-left" onclick="ga('send', 'pageview', '/cart/kurv');" href="@goToCartUrl">@Translate("SacAjaxCartGoToCart")</a> </div> </div> </div> <div class="cart-modal item-in-progress"> <div id="splash-centre-progress"> <div class="container"> <span class="heading">@Translate("SacAjaxCartWait")</span> </div> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="/Files/Templates/Designs/sacbiler.dk/js/jquery-ui.min.js"></script> <script src="/Files/Templates/Designs/sacbiler.dk/js/jquery-ui-slider-pips.js"></script> <script src="/Files/Templates/Designs/sacbiler.dk/js/bootstrap.min.js"></script> <script> // JAVASCRIPT HELPERS // // CALC- AND UPDATE PRICE function calcPrice() { var pricePrefix = '@Translate("SacPricePrefix", "Kr.")'; var pricePostfix = '@Translate("SacPricePostfix", ",-")'; // var numOfProducts = $('.product-items-field').val(); var totalCalcPrice = 0; var startupCost = 0; $('.product-add-ons > li > input:checked').each(function () { var currOptionPrice = $(this).parent().find('input').attr('data-price'); var currStartupPrice = $(this).parent().find('input').attr('data-startup-cost'); if (currStartupPrice != "true") { totalCalcPrice += parseInt(currOptionPrice); } else { startupCost += parseInt(currOptionPrice); } }) totalCalcPrice = totalCalcPrice * parseInt(numOfProducts); $('span.calc-price').text(pricePrefix + thousandSep(String(totalCalcPrice), ".") + pricePostfix); $('span.calc-startup-price').text(pricePrefix + thousandSep(String(startupCost), ".") + pricePostfix); } function calcMilage() { var dataRange = $('a.active').attr('data-price-range'); var dataRangeArr = dataRange.split(","); // //var dataMileage = ["800", "1200", "1600", "2000", "2400", "2800"]; var dataMileage = ["10000", "15000", "20000", "25000", "30000", "35000"]; var selectedMilage = $('span.ui-slider-pip-selected span.ui-slider-label').attr('data-value'); var selectedMilagePos = dataMileage.indexOf(selectedMilage); var selectedMilagePrice = dataRangeArr[selectedMilagePos]; var pricePreFix = '@Translate("SacPricePrefix")'; if ($('.car-mileage').length >= 0) { $('.car-mileage').each(function () { $(this).prop("checked", false); var currPrice = $(this).attr('data-price'); var selectedPrice = selectedMilagePrice.replace('.', ''); if (currPrice == selectedPrice) { $(this).prop("checked", true); } }); } calcPrice(); } </script> <script> $(function () { $('.content-paragraph > a.read-more-btn').click(function () { $(this).parent().parent().find('.read-more-content').addClass('show-more-content'); $(this).parent().parent().find('.dot-dot-dot').remove(); $(this).remove(); }); }); </script> <!-- VALIDATION --> <script src="/Files/Templates/Designs/sacbiler.dk/js/custom.validation.js"></script> <script src="/Files/Templates/Designs/sacbiler.dk/js/custom.ecom.js"></script> </body> </html>