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