Error executing template "Designs/bloomingville/_parsed/espresso.parsed.cshtml"System.NullReferenceException: Object reference not set to an instance of an object.at CompiledRazorTemplates.Dynamic.RazorEngine_49d0ff483a22415e9e0edb99984bf6e6.Execute() in E:\Dynamicweb.NET\Solutions\bloomingville.espresso4.dk\Files\Templates\Designs\bloomingville\_parsed\espresso.parsed.cshtml:line 35at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Co3.Espresso.Website.TemplateBases.Pages.PageBase 2 @using System 3 @using System.Collections.Generic 4 @using System.IO 5 @using System.Web 6 @using System.Globalization 7 @using System.Linq 8 @using Co3.Espresso.Website.Services 9 @using Dynamicweb.Content 10 @using Dynamicweb.Frontend 11 @using Dynamicweb.Ecommerce.Common 12 @using Dynamicweb.Security.UserManagement 13 @using Page = Dynamicweb.Content.Page 14 @using Dynamicweb.Environment 15 @using Dynamicweb.Environment.Web 16 @using Dynamicweb.UserManagement.Frontend 17 18 @{ 19 if ( !string.IsNullOrEmpty( HttpContext.Current.Request[ "removeLangCookie" ] ) ) 20 { 21 CookieManager.SetCookie( "AlwaysRedirectTo", "", DateTime.Now.AddDays( -1 ) ); 22 } 23 24 bool isUserAuthenticated = User.IsExtranetUserLoggedIn(); 25 bool showLangModal = CookieManager.GetCookie( "AlwaysRedirectTo") == null; 26 string language = HttpContext.Current.Request[ "language" ]; 27 bool loginRequired = !string.IsNullOrEmpty( HttpContext.Current.Request[ "loginrequired" ] ); 28 29 string globalAreaLang = PageView.Current().Area.CultureInfo.TwoLetterISOLanguageName; 30 CultureInfo currencyCulture = new CultureInfo( Context.Currency.CultureInfo ); 31 string currencySeparatorDecimal = currencyCulture.NumberFormat.NumberDecimalSeparator; 32 string currencySeparatorInteger = currencyCulture.NumberFormat.NumberGroupSeparator; 33 string openGraphUrl = PageView.Current().SearchFriendlyUrl; 34 string openGraphImage = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Host + Espresso.OpenGraphImage; 35 bool loadGoogleTagManager = !string.IsNullOrEmpty( Espresso.Area.GoogleTagManagerID ) && 36 !(Espresso.Area.Item.GoogleTagManagerDisableIfPerformanceTestIsDetected == "True" && HttpContext.Current.Request.UserAgent.ToLower().Contains( "lighthouse" )); 37 string googleMapsApiKey = Espresso.Area.Item.GoogleMapsAPIkey; 38 39 string globalAreaName = string.Empty; 40 if ( string.IsNullOrEmpty( PageView.Current().Area.Domain ) ) 41 { 42 globalAreaName = PageView.Current().Area.Name; 43 } 44 45 if ( loginRequired && !isUserAuthenticated ) 46 { 47 string loginPage = Espresso.Area.Item.ExtranetLoginPage?.ToString(); 48 if ( !string.IsNullOrEmpty( loginPage ) ) 49 { 50 string pageUrl = HttpContext.Current.Request.Url.ToString(); 51 pageUrl = pageUrl.Split( new string[] {"&loginrequired"}, StringSplitOptions.None )[ 0 ]; 52 pageUrl = pageUrl.Split( new string[] {"?loginrequired"}, StringSplitOptions.None )[ 0 ]; 53 pageUrl = pageUrl.Split( new string[] {"/Default"}, StringSplitOptions.None )[ 1 ]; 54 string redirectUrl = string.Format( "/{0}&AfterLoginRedirect=/Default{1}", loginPage, HttpUtility.UrlEncode(pageUrl)); 55 HttpContext.Current.Response.Redirect(redirectUrl); 56 } 57 } 58 } 59 60 @{ 61 if ( !string.IsNullOrEmpty( language ) ) 62 { 63 bool remember = !string.IsNullOrEmpty( HttpContext.Current.Request[ "remember" ] ); 64 if ( remember ) 65 { 66 CookieManager.SetCookie( "AlwaysRedirectTo", language, DateTime.Now.AddDays( 30 ) ); 67 } 68 else 69 { 70 CookieManager.SetCookie( "AlwaysRedirectTo", language, DateTime.Now.AddHours( 1 ) ); 71 } 72 HttpContext.Current.Response.Redirect(string.Format("/{0}", language)); 73 } 74 } 75 76 77 @functions { 78 public Page GetCurrentPagesBrandPageId(Page page) 79 { 80 int[] brandPageIds = { int.Parse( Espresso.Area.Item.BloomingvillePageId ), int.Parse( Espresso.Area.Item.BloomingvilleKidsPageId ), int.Parse( Espresso.Area.Item.CreativeCollectionPageId ), int.Parse( Espresso.Area.Item.IllumePageId ) }; 81 82 if(brandPageIds.Contains(page.ID)){ 83 return page; 84 } else { 85 if ( page.Parent != null ) 86 { 87 return GetCurrentPagesBrandPageId(page.Parent); 88 } 89 else 90 { 91 return null; 92 } 93 } 94 } 95 } 96 97 @{ 98 Page currentPage = PageView.Current().Page; 99 Page currentBrandPage = new Page();100 string currentBrandPageName = string.Empty;101 if (GetCurrentPagesBrandPageId( currentPage ) != null )102 {103 currentBrandPage = GetCurrentPagesBrandPageId( currentPage );104 currentBrandPageName = currentBrandPage.GetDisplayName().ToLower().Replace(" ", "-");105 }106107 string productTitleSnippetHtml = RenderSnippet( "productTitle" ).ToString().Trim();108109 bool isProductPage = string.IsNullOrEmpty(HttpContext.Current.Request[ "productid" ]) == false;110111 string eComCanonicalSnippetTag = RenderSnippet( "eComCanonical" ).ToString().Trim();112113 string globalValueUrl = GetGlobalValue("Global:Pageview.Url");114115 if (GetGlobalValue("Global:Pageview.Url").IndexOf("?") > -1 )116 {117 globalValueUrl = GetGlobalValue("Global:Pageview.Url").Substring(0, GetGlobalValue("Global:Pageview.Url").IndexOf("?"));118 }119120 string canonicalPageView = String.Format("{0}://{1}{2}", GetGlobalValue("Global:Request.Scheme"), GetGlobalValue("Global:Request.Host"), globalValueUrl);121 string pageCanonical = PageView.Current().Page.MetaCanonical;122 }123124 <!DOCTYPE html>125 <html lang="@globalAreaLang" data-separator-integer="@currencySeparatorInteger" data-separator-decimal="@currencySeparatorDecimal" data-area="@globalAreaName">126 <head>127 @GetValue( "CopyRightNotice" )128 <meta charset="utf-8">129 <meta content="width=device-width, initial-scale=1, shrink-to-fit=no, minimal-ui" name="viewport">130 <meta content="ie=edge" http-equiv="x-ua-compatible">131132 @if ( isProductPage == false )133 {134 <title>@GetValue("Title")</title>135136 if ( string.IsNullOrEmpty(pageCanonical) == true )137 {138 if ( GetString("DwPageID") == GetString("DwAreaFirstPageID") )139 {140 <link rel="canonical" href="/">141 } else {142 <link rel="canonical" href="@canonicalPageView">143 }144 }145 }146 else147 {148 @productTitleSnippetHtml149 <link rel="canonical" href="@eComCanonicalSnippetTag">150 }151152 <title>@GetString( "Title" )</title>153 @Espresso.CriticalCSS154 @RenderSnippet( "webfonts" )155 <link href="/Files/Templates/Designs/bloomingville/_assets/_dist/css/default.css?v=1.20.6" media="@Espresso.StylesheetAttributeMedia" rel="@Espresso.StylesheetAttributeRel" as="style">156 @Espresso.CriticalJS157 <link href="https://cdnjs.cloudflare.com" rel="preconnect">158 <link href="https://www.googletagmanager.com" rel="preconnect">159 <link href="https://www.google-analytics.com" rel="preconnect">160 <link href="https://connect.facebook.net" rel="preconnect">161 <link rel="shortcut icon" href="@Espresso.Area.Item.Favicon">162 <meta name="description" content="@Espresso.DynamicwebPage.Description">163 @GetValue( "MetaTags" )164 @if ( Espresso.IsStagingUrl )165 {166 <meta content="noindex,nofollow" name="robots">167 }168 <meta property="og:url" content="@openGraphUrl">169 <meta property="og:title" content="@Espresso.OpenGraphTitle">170 <meta property="og:description" content="@Espresso.OpenGraphDescription">171 <meta property="og:image" content="@openGraphImage">172 <meta property="og:type" content="website">173 @if ( string.IsNullOrEmpty( Espresso.Area.Item.GoogleSiteVerification ) == false )174 {175 <meta name="google-site-verification" content="@Espresso.Area.Item.GoogleSiteVerification">176 }177178 <meta name="facebook-domain-verification" content="2di4a43jn7m9nx966qmop75zybva30">179180 <!-- Hreflang -->181 @{182 @* Get areas from service *@183 Dynamicweb.Content.AreaService areaService = new Dynamicweb.Content.AreaService();184 IList<Area> areas = areaService.GetAreas();185 @* Get current page's relation-text from page-item *@186 string currentPageRelation = PageView.Current().Page.Item["PageRelation"] != null ? PageView.Current().Page.Item["PageRelation"].ToString() : string.Empty;187 @* Frontpage must have 'frontpage' as relation-text *@188 string CONST_frontpageRelation = "frontpage";189 const int REDIRECT_ID = 23;190 string domainBase = areas.FirstOrDefault( a => a.ID == REDIRECT_ID ).DomainLock;191 List<dynamic> areaInfoList = new List< dynamic >();192193194195 @* Iterate areas *@196 foreach ( Area area in areas )197 {198 if ( area.Active == true && area.ID != REDIRECT_ID )199 {200201 @* Get current area's culture *@202 string culture = area.Culture;203 @* Check for IsDefault Hreflang on area *@204 string isDefaultHrefLang = area.Item[ "IsDefaultHrefLang" ] != null ? area.Item[ "IsDefaultHrefLang" ].ToString() : string.Empty;205 @* Check for override-culture text on area *@206 string hreflangCultureOverride = area.Item[ "HreflangLanguageOverride" ] != null ? area.Item[ "HreflangLanguageOverride" ].ToString() : string.Empty;207 @* Get scheme and domain *@208 string scheme = GetGlobalValue("Global:Request.Scheme");209 string domain = domainBase;210 @* If we have a primary domain call pageservice and get pages *@211212 string productId = HttpContext.Current.Request[ "productid" ];213 if (string.IsNullOrEmpty(productId) == false)214 {215 currentPageRelation = PageView.Current().Page.Parent.Item["PageRelation"].ToString();216 }217218 if ( string.IsNullOrEmpty(currentPageRelation) == false && string.IsNullOrEmpty(domain) == false )219 {220221222 Dynamicweb.Content.PageService pageService = new Dynamicweb.Content.PageService();223 IEnumerable< Dynamicweb.Content.Page > pages = pageService.GetPagesByAreaID(area.ID);224 @* Iterate pages in area - check if is active + has item + has item-pagerelation + item-pagerelation equals current pagerelation *@225 foreach ( Dynamicweb.Content.Page page in pages.Where(p => p.Published && p.Item != null && p.Item[ "PageRelation" ] != null && p.Item[ "PageRelation" ].ToString().Equals(currentPageRelation)) )226 {227228 string url = string.Empty;229 if ( string.IsNullOrEmpty(productId) == false )230 {231 @* Build url to area product page *@232 string prodUrl = string.Format("Default.aspx?ID={0}&ProductId={1}", pageService.GetPagesByParentID(page.ID)?.FirstOrDefault()?.ID, productId);233 url = string.Format("{0}://{1}{2}", scheme, domain, SearchEngineFriendlyURLs.GetFriendlyUrl(prodUrl, area.EcomLanguageId));234 }235 else236 {237 @* Build url to area page *@238 url = string.Format("{0}://{1}{2}", scheme, domain, SearchEngineFriendlyURLs.GetFriendlyUrl(page.GetPageHrefValue()));239 }240 @* If our current page relation match frontpage - set link to domain only *@241 if ( currentPageRelation == CONST_frontpageRelation )242 {243 url = string.Format("{0}://{1}", scheme, domain);244 }245 @* If our area item has checked in Default hreflang, we render x-default link *@246 if ( isDefaultHrefLang == "True" )247 {248 <link rel="alternate" hreflang="x-default" href="@url">249 }250 @* If we have a value in the area-item to overrule the culture, override the value here *@251 if ( string.IsNullOrEmpty(hreflangCultureOverride) == false )252 {253 culture = hreflangCultureOverride;254 }255 @* Render hreflang-link *@256 <link rel="alternate" hreflang="@culture.ToLower()" href="@url">257258 string translateKey = string.Format( "Language Modal - Link Text ({0}) - Label", culture.ToLower().Split( '-' )[ 0 ].ToUpper() );259260 areaInfoList.Add( new261 {262 culture = culture.ToLower(),263 language = culture.ToLower().Split('-')[0],264 label = Translate(translateKey, culture.ToLower().Split( '-' )[ 0 ].ToUpper()),265266 url = currentPageRelation == CONST_frontpageRelation ? string.Format("{0}/{1}", url, culture.ToLower().Split('-')[0]) : url267268 });269 }270 }271 }272 }273274 string struserPrimaryLanguage = string.Empty;275 string strUserSecondaryLanguage = string.Empty;276 string[] strUserLanguages = null;277 int strLength = 0;278279 if (HttpContext.Current.Request.UserLanguages != null)280 {281 struserPrimaryLanguage = HttpContext.Current.Request.UserLanguages[ 0 ].Split( '-' )[ 0 ].ToLower();282 strUserSecondaryLanguage = HttpContext.Current.Request.UserLanguages.Length >= 3 ? HttpContext.Current.Request.UserLanguages[ 2 ].Split( '-' )[ 0 ].ToLower() : string.Empty;283 strUserLanguages = HttpContext.Current.Request.UserLanguages;284 strLength = HttpContext.Current.Request.UserLanguages.Length;285 }286287 dynamic langModalInfo = new288 {289 isUserAuthenticated = isUserAuthenticated,290 currentAreaCulture = PageView.Current().Area.Culture,291 currentAreaLanguage = PageView.Current().Area.Culture.Split('-')[0].ToLower(),292 userPrimaryLanguage = struserPrimaryLanguage,293 userSecondaryLanguage = strUserSecondaryLanguage,294 userLanguages = strUserLanguages,295 length = strLength,296 areas = areaInfoList297 };298 }299 <!-- End Hreflang -->300301302 @if ( loadGoogleTagManager )303 {304 <!-- Google Tag Manager -->305 <script>306 (function(w, d, s, l, i) {307 w[l] = w[l] || [];308 w[l].push({309 'gtm.start':310 new Date().getTime(),311 event: 'gtm.js'312 });313 var f = d.getElementsByTagName(s)[0],314 j = d.createElement(s),315 dl = l != 'dataLayer' ? '&l=' + l : '';316 j.async = true;317 j.src =318 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;319 f.parentNode.insertBefore(j, f);320 })(window, document, 'script', 'dataLayer', '@Espresso.Area.GoogleTagManagerID');321 </script>322 <!-- End Google Tag Manager -->323 }324 </dynamic></head>325326 <body class="@Espresso.Item.CustomClasses brand-@currentBrandPageName" data-is-user-authenticated="@isUserAuthenticated.ToString().ToLower()" data-design="@Espresso.Area.DesignsFolderName">327 @if ( loadGoogleTagManager )328 {329 <!-- Google Tag Manager (noscript) -->330 <noscript>331 <iframe src="https://www.googletagmanager.com/ns.html?id=@Espresso.Area.GoogleTagManagerID" height="0" width="0" style="display: none; visibility: hidden"></iframe>332 </noscript>333 <!-- End Google Tag Manager (noscript) -->334 }335 @using Co3.Espresso.Website.Models.FrontEnd336 @using Co3.Espresso.Website.Models.FrontEnd.Settings337 @using Co3.Espresso.Website.Services338 @inherits Co3.Espresso.Website.TemplateBases.Pages.PageBase339 @{340 Espresso.Canvas.Classes.AddClasses( "js-e-canvas is-loading" );341 if ( Espresso.Item.CanvasFullscreen == "True" )342 {343 Espresso.Canvas.Classes.AddClasses( "is-fullscreen" );344 }345 }346347348349 <div class="e-loading-overlay e-page-loading-overlay is-loading js-e-page-loading-overlay">350 @RenderingService.Instance.PartialView( "_partials/loading-spinner.cshtml" )351 </div>352353 @RenderingService.Instance.PartialView( "_partials/webfonts.cshtml", Espresso )354355 <div class="@Espresso.Canvas.Classes">356 @RenderingService.Instance.PartialView( "_partials/header.cshtml", Espresso )357 @RenderingService.Instance.PartialView( "usermanagement/viewprofile/espresso-impersonate-user-msg.cshtml", Espresso )358 @RenderingService.Instance.PartialView( "_partials/nav-local-horizontal.cshtml", Espresso )359 <main id="dwcontentmain" class="e-content js-e-content @Espresso.ContentArea.Classes">360 @RenderingService.Instance.PartialView( "_partials/breadcrumb.cshtml", Espresso )361 <article class="e-content-article">362 @RenderingService.Instance.PartialView( "_partials/nav-local-vertical.cshtml", Espresso )363 @RenderingService.Instance.SectionStart( new SectionSettings() )364 @GetValue("DwContent(dwcontentmain)")365 @RenderingService.Instance.SectionEnd()366 </article>367 </main>368369 @RenderingService.Instance.PartialView( "_partials/footer.cshtml", Espresso )370371 @if ( !string.IsNullOrEmpty( GetString( "DwContent(dwcontentcta)" ) ) )372 {373 <aside class="e-cta fixed-top is-hidden js-e-cta" id="dwcontentcta">374 @RenderingService.Instance.SectionStart( new SectionSettings375 {376 ContentClasses = new ClassList( "col-12" ),377 OuterRowClasses = new ClassList("row no-gutters"),378 InnerRowClasses = new ClassList("row no-gutters justify-content-center align-items-center")379 } )380 @GetValue("DwContent(dwcontentcta)")381 @RenderingService.Instance.SectionEnd()382383 </aside>384 }385386 @RenderingService.Instance.PartialView( "ecom7/cartv2/step/espresso-cart-msg.cshtml" )387 </div>388389 @RenderingService.Instance.PartialView( "_partials/search.cshtml", Espresso )390391 @RenderingService.Instance.PartialView( "_partials/back-to-top.cshtml", Espresso )392393 @if ( 1 == 2 )394 {395 @GetValue("DwCookieWarning")396 }397398399 @{400 if ( langModalInfo.isUserAuthenticated == false && langModalInfo.currentAreaLanguage != langModalInfo.userPrimaryLanguage && showLangModal )401 {402 bool hasSecondaryLanguageMatch = areaInfoList.Any( ai => ai.language == langModalInfo.userSecondaryLanguage );403 bool hasPrimaryLanguageMatch = areaInfoList.Any( ai => ai.language == langModalInfo.userPrimaryLanguage );404405406 bool firstArea = true;407 <div class="boomingville-language-modal fade modal" data-backdrop="true" data-keyboard="true" id="js-boomingville-language-modal">408 <div class="modal-dialog modal-dialog-centered" role="document">409 <div class="modal-content">410 <div class="modal-body text-center">411 <button class="close" data-dismiss="modal" type="button">412 <i class="material-icons">close</i>413 </button>414415 <p class="mt-0 d-inline-block h2">@Translate("Language Modal - Select A Language", "Select a language")</p>416 <form method="post" class="js-language-modal-form">417418 <div class="form-group mt-0 mb-0 small">419 <div class="d-inline-block form-check">420 <label class="form-check-label" for="remember"><input class="form-check-input mr-1" id="remember" name="remember" type="checkbox" value="1">@Translate("Language Modal - Remember choose - Text", "Remember choose")</label>421 </div>422 </div>423424 <ul class="lang-picker justify-content-center">425 @foreach ( dynamic area in langModalInfo.areas )426 {427 string isChecked = string.Empty;428 string languageToCheckWith = langModalInfo.currentAreaLanguage;429430 isChecked = area.language == languageToCheckWith ? "checked" : string.Empty;431432 if ( !string.IsNullOrEmpty( isChecked ) )433 {434 <li><input type="radio" name="language" id="lang_@area.language" value="@area.language" checked=""><label for="lang_@area.language" class="btn btn-secondary border js-btn-lang btn-sm d-block">@area.label</label></li>435 }436 else437 {438 <li><input type="radio" name="language" id="lang_@area.language" value="@area.language"><label for="lang_@area.language" class="btn border-primary border js-btn-lang btn-sm d-block">@area.label</label></li>439 }440 }441 </ul>442 <button type="submit" class="btn d-none btn-lg btn-secondary px-4">@Translate( "Language Modal - Go To Site - Text", "Go to site" )</button>443 </form>444 </div>445 </div>446 </div>447 </div>448 }449 }450451 <script>var areasJSON = @JsonService.Instance.ToJson(langModalInfo)</script>452453454 <script>455 window.dataLayer.push({456 'event':'ipEvent',457 'ipAddress' : '@Dynamicweb.Context.Current.Request.UserHostAddress',458 'userlogon' : '@isUserAuthenticated'459 });460 </script>461 <script data-cookieconsent="ignore" async="" src="/Files/Templates/Designs/bloomingville/_assets/_dist/js/default.js?v=3.60.15"></script>462463 <!-- Active Campagin -->464 <script type="text/plain" data-cookieconsent="statistics">465 (function(e,t,o,n,p,r,i){e.visitorGlobalObjectAlias=n;e[e.visitorGlobalObjectAlias]=e[e.visitorGlobalObjectAlias]||function(){(e[e.visitorGlobalObjectAlias].q=e[e.visitorGlobalObjectAlias].q||[]).push(arguments)};e[e.visitorGlobalObjectAlias].l=(new Date).getTime();r=t.createElement("script");r.src=o;r.async=true;i=t.getElementsByTagName("script")[0];i.parentNode.insertBefore(r,i)})(window,document,"https://diffuser-cdn.app-us1.com/diffuser/diffuser.js","vgo");466 vgo('setAccount', '90836404');467 vgo('setTrackByDefault', true);468 vgo('process');469 </script>470 <!-- End Active Campign -->471472 <script src="//rum-static.pingdom.net/pa-6177c25f405b1d0011000208.js" async=""></script>473 </body>474475 @GetValue( "CopyRightNotice" )476 </html>477