Exception in template (Designs/Dwsimple/_parsed/BlogCategory.parsed.cshtml): System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.cebdcea.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
   at Dynamicweb.Rendering.Template.Output()
@using System.Web; @using Dynamicweb.eCommerce.Products; @using Dynamicweb.Content; @using Dynamicweb.eCommerce.Shops; @using belugi.core.provider; @using belugi.core.model; @using System.Collections.Generic; @{ if (HttpContext.Current.Request.QueryString["redirected"] != "1" && HttpContext.Current.Request.QueryString["CreatedProfile"] == "True") { HttpContext.Current.Response.Redirect(HttpContext.Current.Request.RawUrl + "&redirected=1#newslettermodule"); return; } var frontpageNodeId = GetString("Item.Area.FrontpageNode"); var signInPageId = Pageview.Area.Item["SignInPageId"]; var pageLanguageView = Dynamicweb.Frontend.PageView.Current() ?? Dynamicweb.Frontend.PageView.GetPageview(); var pageLanguageArea = Dynamicweb.Content.Area.GetAreaById(pageLanguageView.AreaID); string pageLanguage = pageLanguageArea.EcomLanguageID; string robots = GetString("MetaTags"); string noindex = "index"; string nofollow = "follow"; if (robots.Contains("noindex")) { noindex = "noindex"; } if (robots.Contains("nofollow")) { nofollow = "nofollow"; } } <!DOCTYPE html> <html lang="<!--@Global:Area.Culture.Name-->"> <head> <meta charset="utf-8"> <title>@GetValue("Title")</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <!-- Mobile theme --> <meta name="theme-color" content="#000000"> <meta name="msapplication-navbutton-color" content="#000000"> <meta name="apple-mobile-web-app-status-bar-style" content="#000000"> <meta name="apple-mobile-web-app-capable" content="yes"> @{ var myDomain = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority).Replace("http:", "https:"); var alternateurl = myDomain + HttpContext.Current.Request.RawUrl; } <link rel="alternate" href="@alternateurl" hreflang="<!--@Global:Area.Culture.Name-->"> @if (HttpContext.Current.Request.Url.AbsoluteUri.Contains(".dw.")) { <meta name="robots" content="noindex, nofollow"> } //product variant detail page else if ((HttpContext.Current.Request.Url.AbsoluteUri.ToLower().Contains("&productid=") && HttpContext.Current.Request.Url.AbsoluteUri.ToLower().Contains("&variantid=")) || //product category page (every other than main first page) (HttpContext.Current.Request.QueryString["groupid"] != null && HttpContext.Current.Request.QueryString.Count > 2) ) { <meta name="robots" content="noindex, follow"> } else { <meta name="robots" content="@noindex, @nofollow"> } @{ string MetaDescription = GetString("Meta.Description"); if (!string.IsNullOrEmpty(GetString("MetaDescriptionOverriden"))) { MetaDescription = GetString("MetaDescriptionOverriden"); } } <meta name="description" content="@MetaDescription"> <!--@Snippet(metatags)--> <style>@(System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/dwsimple/assets/css/bundle.min.css")))</style> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <!-- TrustBox script --> <script type="text/javascript" src="//widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js" async=""></script> <!-- End Trustbox script --> <link rel="shortcut icon" type="image/x-icon" href="https://res.cloudinary.com/belugi/t_lib/assets/css/img/favicon.png"> @{ var attrValue = ""; string firstpageid = GetString("DwAreaFirstActivePageID"); string loginpageid = "8482"; string searchplaceholder = Translate("Search products", "Search products"); var cartid = GetValue("DwAreaCartPageID"); var gtmId = Pageview.Area.Item["GTMID"]; } @helper RenderCart(bool showActions, string formSufix) { var orderLines = GetLoop("OrderLines"); var productOrderLines = new List<LoopItem>(); var nonProductOrderLines = new List<LoopItem>(); var allDiscountOrderLines = new List<LoopItem>(); foreach (LoopItem orderline in orderLines) { if (!string.IsNullOrWhiteSpace(orderline.GetString("Ecom:Order:OrderLine.IsProduct"))) { productOrderLines.Add(orderline); } else { var name = orderline.GetString("Ecom:Order:OrderLine.ProductName"); //if(!string.IsNullOrEmpty(name) && name.ToLower().StartsWith("kup")) if(!string.IsNullOrEmpty(name) && (name.ToLower().StartsWith("kup") || name.ToLower().StartsWith("free") || name.ToLower().StartsWith("gratis"))) { nonProductOrderLines.Add(orderline); } } } <script> function updateCart() { var form = document.getElementById('ordersubmit@(formSufix)'); form.submit(); } function reset() { var form = document.getElementById('ordersubmit@(formSufix)'); form.reset(); } </script> <div class="box"> @if (string.IsNullOrWhiteSpace(GetString("Ecom:Order.IsEmpty"))) { <form name="ordersubmit" id="ordersubmit@(formSufix)" method="post"> <div class="col-md-12"> <table class="table table-cart"> <thead> <tr> <th class="text-center"><i class="fa fa-info-circle"></i></th> <th>@Translate("Product", "Product")</th> <th class="text-right">@Translate("Qty", "Qty")</th> <th class="text-left"></th> <th class="text-right">@Translate("Total", "Total")</th> </tr> </thead> <tbody> @foreach (LoopItem orderline in productOrderLines) { var url = Pageview.Area.Item["ProductPage"] + "?ProductId=" + orderline.GetString("Ecom:Order:OrderLine.ProductID") + (!string.IsNullOrEmpty(orderline.GetString("Ecom:Product.VariantID.Extented")) ? "&VariantID=" + orderline.GetString("Ecom:Product.VariantID.Extented") : ""); var isVipDiscount = false; double priceWithVAT = 0; foreach (LoopItem orderlinefield in orderline.GetLoop("Order.OrderLineFields")) { if (orderlinefield.GetString("Ecom:Order:OrderLine.OrderLineField.SystemName") == "VipDiscount" && orderlinefield.GetBoolean("Ecom:Order:OrderLine.OrderLineField.Value")) { isVipDiscount = true; } if (orderlinefield.GetString("Ecom:Order:OrderLine.OrderLineField.SystemName") == "UnitPriceWithVAT") { priceWithVAT = Convert.ToDouble(orderlinefield.GetString("Ecom:Order:OrderLine.OrderLineField.Value")); } } <tr> <td class="text-center"><i class="fa fa-bookmark"></i></td> <td> <a href="@url">@orderline.GetString("Ecom:Order:OrderLine.ProductName")</a> <br> <small>@orderline.GetString("Ecom:Order:OrderLine.ProductVariantText")</small> </td> <td class="text-right">@orderline.GetString("Ecom:Order:OrderLine.Quantity")</td> <td class="text-left"> @if (!string.IsNullOrWhiteSpace(orderline.GetString("Ecom:Order:OrderLine.IsProduct")) && showActions && formSufix != "MiniCart" && formSufix != "MiniCartMobile") { if (Convert.ToInt32(orderline.GetValue("Ecom:Product.AvailableAmount")) > Convert.ToInt32(orderline.GetValue("Ecom:Order:OrderLine.Quantity"))) { <a href="@orderline.GetString(" ecom:order:orderline.incrementlink")"="" title=""><i class="fa fa-plus"></i></a><text>&nbsp;</text> } if (Convert.ToInt32(orderline.GetValue("Ecom:Order:OrderLine.Quantity")) > 1) { <a href="@orderline.GetString(" ecom:order:orderline.decrementlink")"="" title=""><i class="fa fa-minus"></i></a><text>&nbsp;</text> } } </td> <td class="text-right"> @if (isVipDiscount) { <del>@Dynamicweb.eCommerce.Common.Context.Currency.Format(priceWithVAT * orderline.GetInteger("Ecom:Order:OrderLine.Quantity"), true)</del> } else if (orderline.GetString("Ecom:Order:OrderLine.TotalPrice") != orderline.GetString("Ecom:Order:OrderLine.TotalPriceWithProductDiscounts")) { <del>@orderline.GetString("Ecom:Order:OrderLine.TotalPrice")</del> } <nobr> @if (orderline.GetString("Ecom:Order:OrderLine.TotalPrice") != orderline.GetString("Ecom:Order:OrderLine.TotalPriceWithProductDiscounts")) { @orderline.GetString("Ecom:Order:OrderLine.TotalPriceWithProductDiscounts.PriceFormatted") } else { @orderline.GetString("Ecom:Order:OrderLine.TotalPrice") } </nobr> @if (!string.IsNullOrWhiteSpace(orderline.GetString("Ecom:Order:OrderLine.IsProduct")) && showActions) { if (formSufix != "MiniCart" && formSufix != "MiniCartMobile") { <text>&nbsp;</text> } var deleteLink = orderline.GetString("Ecom:Order:OrderLine.DeleteLink"); <a href="@deleteLink" title=""><i class="fa fa-times"></i></a> } </td> </tr> foreach (LoopItem bomitem in orderline.GetLoop("BOMItems")) { <tr> <td></td> <td><small>&nbsp;&nbsp;&nbsp;@bomitem.GetString("Ecom:Order:OrderLine.ProductName")</small></td> <td class="text-right"><small>@bomitem.GetString("Ecom:Order:OrderLine.Quantity")</small></td> <td></td> <td class="text-right"></td> </tr> } } @foreach (var orderline in nonProductOrderLines) { double priceWithVAT = 0; foreach (LoopItem orderlinefield in orderline.GetLoop("Order.OrderLineFields")) { if (orderlinefield.GetString("Ecom:Order:OrderLine.OrderLineField.SystemName") == "UnitPriceWithVAT") { priceWithVAT = Convert.ToDouble(orderlinefield.GetString("Ecom:Order:OrderLine.OrderLineField.Value")); } } <tr> <td class="text-center"><i class="fa fa-bookmark"></i></td> <td> <a>@orderline.GetString("Ecom:Order:OrderLine.ProductName")</a> <br> <small> </small> </td> <td class="text-right"></td> <td class="text-left"> &nbsp; </td> <td class="text-right"> <nobr> @if (orderline.GetString("Ecom:Order:OrderLine.TotalPrice") != orderline.GetString("Ecom:Order:OrderLine.TotalPriceWithProductDiscounts")) { @orderline.GetString("Ecom:Order:OrderLine.TotalPriceWithProductDiscounts.PriceFormatted") } else { @orderline.GetString("Ecom:Order:OrderLine.TotalPrice") } </nobr> </td> </tr> } </tbody> <tfoot> @if(showActions) { <tr> <td class="text-center"><i class="fa fa-credit-card"></i></td> <td>@GetString("Ecom:Order.PaymentMethod")</td> <td class="text-right"></td> <td class="text-center"></td> <td class="text-right">@GetString("Ecom:Order.PaymentFee")</td> </tr> } <tr> <td class="text-center"><i class="fa fa-truck"></i></td> @if (GetString("Ecom:Order.ShippingMethodID") == "SHIP22") { <td>@Translate("SHIP22", "Delivery")</td> } else { <td>@GetString("Ecom:Order.ShippingMethod")</td> } <td class="text-right"></td> <td class="text-center"></td> <td class="text-right">@GetString("Ecom:Order.ShippingFee")</td> </tr> <tr> <td></td> <td><strong>@Translate("Total", "Total")</strong></td> <td class="text-right"><strong>@GetValue("Ecom:Order.OrderLines.TotalProductQuantity")</strong></td> <td class="text-center"></td> <td class="text-right"><strong>@GetString("Ecom:Order.OrderLines.Total.PriceWithVAT")</strong></td> </tr> </tfoot> </table> </div> @if (formSufix == "FullCart" || formSufix == "MiniCartMobile") { var placeholder = Translate("Enter voucher code", "Enter voucher code"); <div class="col-md-12"> <div class="well clearfix"> <div class="col-md-6 col-md-offset-3"> <div class="input-group"> <input type="text" id="EcomOrderVoucherCode" name="EcomOrderVoucherCode" class="form-control" placeholder="@placeholder" value="@GetString(" ecom:order.customer.vouchercode")"=""> <span class="input-group-btn"> <button class="btn btn-red" type="submit"> @Translate("Apply", "Apply") </button> </span> </div><!-- /input-group --> </div> </div> </div> } <div class="col-xs-12 col-md-5 text-left"> <button class="btn btn-secondary" onclick="EmptyCart(); return false;"> <i class="fa fa-recycle"></i> @Translate("Empty Cart", "Empty Cart") </button> </div> <div class="col-xs-12 col-md-7 text-right"> @if (!showActions) { <button class="btn btn-red" onclick="showCartPage(event);"> <i class="fa fa-shopping-bag"></i> @Translate("Proceed to cart", "Proceed to cart") </button> } else { <button class="btn btn-red" onclick="showCheckoutPage(event);"> <i class="fa fa-shopping-bag"></i> @Translate("Proceed to checkout", "Proceed to cart") </button> } <span class="clearfix"></span> </div> <div>&nbsp;</div> </form> } else { <span class="cart-items">@Translate("Cart is empty...", "Cart is empty...")</span> } </div> } <!--@Snippet(headerScripts)--> <!-- Google Tag Manager --> <script> (function (w, d, s, l, i) { w[l] = w[l] || []; w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' }); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); })(window, document, 'script', 'dataLayer', '@gtmId');</script> <!-- End Google Tag Manager --> </head> <body itemscope="" itemtype="http://schema.org/WebPage"> <!-- Google Tag Manager (noscript) --> <noscript> <iframe src="https://www.googletagmanager.com/ns.html?id=@(gtmId)" height="0" width="0" style="display:none;visibility:hidden"></iframe> </noscript> <!-- End Google Tag Manager (noscript) --> @GetString("Item.Area.JSON") @GetString("Item.Area.CookieContent") <!--page loader--> <div class="loader"> <div class="loading"> <strong>@Translate("Please wait", "Please wait...")</strong> <i class="fa fa-load"></i> </div> </div> <header class="visible-lg visible-md"> <div class="container"> <div class="box"> <div class="row"> <div class="col-sm-3"> <div class="logo"> <a href="/"> <img src="https://res.cloudinary.com/belugi/t_lib/Files/Images/logo_<!--@Global:Area.Lang-->.png" alt='@Translate("LogoAlt", "Logo")'> </a> </div> </div> <div class="col-sm-9 "> <div class="nav-top clearfix"> <ul class="top-menu text-right"> @GetString("Item.Area.CookieIcon") <li class="clear hidden-xs hidden-sm"><a href='mailto:@Translate("SupportEmail","support")'>@Translate("SupportEmail", "support")</a></li> @if (!string.IsNullOrEmpty(Pageview.Area.Item["WishlistPage"].ToString())) { <li> <a href='@("/" + Pageview.Area.Item["WishlistPage"])'>@Translate("Wishlist.Link", "Wishlist")</a> </li> } @if (!string.IsNullOrEmpty(Pageview.Area.Item["Track_And_Trace_Page"].ToString())) { <li> <a href='@("/" + Pageview.Area.Item["Track_And_Trace_Page"])'>@Translate("TrackAndTrace.Link", "Track and trace")</a> </li> } @if (!Dynamicweb.Input.FormatBoolean(GetGlobalValue("Global:Extranet.UserName"))) { } else { <li> <a href='@("/" + Pageview.Area.Item["MyPage"])'> <nobr> <i class="fa fa-user"></i> <strong>@GetGlobalValue("Global:Extranet.Name")</strong> </nobr> </a> </li> <li> <a id="main-logout" href="/Admin/Public/ExtranetLogoff.aspx">@Translate("Logout", "Logout")</a> </li> } <li class="lang"> <select id="lang-selector"> @foreach (var language in GetLoop("Languages")) { string url = "https://" + language.GetString("PrimaryDomain"); if (language.GetBoolean("IsCurrent")) { <option selected="">@language.GetString("Name")</option> } else { <option value="@url">@language.GetString("Name")</option> } } </select> </li> </ul> </div> @{ var searchQuery = HttpContext.Current.Request["eComQuery"]; string fullSearchUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(Pageview.Area.Item["FullSearchPage"].ToString()).ToString(); } <!--bottom navigation--> <div class="nav-bottom"> <div class="search-wrapper"> <input id="txtGlobalSearch" autocomplete="off" type="text" class="form-control" name="eComQuery" tabindex="1" value="@searchQuery" placeholder="@searchplaceholder"> <button id="btnGlobalSearch" class="btn" type="submit"><i class="fa fa-search"></i></button> <div id="search-dropdown" class="search-ac"> <div id="search-dropdown-items" class="clearfix"> <!--Search results are rendered in this container--> </div> <div id="search-dropdown-seeall" class="clearfix text-center"> <a href="#">@Translate("View all", "View all")</a> </div> <div id="search-dropdown-noproducts" class="clearfix text-center"> @Translate("Search.NoProductsFound", "Ingen resultater fundet") </div> </div> </div> <!-- Ecommerce Cart --> <!--cart-wrapper--> <div class="cart-wrapper"> <a href="Default.aspx?ID=@cartid" id="minipagecart" class="btn btn-red btn-cart"> <span class="hidden-xs hidden-sm"> @Translate("Indkobskurv", "Indkobskurv") </span> <span>@GetValue("Ecom:Order.OrderLines.Total.PriceWithVAT")</span> <i class="fa fa-shopping-cart"></i> </a> <div id="minicart"> <div class="dropdown-cart"> <div id="full-cart"> @RenderCart(true, "MiniCart") </div> </div> </div> </div> </div> </div> </div> </div> </div> </header> <nav class="navbar"> <div class="container"> <div class="box"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <i class="fa fa-bars"></i> </button> <button type="button" class="navbar-cart"> <span class="sr-only">Cart</span> <i class="fa fa-shopping-cart"></i> </button> <button type="button" class="navbar-search"> <span class="sr-only">Search</span> <i class="fa fa-search"></i> </button> <a href="/" class="navbar-brand visible-xs visible-sm"> <img src="https://res.cloudinary.com/belugi/t_lib/assets/images/logo-white.png"> </a> <div class="mobile-search"> <input class="form-control" id="txtGlobalSearchMobile" autocomplete="off" type="text" class="form-control" name="eComQuery" tabindex="1" value="@searchQuery" placeholder="@searchplaceholder"> <button id="btnGlobalSearchMobile" type="submit" class="btn"><i class="fa fa-search"></i></button> </div> </div> <!-- navbar-collapse --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav" id="primary-navigation" itemscope="" itemtype="http://schema.org/SiteNavigationElement"> <li class="mobile clearfix"> @if (!string.IsNullOrEmpty(Pageview.Area.Item["WishlistPage"].ToString())) { <a href='@("/" + Pageview.Area.Item["WishlistPage"])'><i class="fa fa-star"></i>@Translate("Wishlist.Link", "Wishlist")</a> } @if (!string.IsNullOrEmpty(Pageview.Area.Item["Track_And_Trace_Page"].ToString())) { <a href='@("/" + Pageview.Area.Item["Track_And_Trace_Page"])'><i class="fa fa-truck"></i> @Translate("TrackAndTrace.Link", "Track and trace")</a> } @if (!Dynamicweb.Input.FormatBoolean(GetGlobalValue("Global:Extranet.UserName"))) { <a href="/Default.aspx?ID=@signInPageId"><i class="fa fa-lock"></i> @Translate("Login", "Login")</a> <a href='@("/" + Pageview.Area.Item["CreateUserPage"])'><i class="fa fa-user-plus"></i> @Translate("Create User", "Create User")</a> } else { <a href='@("/" + Pageview.Area.Item["MyPage"])'><i class="fa fa-user"></i> @GetGlobalValue("Global:Extranet.Name")</a> <a id="main-logout" href="/Admin/Public/ExtranetLogoff.aspx"><i class="fa fa-sign-out"></i> @Translate("Logout", "Logout")</a> } </li> @{ var pageView = Dynamicweb.Frontend.PageView.Current() ?? Dynamicweb.Frontend.PageView.GetPageview(); var area = Dynamicweb.Content.Area.GetAreaById(pageView.AreaID); string EcomLanguageID = area.EcomLanguageID; var allPages = Dynamicweb.Content .Page .GetPages() .Where(p => p.AreaID == pageView.AreaID && p.Active == true && p.Hidden == false && p.IsFolder == false) .OrderBy(p => p.Sort) .ToList(); var categoryTemplate = "Category.cshtml"; var categoryPages = allPages.FindAll(p => p.ParentPageID == 0 && p.LayoutTemplate == categoryTemplate) .ToList(); foreach (var page in categoryPages) { var pageItem = PageItemType.GetPageItemTypeInstance(int.Parse(page.ItemId)); var group = Dynamicweb.eCommerce.Products.Group.GetGroupByID(pageItem.Category, EcomLanguageID); if (group == null) { continue; } var groupUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" + page.ID).ToString(); var className = group.Subgroups.Count > 0 ? "dropdown" : ""; <li class="@(className)"> <a href="@groupUrl" itemprop="url">@page.MenuText</a> @if (group.Subgroups.Count > 0) { <span class="caret-dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></span> <ul class="dropdown-menu double"> <li class="clearfix"> <ul class="block"> @foreach (var subgroup in group.Subgroups.Where(g => g.NavigationShowInMenu)) { var subGroupUrl = string.Format("{0}/{1}/{2}", groupUrl, group.Name.NormalizeForUrl(), subgroup.Name.NormalizeForUrl()); var redirectField = subgroup.ProductGroupFieldValues.GetProductGroupFieldValue("RedirectGroup"); if (redirectField != null && redirectField.Value != null && !redirectField.Value.ToString().IsNullOrEmpty()) { subGroupUrl = redirectField.Value.ToString(); } <li><a href="@subGroupUrl" itemprop="url">@subgroup.Name</a></li> } </ul> <ul class="block"> @foreach (MenuLinks link in pageItem.CategoryLinks) { <li><a href="@link.Link" itemprop="url">@link.DisplayName</a></li> } </ul> </li> </ul> } </li> } var regularPages = allPages.FindAll(p => p.ParentPageID == 0 && p.LayoutTemplate != categoryTemplate); foreach (var p in regularPages) { var pageUrl = "Default.aspx?ID=" + p.ID; var subpages = p.Subpages .Where(s => s.Active == true && s.Hidden == false && s.IsFolder == false) .OrderBy(s => s.Sort) .ToList(); var className = subpages.Count > 0 ? "dropdown" : ""; <li class="@(className)"> <a href="@pageUrl" itemprop="url">@p.MenuText</a> @if (subpages.Count > 0 && p.ItemType != "Blog") { <span class="caret-dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></span> <ul class="dropdown-menu"> <li class="clearfix"> <ul class="block"> @foreach (var sp in subpages) { <li> <a href="Default.aspx?ID=@sp.ID" itemprop="url">@sp.MenuText</a> </li> } </ul> </li> </ul> } </li> } } </ul> </div><!-- /.navbar-collapse --> </div> </div><!-- /.container --> </nav> <div class="mfp-hide main-popup main-popup-info" id="popup-message"> <div class="popup-block"> <div class="h2 text-uppercase">@Translate("Godt valgt! Produktet er lagt i kurven", "Godt valgt! Produktet er lagt i kurven")</div> <div class="text-block"> <p> @Translate("Er der andet, vi kan friste med?", "Er der andet, vi kan friste med?") <br> @Translate("Ellers gå til kassen og kom hurtigt videre.", "Ellers gå til kassen og kom hurtigt videre.") </p> </div> <p> <a href="#" onclick="window.location.reload();" class="btn btn-red-invert"> @Translate("Shop videre", "Shop videre")</a> &nbsp; &nbsp; <a href="#" onclick="showCheckoutPage(event);" class="btn btn-red"><i class="fa fa-shopping-cart"></i> @Translate("Gå til kassen", "Gå til kassen")</a> </p> </div> </div> <div class="mfp-hide main-popup main-popup-info" id="popup-cart-message"> <div class="popup-block"> <div class="text-block"> <p> @Translate("Dit produkt er lagt i kurven", "Dit produkt er lagt i kurven") </p> </div> </div> </div> <div class="cart-dropdown-mobile"> @RenderCart(true, "MiniCartMobile") </div> <section class="info-module visible-lg"> <div class="container"> <div class="box"> <ul> @GetString("Item.Area.Features") </ul> </div> </div> </section> @* Main content *@ @************IMPORTANT************ If you change this template, make sure to change blog.cshtml template as well. Those templates are the same ***********IMPORTANT*************@ @using System.Web @using System.Linq @using Dynamicweb.Content @{ var pageId = GetString("DwPageID"); var currentPage = Dynamicweb.Content.Page.GetPageById(Convert.ToInt32(pageId)); var blogPage = currentPage.Parent; var blogItem = Dynamicweb.Content.Items.ItemManager.Storage.GetById("Blog", blogPage.ItemId.ToString()); if (blogItem == null) { return; } var allTags = new List<string>(); var allCatPages = Dynamicweb.Content.Page.GetPagesByParentID(blogPage.ID); var pages = Dynamicweb.Content.Page.GetPagesByParentID(Convert.ToInt32(pageId)) .Select(p => new { Page = p, Item = Dynamicweb.Content.Items.ItemManager.Storage.GetById("Blog_Article", p.ItemId.ToString()) }) .ToList() .FindAll(p => p.Item != null && !p.Page.Hidden && p.Page.Active) .ToList(); var categories = allCatPages .Select(p => new { Page = p, Item = Dynamicweb.Content.Items.ItemManager.Storage.GetById("BlogCategory", p.ItemId.ToString()) }) .ToList() .FindAll(p => p.Item != null && !p.Page.Hidden && p.Page.Active) .ToList(); foreach (var page in pages) { var tags = page.Item["Tags"] .ToString() .Split(',') .Where(s => !s.IsNullOrEmpty()) .Select(s => s.Trim()) .ToList(); foreach (var tag in tags) { if (tag.IsNullOrEmpty()) { continue; } if (!allTags.Contains(tag)) { allTags.Add(tag); } } } var filteredTag = HttpContext.Current.Request["tag"]; if (!filteredTag.IsNullOrEmpty()) { pages = pages.Where(p => p.Item["Tags"] .ToString() .Split(',') .Select(s => s.Trim()) .ToList() .Contains(filteredTag)) .ToList(); } var rawUrl = HttpContext.Current.Request.RawUrl.Split('?')[0]; var categoryTeasers = GetLoop("Item.CategoryTeasers"); var topImage = GetString("Item.TopImage"); var canonicalUrl = HttpContext.Current.Request.RawUrl; if (canonicalUrl.Contains("?")) { canonicalUrl = "https://" + HttpContext.Current.Request.Url.Host + canonicalUrl.Substring(0, canonicalUrl.IndexOf("?")); } } <!--@SnippetStart(metatags)--> <link rel="canonical" href="@canonicalUrl"> <!--@SnippetEnd(metatags)--> <section class="blog"> <div class="container"> @if (!string.IsNullOrEmpty(topImage)) { topImage = "https://res.cloudinary.com/belugi/t_lib" + topImage; <div class="header-image" style="background-image:url(@topImage)"></div> } <div class="row"> <!--left-side desktop--> <div class="col-md-3 visible-lg visible-md"> <div class="box-single"> <div class="blog-nav main"> <ul> @foreach (var c in categories) { var cssClass = pageId == c.Page.ID.ToString() ? "active" : string.Empty; <li class="@cssClass"><a href="Default.aspx?ID=@c.Page.ID">@c.Item["Title"]</a></li> } </ul> </div> </div> @if (allTags.Count > 0) { <div class="box"> <div class="blog-tags"> <a href="@rawUrl" class="btn btn-gray">@Translate("Blog.Tags.All", "Alle")</a> @foreach (var tag in allTags) { var tagUrl = rawUrl + "?tag=" + HttpUtility.UrlEncode(tag); <a href="@tagUrl" class="btn btn-gray">@tag</a> } </div> </div> } @if (categoryTeasers.Count() > 0) { foreach (var teaser in categoryTeasers) { var url = teaser.GetString("Item.Teasers.Link"); var image = teaser.GetString("Item.Teasers.Image"); var video = teaser.GetString("Item.Teasers.Video"); if (string.IsNullOrEmpty(video)) { <div class="box-single"> <a class="ex" href="@url"><img src="@image"></a> </div> } else { <div class="box-single box-single-video"> <a href="@video" class="ex popup-youtube"> <i class="fa fa-play"></i> <img src="@image" alt=""> </a> </div> } } } else { int teasersId = -1; if (blogItem["Teasers"] != null) { teasersId = Convert.ToInt32(blogItem["Teasers"]); } //try to get var list = Dynamicweb.Content.Items.ItemList.GetItemListById(teasersId); foreach (var rel in list.Relations) { var item = new Dynamicweb.Content.Items.Item(rel); var teaserUrl = item["Link"]; var teaserImage = item["Image"]; var teaserVideo = item["Video"]; if (teaserVideo == null || string.IsNullOrEmpty(teaserVideo.ToString())) { <div class="box-single"> <a class="ex" href="@teaserUrl"><img src="@teaserImage"></a> </div> } else { <div class="box-single box-single-video"> <a href="@teaserVideo" class="ex popup-youtube"> <i class="fa fa-play"></i> <img src="@teaserImage" alt=""> </a> </div> } } } </div> <!--right side--> <div class="col-md-9"> <div class="articles"> @foreach (var page in pages.OrderByDescending(p => p.Item["Date"])) { var intro = page.Item["IntroImage"]; var introText = page.Item["IntroText"]; <article style="background-image:url('@intro')"> <div class="text"> <div class="date">@Convert.ToDateTime(page.Item["Date"]).ToString("dd.MMMM yyyy")</div> <div class="h3"> <a href="Default.aspx?ID=@page.Page.ID"> @page.Item["Title"] </a> </div> <div class="intro"> @page.Item["IntroText"] @if(introText != null && !introText.ToString().IsNullOrEmpty()) { <text>[…]</text> } </div> </div> </article> } </div> </div> <!--left-side mobile --> <div class="col-sm-12 col-xs-12 visible-xs visible-sm"> <div class="box-single"> <div class="blog-nav"> <ul> @foreach (var c in categories) { var cssClass = pageId == c.Page.ID.ToString() ? "active" : string.Empty; <li class="@cssClass"><a href="Default.aspx?ID=@c.Page.ID">@c.Item["Title"]</a></li> } </ul> </div> </div> @if (allTags.Count > 0) { <div class="box"> <div class="blog-tags"> <a href="@rawUrl" class="btn btn-gray">@Translate("Blog.Tags.All", "Alle")</a> @foreach (var tag in allTags) { var tagUrl = rawUrl + "?tag=" + HttpUtility.UrlEncode(tag); <a href="@tagUrl" class="btn btn-gray">@tag</a> } </div> </div> } @if (categoryTeasers.Count() > 0) { foreach (var teaser in categoryTeasers) { var url = teaser.GetString("Item.Teasers.Link"); var image = teaser.GetString("Item.Teasers.Image"); <div class="box-single"> <a class="ex" href="@url"><img src="@image"></a> </div> } } else { int teasersId = -1; if (blogItem["Teasers"] != null) { teasersId = Convert.ToInt32(blogItem["Teasers"]); } //try to get var list = Dynamicweb.Content.Items.ItemList.GetItemListById(teasersId); foreach (var rel in list.Relations) { var item = new Dynamicweb.Content.Items.Item(rel); var teaserUrl = item["Link"]; var teaserImage = item["Image"]; <div class="box-single"> <div class="ex"> <a href="@teaserUrl"><img src="@teaserImage"></a> </div> </div> } } </div> </div> </div> </section> <div id="maincontent">@GetValue("DwContent(maincontent)")</div> @*Footer *@ <section> <footer> <div class="container"> <div class="box"> <div class="row"> <div class="col-sm-6 col-md-3"> @if (GetString("Item.Area.FooterFirstTitle") != "") { var link = GetString("Item.Area.FooterFirstTitleLink"); if (string.IsNullOrEmpty(link)) { <div class="h4">@GetString("Item.Area.FooterFirstTitle")</div> } else { <div class="h4"> <a href="@link" title="@GetString(" item.area.footerfirsttitle")"="">@GetString("Item.Area.FooterFirstTitle")</a> </div> } } <ul> @foreach (LoopItem i in GetLoop("Item.Area.FooterFirstLinks")) { var url = i.GetString("Item.Area.FooterFirstLinks.Link"); <li><a href="@url">@i.GetString("Item.Area.FooterFirstLinks.Name")</a></li> } </ul> </div> <div class="col-sm-6 col-md-3"> @if (GetString("Item.Area.FooterSecondTitle") != "") { var link = GetString("Item.Area.FooterSecondTitleLink"); if (string.IsNullOrEmpty(link)) { <div class="h4"> @GetString("Item.Area.FooterSecondTitle") </div> } else { <div class="h4"> <a href="@link" title="@GetString(" item.area.footersecondtitle")"="">@GetString("Item.Area.FooterSecondTitle")</a> </div> } } <ul> @foreach (LoopItem i in GetLoop("Item.Area.FooterSecondLinks")) { var url = i.GetString("Item.Area.FooterSecondLinks.Link"); <li><a href="@url">@i.GetString("Item.Area.FooterSecondLinks.Name")</a></li> } </ul> </div> <div class="col-sm-12 col-md-3"> @if (GetString("Item.Area.FooterThirdTitle") != "") { var link = GetString("Item.Area.FooterThirdTitleLink"); if (string.IsNullOrEmpty(link)) { <div class="h4"> @GetString("Item.Area.FooterThirdTitle") </div> } else { <div class="h4"> <a href="@link" title="@GetString(" item.area.footerthirdtitle")"="">@GetString("Item.Area.FooterThirdTitle")</a> </div> } } <ul> @foreach (LoopItem i in GetLoop("Item.Area.FooterThirdLinks")) { var url = i.GetString("Item.Area.FooterThirdLinks.Link"); <li><a href="@url">@i.GetString("Item.Area.FooterThirdLinks.Name")</a></li> } </ul> </div> <div class="col-sm-12 col-md-3"> @if (GetString("Item.Area.FooterFourthTitle") != "") { <div class="h4">@GetString("Item.Area.FooterFourthTitle")</div> } @GetString("Item.Area.FooterSocialLinks") </div> </div> </div> <div class="box-red"> <div class="row"> <div class="col-md-8"> <span>@GetString("Item.Area.FooterContactInfo")</span> </div> <div class="col-md-4"> @{ var cardImgUrl = GetString("Item.Area.FooterCardsImage"); } <div class="cards"><img src="@cardImgUrl"></div> </div> </div> </div> </div> </footer> </section> @* Initializing *@ <script type="text/javascript"> var searchAjaxHandler = null; $(document).ready(function () { var jsonCartPageId = "@GetString("Item.Area.JsonCartPage")"; var searchPageId = "@GetString("Item.Area.SearchPage")"; var productPage = "@Pageview.Area.Item["ProductPage"]"; MiniCartInit(jsonCartPageId); // Initialize global search $("#txtGlobalSearch").bind('input', function () { if (searchAjaxHandler != null) { searchAjaxHandler.abort(); } var searchquery = this.value; if (this.value.length >= 3) { // perform the post requst to all products content page. searchAjaxHandler = $.ajax({ type: "POST", url: "/Default.aspx?ID=" + searchPageId + "&eComQuery=" + searchquery, data: "", success: function (response) { var result = ''; $.each(response.products, function (idx, obj) { result += '<a href="/' + productPage + '&ProductID=' + obj.id + '">'; result += '<figure class="clearfix">'; result += '<div>'; result += '<div class="search-img" style="background-image: url(https://res.cloudinary.com/belugi/t_small/' + obj.number + '_1.jpg);">'; result += '</div>'; result += '</div>'; result += '<div>'; result += '<strong>'; result += obj.name; result += '</strong>'; result += '<br />'; result += '</div>'; result += '<div class="text-right">'; result += '<strong>'; if (obj.discount && obj.discount.length > 0 && obj.discount != obj.price) { result += '<del>' + obj.price + '</del><br/>'; result += obj.discount; } else { result += obj.price; } result += '</strong>'; result += '<br />'; result += '</div>'; result += '</figure>'; result += '</a>'; }); $("#search-dropdown-items").html(result); $("#search-dropdown").attr('style', 'display:block'); if (response.products.length == 0) { $("#search-dropdown-seeall").hide(); $("#search-dropdown-noproducts").show(); } else { $("#search-dropdown-seeall").show(); $("#search-dropdown-noproducts").hide(); } }, error: function () { console.log('Failed to perform global search.'); } }); } else { $("#search-dropdown-items").empty(); $("#search-dropdown").attr('style', 'display:none'); } }); $('#btnGlobalSearch').click(function () { showSearchPage(); }); $('#btnGlobalSearchMobile').click(function () { showSearchPageMobile(); }); $('#txtGlobalSearch').keyup(function (e) { if (e.keyCode == 13) { showSearchPage(); } }); $('#txtGlobalSearchMobile').keyup(function (e) { if (e.keyCode == 13) { showSearchPageMobile(); } }); $('#search-dropdown-seeall').click(function () { showSearchPage(); }); showSearchPage = function () { window.location.href = "@(fullSearchUrl)?eComQuery=" + $("#txtGlobalSearch").val(); } showSearchPageMobile = function () { window.location.href = "@(fullSearchUrl)?eComQuery=" + $("#txtGlobalSearchMobile").val(); } showCheckoutPage = function (e) { e.preventDefault(); window.location = "/@Pageview.Area.Item["CheckoutPage"]"; } showCartPage = function (e) { e.preventDefault(); window.location = "/Default.aspx?ID=@cartid"; } $('#main-logout').click(function(e) { e.preventDefault(); var cookies = document.cookie.split(";"); for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i]; var eqPos = cookie.indexOf("="); var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; if (name.indexOf("Dynamicweb:Ecom") > -1) { document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; } } window.location = "/Admin/Public/ExtranetLogoff.aspx"; }); }); @if (HttpContext.Current.Request.Form["NewsletterAction"] == "post") { <text> showLoading(); $(window).on("load", function () { hideLoading(); $('html, body').animate({ scrollTop: $(".newsletter-module").offset().top }, 0); }); </text> } </script> @* Code snippets *@ @* Shows the login modal, if it contains an error *@ @if (!string.IsNullOrWhiteSpace(GetString("DW_extranet_error_uk"))) { <script> $(function () { $('[name="username"]').parent().addClass('form-error'); $('[name="password"]').parent().addClass('form-error'); if ($('#login').length > 0) { $.magnificPopup.open({ items: { src: '#login', type: 'inline' } }); } }); </script> } @* Replacing the Home text *@ <script> if (document.getElementById("homemenubtn")) { document.getElementById("homemenubtn").innerHTML = "<i class='fa fa-home fa-2'></i><span></span>"; } </script> <script type="text/javascript" src="/files/templates/designs/dwsimple/assets/scripts/minify/jquery.rangeslider.min.js"></script> <script type="text/javascript" src="/files/templates/designs/dwsimple/assets/scripts/minify/jquery.magnific-popup.min.js"></script> <script type="text/javascript" src="/files/templates/designs/dwsimple/assets/scripts/minify/jquery.prettyselect.min.js"></script> <script type="text/javascript" src="/files/templates/designs/dwsimple/assets/scripts/jquery.royalslider.min.js"></script> <script type="text/javascript" src="/files/templates/designs/dwsimple/assets/scripts/minify/bootstrap.min.js"></script> <script type="text/javascript" src="/files/templates/designs/dwsimple/assets/scripts/js.cookie.js"></script> <script type="text/javascript" src="/files/templates/designs/dwsimple/assets/scripts/jquery.cookie.js"></script> <script type="text/javascript" src="/files/templates/designs/dwsimple/assets/scripts/minify/jquery.elevatezoom.min.js?v=1.1"></script> <script type="text/javascript" src="/files/templates/designs/dwsimple/assets/scripts/minify/jquery.owl.carousel.min.js"></script> <script type="text/javascript" src="/files/templates/designs/dwsimple/assets/scripts/bundle.min.js"></script> <link rel="stylesheet" type="text/css" media="all" href="/files/templates/designs/dwsimple/assets/css/font-awesome.min.css"> @if (!string.IsNullOrEmpty(Pageview.Area.Item["ProductVariantPage"].ToString())) { <script> BELUGI.UI.productVariantsHtml = '@("/" + Pageview.Area.Item["ProductVariantPage"])'; </script> } </body> </html>