Error executing template "Designs/identity_v2/_parsed/espresso.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_874f27c6a25a4779aacc3c4acabf086d.Execute() in D:\dynamicweb.net\Solutions\id.espresso4.dk-e5\Files\Templates\Designs\identity_v2\_parsed\espresso.parsed.cshtml:line 43
at 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.<RunCompile>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Co3.Espresso.Website.TemplateBases.Pages.PageBase
2 @using System.Data
3 @using System.IO
4 @using System.Web
5 @using System.Globalization
6 @using System.Web.Script.Serialization
7 @using Co3.Espresso.Website.Models.FrontEnd
8 @using Co3.Espresso.Website.Services
9 @using Co3.ID.Dw.Helpers
10 @using Co3.ID.Dw.Models.Frontend
11 @using Co3.ID.Dw.Models.Frontend.Ecommerce
12 @using Co3.ID.Dw.Models.Frontend.Users
13 @using Dynamicweb.Frontend
14 @using Dynamicweb.Ecommerce.Common
15 @using Dynamicweb.Environment
16 @using Dynamicweb.Security.UserManagement
17 @using Newtonsoft.Json
18
19 @{
20 ShopType shopContext = SiteContext.CurrentSiteContext();
21
22 bool isUserAuthenticated = shopContext == ShopType.B2B;
23 string globalAreaLang = PageView.Current().Area.CultureInfo.TwoLetterISOLanguageName;
24 string globalAreaName = PageView.Current().Area.UrlName;
25 string culture = PageView.Current().Area.Culture;
26 int areaId = PageView.Current().Area.ID;
27
28 bool isStagingUrl = HttpContext.Current.Request.Url.Host.ToLowerInvariant().Contains("staging");
29 bool isProductPage = HttpContext.Current.Request["productid"] != null;
30
31 bool globalPrefix = PageView.Current().Area.UrlIgnoreForChildren;
32 if (globalPrefix == true)
33 {
34 globalAreaName = string.Empty;
35 }
36 CultureInfo currencyCulture = new CultureInfo(Context.Currency.CultureInfo);
37
38 string currencySeparatorDecimal = PageView.Current().User != null ? ExecutingContext.GetCulture().NumberFormat.NumberDecimalSeparator : currencyCulture.NumberFormat.NumberDecimalSeparator;
39 string currencySeparatorInteger = PageView.Current().User != null ? ExecutingContext.GetCulture().NumberFormat.NumberGroupSeparator : currencyCulture.NumberFormat.NumberGroupSeparator;
40
41 string openGraphUrl = PageView.Current().SearchFriendlyUrl;
42 string openGraphImage = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Host + Espresso.OpenGraphImage;
43 bool loadGoogleTagManager = !string.IsNullOrEmpty(Espresso.Area.GoogleTagManagerID) &&
44 !(Espresso.Area.Item.GoogleTagManagerDisableIfPerformanceTestIsDetected == "True" && HttpContext.Current.Request.UserAgent.ToLower().Contains("lighthouse"));
45
46 string espressoCriticalJsFile = HttpContext.Current.Server.MapPath("/Files/Templates/Designs/identity_v2/_assets/_dist/js/critical.js");
47 string espressoCriticalJs = File.ReadAllText(espressoCriticalJsFile);
48
49 string espressoCriticalCssFile = HttpContext.Current.Server.MapPath("/Files/Templates/Designs/identity_v2/_assets/_dist/css/critical.css");
50 string espressoCriticalCss = File.ReadAllText(espressoCriticalCssFile);
51
52 object campaignColors = Co3.ID.Dw.Services.AreaService.Instance.GetAreaCampaignSwatches(PageView.Current().AreaID);
53
54 bool shouldTrackRelewise = shopContext != ShopType.CustomerShop;
55
56
57
58 }
59 <!DOCTYPE html>
60 <html lang="@globalAreaLang" data-separator-integer="@currencySeparatorInteger" data-separator-decimal="@currencySeparatorDecimal" data-area="@globalAreaName" data-area-id="@areaId" data-state="@shopContext.ToString()" data-context="id" data-is-b2b="@(shopContext == ShopType.B2B)">
61 <head>
62 <!-- The initial config of Consent Mode -->
63
64 <script>
65 window.dataLayer = window.dataLayer || [];
66
67 function gtag(){ dataLayer.push(arguments); }
68
69 gtag('consent', 'default', {
70 'ad_storage': 'denied',
71 'ad_user_data': 'denied',
72 'ad_personalization': 'denied',
73 'analytics_storage': 'denied',
74 'wait_for_update': 500
75 });
76 gtag('set', 'ads_data_redaction', true);
77 </script>
78
79 <!-- Cookie Information Pop-up Script is required for the SDK -->
80 <script id="CookieConsent" src="https://policy.app.cookieinformation.com/uc.js" data-culture="@globalAreaLang.ToUpperInvariant()" data-gcm-version="2.0" type="text/javascript"></script>
81
82
83 @if (loadGoogleTagManager)
84 {
85 <!-- Google Tag Manager -->
86 <script>
87 (function(w, d, s, l, i) {
88 w[l] = w[l] || [];
89 w[l].push({
90 'gtm.start':
91 new Date().getTime(),
92 event: 'gtm.js'
93 });
94
95 var f = d.getElementsByTagName(s)[0],
96 j = d.createElement(s),
97 dl = l != 'dataLayer' ? '&l=' + l : '';
98 j.async = true;
99 j.src =
100 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
101 f.parentNode.insertBefore(j, f);
102 })(window, document, 'script', 'dataLayer', '@Espresso.Area.GoogleTagManagerID');
103 </script>
104 <!-- End Google Tag Manager -->
105 }
106 @GetValue("CopyRightNotice")
107 <meta charset="utf-8">
108 <meta content="width=device-width, initial-scale=1, shrink-to-fit=no, minimal-ui" name="viewport">
109 <meta content="ie=edge" http-equiv="x-ua-compatible">
110 <link href="https://cdnjs.cloudflare.com" rel="preconnect">
111 <link href="https://www.googletagmanager.com" rel="preconnect">
112 <link href="https://www.google-analytics.com" rel="preconnect">
113 <link href="https://connect.facebook.net" rel="preconnect">
114 <title>@GetValue("Title")</title>
115 <style>
116 @espressoCriticalCss
117 </style>
118 @RenderSnippet("webfonts")
119 <link id="identity-main-style" href="/Files/Templates/Designs/identity_v2/_assets/_dist/css/default.css?v=2.40" media="@Espresso.StylesheetAttributeMedia" rel="@Espresso.StylesheetAttributeRel" as="style">
120 <script>
121 @espressoCriticalJs
122 </script>
123 @RenderingService.Instance.PartialView("_partials/productdesigner-load-cart.cshtml")
124 <script>
125 var campaignColors = @campaignColors;
126 var root = document.querySelector(':root');
127 Object.keys(campaignColors).forEach(function (swatchKey){
128 if(swatchKey.indexOf('BrandColor') > -1){
129 root.style.setProperty(`--campaign-bg-${swatchKey.replace('BrandColor', '')}`, campaignColors[swatchKey]);
130 } else{
131 root.style.setProperty(`--campaign-text-${swatchKey.replace('NeutralColor', '')}`, campaignColors[swatchKey]);
132 }
133 });
134 </script>
135 <link rel="shortcut icon" href="@Espresso.Area.Item.Favicon">
136 <meta name="description" content="@Espresso.DynamicwebPage.Description">
137 @GetValue("MetaTags")
138 @if (Espresso.IsStagingUrl)
139 {
140 <meta content="noindex,nofollow" name="robots">
141 }
142 <meta property="og:url" content="@openGraphUrl">
143 <meta property="og:title" content="@Espresso.OpenGraphTitle">
144 <meta property="og:description" content="@Espresso.OpenGraphDescription">
145 <meta property="og:image" content="@openGraphImage">
146 <meta property="og:type" content="website">
147 @if (string.IsNullOrEmpty(Espresso.Area.Item.GoogleSiteVerification) == false)
148 {
149 <meta name="google-site-verification" content="@Espresso.Area.Item.GoogleSiteVerification">
150 }
151
152 @if (isStagingUrl == false)
153 {
154 <script>
155 window.sleeknoteSiteData || (window.sleeknoteSiteData = []);
156 </script>
157 }
158
159
160
161 @if (isStagingUrl == false)
162 {
163 <!-- Start of Sleeknote signup and lead generation tool - www.sleeknote.com -->
164 <script id='sleeknoteScript' type='text/javascript'>
165 (function () { var sleeknoteScriptTag = document.createElement('script');
166 sleeknoteScriptTag.type = 'text/javascript';
167 sleeknoteScriptTag.charset = 'utf-8';
168 sleeknoteScriptTag.src = ('//sleeknotecustomerscripts.sleeknote.com/25665.js');
169 var s = document.getElementById('sleeknoteScript');
170 s.parentNode.insertBefore(sleeknoteScriptTag, s);
171 })();
172 </script>
173 <!-- End of Sleeknote signup and lead generation tool - www.sleeknote.com -->
174 }
175
176
177 <script class="usercontext-gtm">
178 dataLayer.push({
179 'UserContext': '@shopContext.ToString()',
180 'event': 'UserContext'
181 });
182 </script>
183
184
185 </head>
186
187 @{
188 ClassList bodyClasses = new ClassList();
189 bodyClasses.AddClasses( Espresso.Item.CustomClasses );
190
191 bodyClasses.AddClasses($"shoptype-{shopContext.ToString()}");
192
193 }
194
195 <body class="@bodyClasses" data-is-user-authenticated="@isUserAuthenticated.ToString().ToLower()" data-design="@Espresso.Area.DesignsFolderName" data-culture="@culture">
196
197 @if (loadGoogleTagManager)
198 {
199 <!-- Google Tag Manager (noscript) -->
200 <noscript>
201 <iframe src="https://www.googletagmanager.com/ns.html?id=@Espresso.Area.GoogleTagManagerID" height="0" width="0" style="display: none; visibility: hidden"></iframe>
202 </noscript>
203 <!-- End Google Tag Manager (noscript) -->
204 }
205
206 @using Co3.Espresso.Website.Models.FrontEnd
207 @using Co3.Espresso.Website.Models.FrontEnd.Settings
208 @using Co3.Espresso.Website.Services
209 @using Dynamicweb.Frontend
210 @inherits Co3.Espresso.Website.TemplateBases.Pages.PageBase
211 @{
212 Espresso.Canvas.Classes.AddClasses( "js-e-canvas is-loading" );
213 if ( Espresso.Item.CanvasFullscreen == "True" )
214 {
215 Espresso.Canvas.Classes.AddClasses( "is-fullscreen" );
216 }
217 string campaignSplash = Espresso.Area.Item.CampaignSplash;
218
219 string redirect = GetGlobalValue("Global:Pageview.Url.Raw");
220 HttpCookie userSavedAreaLanguage = HttpContext.Current.Request.Cookies[ "e4.redirect.language" ];
221 HttpCookie userDisableRedirect = HttpContext.Current.Request.Cookies[ "e4.redirect.disabled" ];
222 }
223
224
225
226 <div class="e-loading-overlay e-page-loading-overlay is-loading js-e-page-loading-overlay">
227 @RenderingService.Instance.PartialView( "_partials/loading-spinner.cshtml" )
228 </div>
229
230 @RenderingService.Instance.PartialView( "_partials/webfonts.cshtml", Espresso )
231 <div class="@Espresso.Canvas.Classes">
232 @RenderingService.Instance.PartialView( "_partials/header.cshtml", Espresso )
233 @*@RenderingService.Instance.PartialView( "usermanagement/viewprofile/espresso-impersonate-user-msg.cshtml", Espresso )*@
234
235 <main id="dwcontentmain" class="e-content js-e-content @Espresso.ContentArea.Classes">
236 @RenderingService.Instance.PartialView( "_partials/breadcrumb.cshtml", Espresso )
237 <article class="e-content-article">
238 @RenderingService.Instance.PartialView( "_partials/nav-local-horizontal.cshtml", Espresso )
239 @RenderingService.Instance.PartialView( "_partials/nav-local-vertical.cshtml", Espresso )
240 @RenderingService.Instance.SectionStart( new SectionSettings() )
241 @GetValue("DwContent(dwcontentmain)")
242 @RenderingService.Instance.SectionEnd()
243 </article>
244 </main>
245
246 @RenderingService.Instance.PartialView( "_partials/footer.cshtml", Espresso )
247
248 @if ( !string.IsNullOrEmpty( GetString( "DwContent(dwcontentcta)" ) ) )
249 {
250 <aside class="e-cta fixed-top is-hidden js-e-cta" id="dwcontentcta">
251 @RenderingService.Instance.SectionStart( new SectionSettings
252 {
253 ContentClasses = new ClassList( "col-12" ),
254 OuterRowClasses = new ClassList("row no-gutters"),
255 InnerRowClasses = new ClassList("row no-gutters justify-content-center align-items-center")
256 } )
257 @GetValue("DwContent(dwcontentcta)")
258 @RenderingService.Instance.SectionEnd()
259
260 </aside>
261 }
262
263 @RenderingService.Instance.PartialView( "ecom7/cartv2/step/espresso-cart-msg.cshtml" )
264 </div>
265
266 @RenderingService.Instance.PartialView( "_partials/search.cshtml", Espresso )
267
268 @RenderingService.Instance.PartialView( "_partials/back-to-top.cshtml", Espresso )
269 @RenderingService.Instance.PartialView("/Extranet/partials/identity-login.cshtml", Espresso)
270
271 @if (string.IsNullOrEmpty(campaignSplash) == false)
272 {
273 int campaignSplashParagraphId;
274 int.TryParse(campaignSplash, out campaignSplashParagraphId);
275 if (campaignSplashParagraphId > 0)
276 {
277 @RenderParagraphContent(campaignSplashParagraphId);
278 }
279
280 }
281
282 @if ( 1 == 2 )
283 {
284 @GetValue("DwCookieWarning")
285 }
286
287 @if ( userSavedAreaLanguage == null )
288 {
289 //@RenderingService.Instance.PartialView( "_partials/redirect.cshtml" )
290 }
291 else
292 {
293 string currentAreaLanguage = PageView.Current().Area.UrlName;
294 string savedAreaLanguage = userSavedAreaLanguage.Value;
295 bool disabledRedirectForSession = userDisableRedirect != null ? Boolean.Parse( HttpContext.Current.Request.Cookies[ "e4.redirect.disabled" ].Value ) : false;
296
297 if ( currentAreaLanguage != savedAreaLanguage && disabledRedirectForSession == false )
298 {
299 string redirectUrl = string.Format( "{0}://{1}/{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, savedAreaLanguage);
300 HttpContext.Current.Response.Redirect(redirectUrl);
301
302 }
303
304 }
305
306
307
308 @if ( shouldTrackRelewise )
309 {
310
311 IdentityProduct itemIdentityProduct = (IdentityProduct)HttpContext.Current.Items["IdentityProduct"];
312 bool isRelewiseCategoryPage = PageView.Current().Page.Item["RelewiseCategory"] != null ? (bool)PageView.Current().Page.Item["RelewiseCategory"] : false;
313
314 if (isRelewiseCategoryPage)
315 {
316 string productCategory = (string)HttpContext.Current.Items["IdentityProductCategory"];
317 if (!string.IsNullOrEmpty(productCategory))
318 {
319 Co3.ID.Dw.Relewise.Services.TrackerService.Instance.TrackCategoryView(PageView.Current().Page.ID.ToString());
320 }
321 } else if (!isProductPage && itemIdentityProduct == null)
322 {
323 Co3.ID.Dw.Relewise.Services.TrackerService.Instance.TrackContentView(PageView.Current().Page.ID.ToString());
324 } else if (isProductPage && itemIdentityProduct != null)
325 {
326 Co3.ID.Dw.Relewise.Services.TrackerService.Instance.TrackProductView(itemIdentityProduct);
327 }
328 }
329
330 @Co3.ID.Dw.Services.ScriptService.Instance.RenderScripts()
331 @Co3.ID.Dw.Services.ScriptService.Instance.GetScript("default")
332
333
334 </body>
335
336 @GetValue("CopyRightNotice")
337 </html>