Error executing template "Designs/Swift/_parsed/Swift_Page.parsed.cshtml"
System.ArgumentException: Page ID must be greater than 0, but it was 0
at Dynamicweb.Core.Ensure.That[TException](Boolean condition, String message)
at Dynamicweb.Content.ParagraphService.GetParagraphsByPageId(Int32 pageId, ParagraphSort sortBy)
at Dynamicweb.Frontend.Content.GetParagraphs(Int32 pageId)
at Dynamicweb.Frontend.Content.CreateGridContent(Int32 contentId, Boolean ignoreVisualEdit)
at Dynamicweb.Frontend.Content.RenderExternalGrid(Int32 pageId, String container)
at CompiledRazorTemplates.Dynamic.RazorEngine_08d380060b8044f19ec0605c75515953.Execute() in C:\inetpub\wwwroot\AllMedia\Production\Files\Templates\Designs\Swift\_parsed\Swift_Page.parsed.cshtml:line 548
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 Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
2 @using System
3 @using Dynamicweb
4 @using Dynamicweb.Environment
5 @using Dynamicweb.Frontend
6 @using BrandFusion.Dw.AllMedia.Ecommerce
7 @using Dynamicweb.Ecommerce.Prices
8
9 @functions {
10 string GetCookieOptInPermission(string category)
11 {
12 bool categoryOrAllGranted = false;
13
14 if (CookieManager.IsCookieManagementActive)
15 {
16 var cookieOptInLevel = CookieManager.GetCookieOptInLevel();
17 var cookieOptInCategories = CookieManager.GetCookieOptInCategories();
18 categoryOrAllGranted = cookieOptInCategories.Contains(category) || cookieOptInLevel == CookieOptInLevel.All;
19
20 }
21
22 return categoryOrAllGranted ? "granted" : "denied";
23 }
24
25 bool AllowTracking()
26 {
27 bool allowTracking = true;
28 if (CookieManager.IsCookieManagementActive)
29 {
30 var cookieOptInLevel = CookieManager.GetCookieOptInLevel();
31 var cookieOptInCategories = CookieManager.GetCookieOptInCategories();
32
33 bool consentEither = (cookieOptInCategories.Contains("Statistical") || cookieOptInCategories.Contains("Marketing"));
34 bool consentFunctional = cookieOptInLevel == CookieOptInLevel.Functional;
35 bool consentAtLeastOne = cookieOptInLevel == CookieOptInLevel.All || (consentFunctional && consentEither);
36
37 allowTracking = consentAtLeastOne;
38 }
39 return allowTracking;
40 }
41 }
42
43 @{
44 string swiftVersion = ReadFile("/Files/Templates/Designs/Swift/swift_version.txt");
45 bool renderAsResponsive = Model.Area.Item.GetString("DeviceRendering", "responsive").Equals("responsive", StringComparison.OrdinalIgnoreCase);
46 bool renderMobile = Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Mobile || Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Tablet;
47 string responsiveClassDesktop = string.Empty;
48 string responsiveClassMobile = string.Empty;
49 if (renderAsResponsive)
50 {
51 responsiveClassDesktop = " d-none d-xl-block";
52 responsiveClassMobile = " d-block d-xl-none";
53 }
54
55 var disableWideBreakpoints = Model.Area?.Item?.GetRawValueString("DisableWideBreakpoints", "default");
56
57 var brandingPageId = Model.Area.Item.GetLink("BrandingPage") != null ? Model.Area.Item.GetLink("BrandingPage").PageId : 0;
58 var themePageId = Model.Area.Item.GetLink("ThemesPage") != null ? Model.Area.Item.GetLink("ThemesPage").PageId : 0;
59 string customHeaderInclude = Model.Area.Item.GetFile("CustomHeaderInclude") != null ? Model.Area.Item.GetFile("CustomHeaderInclude").Name : string.Empty;
60
61 var brandingPage = Dynamicweb.Services.Pages?.GetPage(brandingPageId) ?? null;
62 var themesParagraphLastChanged = Services.Paragraphs.GetParagraphsByPageId(themePageId).OrderByDescending(p => p.Audit.LastModifiedAt).FirstOrDefault();
63
64 var cssLastModified = brandingPage.Audit.LastModifiedAt > themesParagraphLastChanged.Audit.LastModifiedAt ? brandingPage.Audit.LastModifiedAt : themesParagraphLastChanged.Audit.LastModifiedAt;
65 var cssThemeAndBrandingStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath($"/Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_{Model.Area.ID}.min.css"));
66
67 // Schema.org details for PDP
68 string productId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : "";
69 bool isProductDetailsPage = !string.IsNullOrEmpty(productId);
70 bool isArticlePage = Model.ItemType == "Swift_Article";
71 string schemaOrgType = string.Empty;
72
73 string sambaId = Pageview.AreaSettings.GetString("SambaID");
74 string sambaUrl = $"https://yottlyscript.com/script.js?tp={sambaId}";
75 string userId = Pageview.User != null ? Pageview.User.ID.ToString() : "";//ExternalID
76 userId = "\"" + userId +"\"";
77
78 if (isProductDetailsPage)
79 {
80 schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Product\"";
81 }
82
83 if (isArticlePage)
84 {
85 schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Article\"";
86 }
87
88 if (!cssThemeAndBrandingStyleFileInfo.Exists || cssThemeAndBrandingStyleFileInfo.LastWriteTime < brandingPage.Audit.LastModifiedAt)
89 {
90 //Branding page has been saved or the file is missing. Rewrite the file to disc.
91 if (brandingPageId > 0)
92 {
93 var brandingPageview = Dynamicweb.Frontend.PageView.GetPageviewByPageID(brandingPageId);
94 brandingPageview.Redirect = false;
95 brandingPageview.Output();
96 }
97 }
98
99 if (!cssThemeAndBrandingStyleFileInfo.Exists || cssThemeAndBrandingStyleFileInfo.LastWriteTime < themesParagraphLastChanged.Audit.LastModifiedAt)
100 {
101 //Branding page has been saved or the file is missing. Rewrite the file to disc.
102 if (themePageId > 0)
103 {
104 var themePageview = Dynamicweb.Frontend.PageView.GetPageviewByPageID(themePageId);
105 themePageview.Redirect = false;
106 themePageview.Output();
107 }
108 }
109
110 var cssStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath("/Files/Templates/Designs/Swift/Assets/css/styles.css"));
111 var jsFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath("/Files/Templates/Designs/Swift/Assets/js/scripts.js"));
112
113 string masterTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("Theme")) ? " theme " + Model.Area.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
114
115 string favicon = Model.Area.Item.GetFile("Favicon") != null ? Model.Area.Item.GetFile("Favicon").Path : "/Files/Templates/Designs/Swift/Assets/Images/favicon.png";
116
117 string headerCssClass = "sticky-top";
118 bool movePageBehind = false;
119
120 if (Pageview.Page.PropertyItem != null)
121 {
122 headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top";
123 movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false;
124 }
125
126 headerCssClass = headerCssClass == "" ? "sticky-top" : headerCssClass;
127 headerCssClass = Pageview.IsVisualEditorMode ? "" : headerCssClass;
128
129 string googleAnalyticsTrackingID = Model.Area.Item.GetString("GoogleAnalyticsTrackingID");
130 string googleAnalyticsMeasurementID = Model.Area.Item.GetString("GoogleAnalyticsMeasurementID");
131 string googleTagManagerID = Model.Area.Item.GetString("GoogleTagManagerID");
132 var cookieOptInLevel = CookieManager.GetCookieOptInLevel();
133 //bool allowTracking = //cookieOptInLevel == CookieOptInLevel.All || (cookieOptInLevel == CookieOptInLevel.Functional && CookieManager.GetCookieOptInCategories().Contains("Statistical"));
134
135 bool allowTracking = AllowTracking();
136
137 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/css/styles.css?{cssStyleFileInfo.LastWriteTime.Ticks}>; rel=preload; as=style;");
138 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_{Model.Area.ID}.min.css?{cssLastModified.Ticks}>; rel=preload; as=style;");
139 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/js/aos.js?{jsFileInfo.LastWriteTime.Ticks}>; rel=preload; as=script;");
140 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/js/scripts.js?{jsFileInfo.LastWriteTime.Ticks}>; rel=preload; as=script;");
141 //Dynamicweb.Context.Current.Response.Flush(); //This sends the headers where we are now in the rendering making the TTFB faster
142
143 SetMetaTags();
144
145 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>();
146
147 if (Pageview.Area.IsMaster)
148 {
149 languages.Add(Pageview.Page);
150 if (Pageview.Page.Languages != null)
151 {
152 foreach (var language in Pageview.Page.Languages)
153 {
154 languages.Add(language);
155 }
156 }
157 }
158 else
159 {
160 languages.Add(Pageview.Page.MasterPage);
161 if (Pageview.Page.MasterPage != null)
162 {
163 if (Pageview.Page.MasterPage.Languages != null)
164 {
165 foreach (var language in Pageview.Page.MasterPage.Languages)
166 {
167 languages.Add(language);
168 }
169 }
170 }
171 }
172
173 string siteLanguage = Pageview.Area.CultureInfo.Name;
174 Uri url = Dynamicweb.Context.Current.Request.Url;
175 string hostName = url.Host; // domain.com/da-dk or domain.com/en-us
176
177 var ecomCountries = Dynamicweb.Ecommerce.Services.Countries.GetCountries();
178 var ecomCurrencies = Dynamicweb.Ecommerce.Services.Currencies.GetAllCurrencies();
179
180 // Check user address
181 bool isB2B = false;
182 var currentUser = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser();
183 if(currentUser != null){
184 string customerNumber = currentUser.CustomerNumber;
185 isB2B = !string.IsNullOrEmpty(customerNumber);
186 }
187 var userB2CAddressFeedPageId = GetPageIdByNavigationTag("Checkuseraddressesb2c").ToString();
188 var userB2BAddressFeedPageId = GetPageIdByNavigationTag("Checkuseraddressesb2b").ToString();
189 var checkB2CUserAddressFeed = currentUser != null && string.IsNullOrEmpty(currentUser.CustomerNumber) && currentUser != null ? $"/Default.aspx?ID={userB2CAddressFeedPageId}" : "";
190 var checkB2BUserAddressFeed = isB2B ? $"/Default.aspx?ID={userB2BAddressFeedPageId}" : "";
191
192 //var userAddressFeedUrl = $"/Default.aspx?ID={userAddressFeedPageId}";
193 }
194
195 <!doctype html>
196 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">
197 <head>
198 <!-- @swiftVersion -->
199 @* Required meta tags *@
200 <meta charset="utf-8">
201 <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0">
202 <link rel="shortcut icon" href="@favicon">
203 <link rel="apple-touch-icon" href="@favicon">
204
205
206 @Model.MetaTags
207
208 @{
209 @* Languages meta data *@
210 foreach (var language in languages)
211 {
212 if (language?.Area != null)
213 {
214 if (language != null && language.Published && language.Active && language.Area.Active && language.Area.Published && language.Area.ID != Dynamicweb.Frontend.PageView.Current().AreaID)
215 {
216 if (!string.IsNullOrEmpty(language.Area.DomainLock))
217 {
218 hostName = language.Area.DomainLock; //dk.domain.com or dk-domain.dk
219 }
220 string querystring = $"Default.aspx?ID={language.ID}";
221 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["GroupID"]))
222 {
223 querystring += $"&GroupID={Dynamicweb.Context.Current.Request.QueryString["GroupID"]}";
224 }
225 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
226 {
227 querystring += $"&ProductID={Dynamicweb.Context.Current.Request.QueryString["ProductID"]}";
228 }
229 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["VariantID"]))
230 {
231 querystring += $"&VariantID={Dynamicweb.Context.Current.Request.QueryString["VariantID"]}";
232 }
233
234 string friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(querystring);
235 string href = $"{url.Scheme}://{hostName}{friendlyUrl}";
236
237 <link rel="alternate" hreflang="@language.Area.CultureInfo.Name.ToLower()" href="@href">
238 }
239 }
240 }
241 }
242
243 <title>@Model.Title</title>
244 @* Bootstrap + Swift stylesheet *@
245 <link href="/Files/Templates/Designs/Swift/Assets/css/styles.css?@cssStyleFileInfo.LastWriteTime.Ticks" rel="stylesheet" media="all" type="text/css">
246
247 @if (disableWideBreakpoints != "disableBoth")
248 {
249 <style>
250 @@media ( min-width: 1600px ) {
251 .container-xxl,
252 .container-xl,
253 .container-lg,
254 .container-md,
255 .container-sm,
256 .container {
257 max-width: 1520px;
258 }
259 }
260 </style>
261
262 if (disableWideBreakpoints != "disableUltraWideOnly")
263 {
264 <style>
265 @@media ( min-width: 1920px ) {
266 .container-xxl,
267 .container-xl,
268 .container-lg,
269 .container-md,
270 .container-sm,
271 .container {
272 max-width: 1820px;
273 }
274 }
275 </style>
276 }
277 }
278
279 @* Branding and Themes min stylesheet *@
280 <link href="/Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_@(Model.Area.ID).min.css?@cssLastModified.Ticks" rel="stylesheet" media="all" type="text/css" data-last-modified-content="@cssLastModified">
281 <script src="/Files/Templates/Designs/Swift/Assets/js/aos.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
282 <script src="/Files/Templates/Designs/Swift/Assets/js/scripts.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
283
284 <script type="module">
285 AOS.init({ offset: 0, duration: 400, delay: 100, easing: 'ease-in-out', mirror: true, disable: window.matchMedia('(prefers-reduced-motion: reduce)') });
286 swift.Scroll.hideHeadersOnScroll();
287 swift.Scroll.handleAlternativeTheme();
288 </script>
289
290
291 @* Google gtag method - always include even if it is not used for anything *@
292 <script>
293 window.dataLayer = window.dataLayer || [];
294 function gtag() { dataLayer.push(arguments); }
295 </script>
296
297 @* Google tag manager *@
298 @if (!string.IsNullOrWhiteSpace(googleTagManagerID))
299 {
300 <script>
301 gtag('consent', 'default', {
302 'ad_storage': 'denied',
303 'ad_user_data': 'denied',
304 'ad_personalization': 'denied',
305 'analytics_storage': 'denied'
306 });
307
308 window.dataLayer.push({
309 'event': 'cookie_cat_functional',
310 'cookie_cat_functional': 'true'
311
312 });
313 </script>
314 <script>
315 (function (w, d, s, l, i) {
316 w[l] = w[l] || []; w[l].push({
317 'gtm.start':
318 new Date().getTime(), event: 'gtm.js'
319 }); var f = d.getElementsByTagName(s)[0],
320 j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src =
321 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);
322 })(window, document, 'script', 'dataLayer', '@(googleTagManagerID)');
323 </script>
324
325
326 if (allowTracking)
327 {
328 string adConsent = GetCookieOptInPermission("Marketing");
329 string analyticsConsent = GetCookieOptInPermission("Statistical");
330
331 string dataLayerMarketing = adConsent == "granted" ? "'event': 'cookie_cat_marketing','cookie_cat_marketing': 'true'" : "'event': 'cookie_cat_marketing','cookie_cat_marketing': 'false'";
332 string dataLayerStatistical = analyticsConsent == "granted" ? "'event': 'cookie_cat_statistic','cookie_cat_statistic': 'true'" : "'event': 'cookie_cat_statistic','cookie_cat_statistic': 'false'";
333
334 <script>
335 gtag('consent', 'update', {
336 'ad_storage': '@adConsent',
337 'ad_user_data': '@adConsent',
338 'ad_personalization': '@adConsent',
339 'analytics_storage': '@analyticsConsent'
340 });
341
342
343 dataLayer.push({@dataLayerMarketing});
344 dataLayer.push({@dataLayerStatistical});
345
346 </script>
347 } else {
348 <script>
349 window.dataLayer.push({
350 'event': 'cookie_cat_marketing',
351 'cookie_cat_marketing' : 'false'
352
353 });
354 window.dataLayer.push({
355 'event': 'cookie_cat_statistic',
356 'cookie_cat_statistic' : 'false'
357 });
358 </script>
359 }
360 }
361
362
363
364 @* Global site tag (gtag.js) - Google Analytics
365 @if (!string.IsNullOrWhiteSpace(googleAnalyticsTrackingID) && allowTracking)
366 {
367 <script src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsTrackingID" async></script>
368 <script>
369 window.dataLayer = window.dataLayer || [];
370 function gtag() { window.dataLayer.push(arguments); }
371 gtag('js', new Date());
372 gtag('config', '@googleAnalyticsTrackingID');
373 </script>
374 }
375
376 @*if (!string.IsNullOrWhiteSpace(googleAnalyticsMeasurementID) && allowTracking)
377 {
378 var GoogleAnalyticsDebugMode = "";
379 bool isLoggedInBackendUser = false;
380
381 if (Dynamicweb.Environment.ExecutingContext.IsAdminLoggedIn())
382 {
383 isLoggedInBackendUser = true;
384 }
385
386 if (Model.Area.Item.GetBoolean("EnableGoogleAnalyticsDebugMode") && @isLoggedInBackendUser)
387 {
388 GoogleAnalyticsDebugMode = ", {'debug_mode': true}";
389 }
390 }
391
392 @if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking)
393 {
394
395
396 <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
397 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
398 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
399 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
400 })(window,document,'script','dataLayer','@googleTagManagerID');</script>
401
402
403
404 <script async src="https://www.googletagmanager.com/gtag/js?id=@googleTagManagerID"></script>
405 <script>
406 window.dataLayer = window.dataLayer || [];
407 function gtag() { dataLayer.push(arguments); }
408 gtag('js', new Date());
409 gtag('config', '@googleTagManagerID');
410
411 gtag('consent', 'default', {
412 'ad_storage': 'denied',
413 'ad_user_data': 'denied',
414 'ad_personalization': 'denied',
415 'analytics_storage': 'denied',
416 'functionality_storage': 'denied',
417 'personalization_storage': 'denied',
418 'security_storage': 'denied'
419 });
420
421 </script>
422
423 <noscript><iframe src="[https://www.googletagmanager.com/ns.html?id=@googleTagManagerID"\
424 height="0](https://www.googletagmanager.com/ns.html?id=@googleTagManagerID%22%EF%BF%BCheight=%220)" width="0" style="display:none;visibility:hidden"></iframe></noscript>
425
426 }
427
428
429 @*<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
430 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
431 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
432 '[https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
433 })(window,document,'script','dataLayer','GTM-5SN32G57');</script>
434
435
436
437 <noscript><iframe src="[https://www.googletagmanager.com/ns.html?id=GTM-5SN32G57"\
438 height="0](https://www.googletagmanager.com/ns.html?id=GTM-5SN32G57%22%EF%BF%BCheight=%220)" width="0" style="display:none;visibility:hidden"></iframe></noscript>*@
439
440
441 @if (!string.IsNullOrWhiteSpace(googleAnalyticsMeasurementID) && allowTracking)
442 {
443 var GoogleAnalyticsDebugMode = "";
444
445 if (Model.Area.Item.GetBoolean("EnableGoogleAnalyticsDebugMode"))
446 {
447 GoogleAnalyticsDebugMode = ", {'debug_mode': true}";
448 }
449
450 <script async src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsMeasurementID"></script>
451 <script>
452 gtag('js', new Date());
453 gtag('config', '@googleAnalyticsMeasurementID'@GoogleAnalyticsDebugMode);
454 </script>
455 }
456
457
458 @if (!string.IsNullOrWhiteSpace(customHeaderInclude))
459 {
460 @RenderPartial($"Components/Custom/{customHeaderInclude}")
461 }
462
463
464
465 </head>
466
467 @{
468 string cartServicePageId = GetPageIdByNavigationTag("CartService").ToString();
469 string cartSummaryPageId = GetPageIdByNavigationTag("CartSummary").ToString();
470 string allCAtegoriesPageID = GetPageIdByNavigationTag("AllCategories").ToString();
471 string profileCartActionsPageId = GetPageIdByNavigationTag("CartProfilesActions").ToString();
472 }
473
474 <body
475 class="brand @(masterTheme)"
476 id="page@(Model.ID)"
477 data-checkUserAddressB2C="@checkB2CUserAddressFeed"
478 data-checkUserAddressB2B="@checkB2BUserAddressFeed"
479 data-cartService-pageid="@cartServicePageId"
480 data-cartSummary-pageid="@cartSummaryPageId"
481 data-allcategories-pageid="@allCAtegoriesPageID"
482 data-profileCartAction-pageid="@profileCartActionsPageId"
483 >
484 @*Samba Id*@
485 @if (!string.IsNullOrWhiteSpace(sambaId))
486 {
487 <script async src="@sambaUrl" referrerpolicy="origin-when-cross-origin"></script>
488 }
489
490 @if (renderAsResponsive || !renderMobile)
491 {
492 <header class="page-header @headerCssClass top-0@(responsiveClassDesktop)" id="page-header-desktop">
493 @if (@Model.Area.Item.GetLink("HeaderDesktop") != null)
494 {
495 @RenderGrid(@Model.Area.Item.GetLink("HeaderDesktop").PageId)
496 }
497 </header>
498 }
499
500 @if ((renderAsResponsive || renderMobile))
501 {
502 <header class="page-header @headerCssClass top-0@(responsiveClassMobile)" id="page-header-mobile">
503 @if (@Model.Area.Item.GetLink("HeaderMobile") != null)
504 {
505 @RenderGrid(@Model.Area.Item.GetLink("HeaderMobile").PageId)
506 }
507 </header>
508 }
509
510 <main id="content" @(schemaOrgType)>
511 <div data-intersect></div>
512 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
513 @using System
514 @using Dynamicweb.Ecommerce.ProductCatalog
515
516
517 @{
518 string productIdFromUrl = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : string.Empty;
519 bool isProductDetail = !string.IsNullOrEmpty(productIdFromUrl) && Pageview.Page.NavigationTag.ToLower() == "shop";
520
521 bool isArticlePagePage = Model.ItemType == "Swift_Article";
522 string schemaOrgProp = string.Empty;
523 if(isArticlePagePage)
524 {
525 schemaOrgProp = "itemprop=\"articleBody\"";
526 }
527
528 string theme = "";
529 string gridContent = "";
530
531 if (Model.PropertyItem != null)
532 {
533 theme = !string.IsNullOrWhiteSpace(Model.PropertyItem.GetRawValueString("Theme")) ? " theme " + Model.PropertyItem.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
534 }
535
536 if (Model.Item != null || Pageview.IsVisualEditorMode)
537 {
538 if (!isProductDetail)
539 {
540 gridContent = Model.Grid("Grid", "Grid", "default:true;sort:1", "Page");
541 }
542 else
543 {
544 var productObject = Dynamicweb.Ecommerce.Products.Product.GetProductById(productIdFromUrl);
545 var detailPage = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(productObject.PrimaryGroupId)?.Meta.PrimaryPage ?? string.Empty;
546 var detailPageId = detailPage != string.Empty ? Convert.ToInt16(detailPage.Substring(detailPage.LastIndexOf('=') + 1)) : GetPageIdByNavigationTag("ProductDetailPage");
547
548 @RenderGrid(detailPageId)
549 }
550 }
551
552 bool doNotRenderPage = false;
553
554 //Check if we are on the poduct detail page, and if there is data to render
555 ProductViewModel product = new ProductViewModel();
556 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails"))
557 {
558 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"];
559 if (string.IsNullOrEmpty(product.Id)) {
560 doNotRenderPage = true;
561 }
562 }
563
564 //Render the page
565 if (!doNotRenderPage) {
566 string itemIdentifier = Model?.Item?.SystemName != null ? "item_" + Model.Item.SystemName.ToLower() : "item_Swift_Page";
567
568 if (theme != "")
569 {
570 <div class="@theme item_@itemIdentifier" @schemaOrgProp>
571 @gridContent
572 </div>
573 }
574 else
575 {
576 <div class="item_@itemIdentifier" @schemaOrgProp>
577 @gridContent
578 </div>
579 }
580 } else {
581 <div class="container">
582 <div class="alert alert-info" role="alert">@Translate("Sorry. There is nothing to view here")</div>
583 </div>
584 }
585
586 if (!Model.IsCurrentUserAllowed)
587 {
588 int signInPage = GetPageIdByNavigationTag("SignInPage");
589 int dashboardPage = GetPageIdByNavigationTag("MyAccountDashboardPage");
590
591 if (!Pageview.IsVisualEditorMode)
592 {
593 if (signInPage != 0)
594 {
595 if (signInPage != Model.ID) {
596 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + signInPage);
597 } else {
598 if (dashboardPage != 0) {
599 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + dashboardPage);
600 } else {
601 Dynamicweb.Context.Current.Response.Redirect("/");
602 }
603 }
604 }
605 else
606 {
607 <div class="alert alert-dark m-0" role="alert">
608 <span>@Translate("You do not have access to this page")</span>
609 </div>
610 }
611 }
612 else
613 {
614 <div class="alert alert-dark m-0" role="alert">
615 <span>@Translate("To work on this page, you must be signed in, in the frontend")</span>
616 </div>
617 }
618 }
619 }
620
621 </main>
622
623 @if (renderAsResponsive || !renderMobile)
624 {
625 <footer class="page-footer@(responsiveClassDesktop)" id="page-footer-desktop">
626 @if (@Model.Area.Item.GetLink("FooterDesktop") != null)
627 {
628 @RenderGrid(@Model.Area.Item.GetLink("FooterDesktop").PageId)
629 }
630 </footer>
631 }
632
633 @if (renderAsResponsive || renderMobile)
634 {
635 <footer class="page-footer@(responsiveClassMobile)" id="page-footer-mobile">
636 @if (@Model.Area.Item.GetLink("FooterMobile") != null)
637 {
638 @RenderGrid(@Model.Area.Item.GetLink("FooterMobile").PageId)
639 }
640 </footer>
641 }
642
643 @* Render any offcanvas menu here *@
644 @RenderSnippet("offcanvas")
645
646 @{
647 bool isErpConnectionDown = false;//!Dynamicweb.Ecommerce.DynamicwebLiveIntegration.TemplatesHelper.IsWebServiceConnectionAvailable();
648 }
649
650 @* Language selector modal *@
651 @if (languages.Count > 1 || ecomCountries.Count > 1 || ecomCurrencies.Count() > 1)
652 {
653 <div class="modal fade" id="PreferencesModal" tabindex="-1" aria-hidden="true">
654 <div class="modal-dialog modal-dialog-centered modal-sm" id="PreferencesModalContent">
655 @* The content here comes from an external request *@
656 </div>
657 </div>
658 }
659
660 @* Favorite toast *@
661 <div aria-live="polite" aria-atomic="true">
662 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
663 <div id="favoriteNotificationToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
664 <div class="toast-header">
665 <strong class="me-auto">@Translate("Favorite list updated")</strong>
666 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
667 </div>
668 <div class="toast-body d-flex gap-3">
669 <div id="favoriteNotificationToast_Image"></div>
670 <div id="favoriteNotificationToast_Text"></div>
671 </div>
672 </div>
673 </div>
674 </div>
675
676 @* Modal for dynamic content *@
677 <div class="modal fade js-product" id="DynamicModal" tabindex="-1" aria-hidden="true">
678 <div class="modal-dialog modal-dialog-centered modal-md">
679 <div class="modal-content theme light" id="DynamicModalContent">
680 @* The content here comes from an external request *@
681 </div>
682 </div>
683 </div>
684
685 @* Offcanvas for dynamic content *@
686 <div class="offcanvas offcanvas-end theme light" tabindex="-1" id="DynamicOffcanvas" style="width: 30rem">
687 @* The content here comes from an external request *@
688 </div>
689
690 @if (isErpConnectionDown && Model.Area.Item.GetBoolean("ShowErpDownMessage"))
691 {
692 string erpDownMessageTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ErpDownMessageTheme")) ? " theme " + Model.Area.Item.GetRawValueString("ErpDownMessageTheme").Replace(" ", "").Trim().ToLower() : "theme light";
693
694 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 1040">
695 <div class="toast fade show border-0 @erpDownMessageTheme" role="alert" aria-live="assertive" aria-atomic="true">
696 <div class="toast-header">
697 <strong class="me-auto">@Translate("Connection down")</strong>
698 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
699 </div>
700 <div class="toast-body">
701 @Translate("We are experiencing some connectivity issues. Not all features may be available to you.")
702 </div>
703 </div>
704 </div>
705 }
706
707 @if (!string.IsNullOrWhiteSpace(sambaId))
708 {
709 <script>
710 var _yottlyOnload = _yottlyOnload || []
711 _yottlyOnload.push(function() {
712 var userID = @userId;
713 var cartLayer = dataLayer.find(function (layer) { return layer.event === 'checkout' });
714 //var orderPage = cartLayer.ecommerce.purchase.actionField.revenue ? true : false;
715 if (cartLayer && cartLayer.ecommerce && cartLayer.ecommerce.checkout) {
716 console.log("cart found");
717 diffAnalytics.cartInteraction({
718 content: cartLayer.ecommerce.checkout.products.map(function(product) {
719 return {
720 productId: product.number,
721 amount: product.quantity
722 }
723 })
724 //onOrderPage: true
725 })
726 }
727 //if (cartLayer && cartLayer.ecommerce && cartLayer.ecommerce.customer && cartLayer.ecommerce.customer.userid) {
728 //diffAnalytics.customerLoggedIn(cartLayer.ecommerce.customer.userid)
729 //}
730
731 if(userID)
732 {
733 diffAnalytics.customerLoggedIn(userID);
734 }
735
736 var purchaseLayer = dataLayer.find(function(layer) {return (!!layer.ecommerce && !!layer.ecommerce.purchase)})
737 if (purchaseLayer) {
738 diffAnalytics.order({
739 content: purchaseLayer.ecommerce.purchase.products.map(function(product) {
740 return {
741 productId: product.number,
742 price: product.quantity * Number(product.price.replace(',', '.')),
743 }
744 })
745 //onOrderPage: true
746 })
747 }
748 })
749 </script>
750 }
751
752
753 </body>
754 </html>
755 @functions {
756 void SetMetaTags()
757 {
758 //Verification Tokens
759 string siteVerificationGoogle = Model.Area.Item.GetString("Google_Site_Verification") != null ? Model.Area.Item.GetString("Google_Site_Verification") : "";
760 //string siteVerificationYandex = Model.Area.Item.GetString("Yandex_Verification") != null ? Model.Area.Item.GetString("Yandex_Verification") : "";
761 //string siteVerificationMS = Model.Area.Item.GetString("Msvalidate_01") != null ? Model.Area.Item.GetString("Msvalidate_01") : "";
762 //string siteVerificationAlexa = Model.Area.Item.GetString("AlexaVerifyID") != null ? Model.Area.Item.GetString("AlexaVerifyID") : "";
763 //string siteVerificationPinterest = Model.Area.Item.GetString("P_domain_verify") != null ? Model.Area.Item.GetString("P_domain_verify") : "";
764 //string siteVerificationNorton = Model.Area.Item.GetString("Norton_safeweb_site_verification") != null ? Model.Area.Item.GetString("Norton_safeweb_site_verification") : "";
765
766 //Generic Site Values
767 string openGraphFacebookAppID = Model.Area.Item.GetString("Fb_app_id") != null ? Model.Area.Item.GetString("Fb_app_id") : "";
768 string openGraphType = Model.Area.Item.GetString("Open_Graph_Type") != null ? Model.Area.Item.GetString("Open_Graph_Type") : "";
769 string openGraphSiteName = Model.Area.Item.GetString("Open_Graph_Site_Name") != null ? Model.Area.Item.GetString("Open_Graph_Site_Name") : "";
770
771 string twitterCardSite = Model.Area.Item.GetString("Twitter_Site") != null ? Model.Area.Item.GetString("Twitter_Site") : "";
772
773 //Page specific values
774 string openGraphSiteTitle = Model.Area.Item.GetString("Open_Graph_Title") != null ? Model.Area.Item.GetString("Open_Graph_Title") : "";
775 FileViewModel openGraphImage = Model.Area.Item.GetFile("Open_Graph_Image");
776 string openGraphImageALT = Model.Area.Item.GetString("Open_Graph_Image_ALT") != null ? Model.Area.Item.GetString("Open_Graph_Image_ALT") : "";
777 string openGraphDescription = Model.Area.Item.GetString("Open_Graph_Description") != null ? Model.Area.Item.GetString("Open_Graph_Description") : "";
778
779 string twitterCardURL = Model.Area.Item.GetString("Twitter_URL") != null ? Model.Area.Item.GetString("Twitter_URL") : "";
780 string twitterCardTitle = Model.Area.Item.GetString("Twitter_Title") != null ? Model.Area.Item.GetString("Twitter_Title") : "";
781 string twitterCardDescription = Model.Area.Item.GetString("Twitter_Description") != null ? Model.Area.Item.GetString("Twitter_Description") : "";
782 FileViewModel twitterCardImage = Model.Area.Item.GetFile("Twitter_Image");
783 string twitterCardImageALT = Model.Area.Item.GetString("Twitter_Image_ALT") != null ? Model.Area.Item.GetString("Twitter_Image_ALT") : "";
784
785 if (!string.IsNullOrEmpty(siteVerificationGoogle))
786 {
787 Pageview.Meta.AddTag("google-site-verification", siteVerificationGoogle);
788 }
789
790 if (!string.IsNullOrEmpty(openGraphFacebookAppID))
791 {
792 Pageview.Meta.AddTag("fb:app_id", openGraphFacebookAppID);
793 }
794
795 if (!string.IsNullOrEmpty(openGraphType))
796 {
797 Pageview.Meta.AddTag("og:type", openGraphType);
798 }
799
800 if (!string.IsNullOrEmpty(openGraphSiteName))
801 {
802 Pageview.Meta.AddTag("og:site_name", openGraphSiteName);
803 }
804
805 if (!string.IsNullOrEmpty(Model.Title))
806 {
807 Pageview.Meta.AddTag("og:title", Model.Title);
808 }
809 else
810 {
811 Pageview.Meta.AddTag("og:title", openGraphSiteTitle);
812 }
813
814 if (!string.IsNullOrEmpty(Pageview.Page.TopImage) && openGraphImage == null)
815 {
816 Pageview.Meta.AddTag("og:image", Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host + Pageview.Page.TopImage);
817 }
818
819 if (string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
820 {
821 if (!string.IsNullOrEmpty(Model.Description))
822 {
823 Pageview.Meta.AddTag("og:description", Model.Description);
824 }
825 else
826 {
827 Pageview.Meta.AddTag("og:description", openGraphDescription);
828 }
829 if (openGraphImage != null)
830 {
831 Pageview.Meta.AddTag("og:image", openGraphImage.Path);
832 }
833
834 if (!string.IsNullOrEmpty(openGraphImageALT))
835 {
836 Pageview.Meta.AddTag("og:image:alt", openGraphImageALT);
837 }
838 if (!string.IsNullOrEmpty(twitterCardDescription))
839 {
840 Pageview.Meta.AddTag("twitter:description", twitterCardDescription);
841 }
842
843 if (twitterCardImage != null)
844 {
845 Pageview.Meta.AddTag("twitter:image", twitterCardImage.Path);
846 }
847
848 if (!string.IsNullOrEmpty(twitterCardImageALT))
849 {
850 Pageview.Meta.AddTag("twitter:image:alt", twitterCardImageALT);
851 }
852 }
853
854 if (!string.IsNullOrEmpty(twitterCardSite))
855 {
856 Pageview.Meta.AddTag("twitter:site", twitterCardSite);
857 }
858
859 if (!string.IsNullOrEmpty(twitterCardURL))
860 {
861 Pageview.Meta.AddTag("twitter:url", twitterCardURL);
862 }
863
864 if (!string.IsNullOrEmpty(twitterCardTitle))
865 {
866 Pageview.Meta.AddTag("twitter:title", twitterCardTitle);
867 }
868 }
869 }
870
871 @*{
872 bool consentIsGranted = System.Web.HttpContext.Current.Request?.Cookies["Dynamicweb.CookieOptInLevel"]?.Value == "2";
873 }
874
875 @if (consentIsGranted)
876 {
877 <script>
878 document.addEventListener("DOMContentLoaded", function() {
879 consentGranted();
880 });
881 </script>
882 }
883
884 <script>
885 function consentGranted() {
886 gtag('consent', 'update', {
887 'ad_storage': 'granted',
888 'ad_user_data': 'granted',
889 'ad_personalization': 'granted',
890 'analytics_storage': 'granted',
891 'functionality_storage': 'granted',
892 'personalization_storage': 'granted',
893 'security_storage': 'granted'
894 });
895 }
896 </script>
897 *@
898
899 <script>
900 function resetSelect(button) {
901 var container = button.closest('.selection-wrapper');
902 if (container) {
903 var selectElement = container.querySelector('select');
904 if (selectElement) {
905 selectElement.value = "-1";
906 selectElement.dispatchEvent(new Event('change', { bubbles: true }));
907 }
908 }
909 }
910 </script>
911
912
913
914
915 @RenderModalAddToCart()
916 @RenderModalStepQuantity()
917 @RenderModalStockNoty()
918 @RenderModalMultiAddToCart()
919 @RenderModalCartErrors()
920 @RenderModalAddAddressB2B()
921
922
923 @helper RenderModalAddToCart() {
924
925 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/";
926 int cartPageId = GetPageIdByNavigationTag("CartPage");
927 string cartPageUrl= "Default.aspx?ID=" + cartPageId;
928
929 <div class="modal fade" id="AddtoCartModal" tabindex="-1" aria-labelledby="AddtoCartModalLabel" aria-hidden="true">
930 <div class="modal-dialog modal-dialog-centered">
931 <div class="modal-content p-4">
932 <div class="modal-header border-0 align-items-start">
933 <div class="addtocartmodal__modal-title h5" id="AddtoCartModalLabel">@Translate("Pridané do košíka")</div>
934 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
935 </div>
936 <div class="modal-body">
937 <div class="grid mb-3">
938 <div class="g-col-4">
939 <div class="addtocartmodal__product-image text-center"><img src="" alt="product title"/></div>
940 </div>
941 <div class="g-col-8">
942 <div class="addtocartmodal__product-title h5 fs-6 mb-1"></div>
943 @*<div class="addtocartmodal__product-stock custom-stock pos fs-7"></div>*@
944 </div>
945 </div>
946 <div class="grid grid-1">
947 <div class="g-col-12 pt-3 border-top">
948 <div class="addtocartmodal__product-shipping-information custom-green"></div>
949 </div>
950 </div>
951 </div>
952 <div class="modal-footer d-flex flex-column border-0">
953 <a href="@cartPageUrl" class="btn btn-primary p-2 m-0 mb-2 w-100" >@Translate("Prejsť do košíka")</a>
954 <button type="button" class="btn btn-secondary p-2 m-0 w-100" data-bs-dismiss="modal"><span class="me-2">@ReadFile(iconPath + "arrow-left.svg")</span>@Translate("Pokračovať v nákupe")</button>
955 </div>
956 </div>
957 </div>
958 </div>
959 }
960 <!-- Modal -->
961
962 @helper RenderModalStepQuantity() {
963
964 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/";
965
966 <div class="modal fade" id="StepQuantityModal" tabindex="-1" aria-labelledby="StepQuantityModalLabel" aria-hidden="true">
967 <div class="modal-dialog modal-dialog-centered">
968 <div class="modal-content p-4">
969 <div class="modal-header border-0 p-0 align-items-start">
970 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
971 </div>
972 <div class="modal-body">
973 <div class="grid mb-3">
974 <div class="g-col-12">
975 <div class="stepquantitymodal__message"></div>
976 </div>
977 </div>
978 </div>
979 </div>
980 </div>
981 </div>
982 }
983 <!-- Modal -->
984
985
986 @helper RenderModalStockNoty() {
987
988 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/";
989 string productPageId = GetPageIdByNavigationTag("Shop").ToString();
990 string createNotificationText = Translate("createnotification", "Create notification");
991 var productLanguageID = Dynamicweb.Ecommerce.Common.Context.LanguageID;
992
993 <div class="modal fade" id="StockNotifyModal" tabindex="-1" aria-labelledby="StockNotifyModalLabel" aria-hidden="true">
994 <div class="modal-dialog modal-dialog-centered">
995 <div class="modal-content p-4">
996 <div class="modal-header border-0 align-items-start">
997 <div class="stocknotify__modal-title h5" id="StockNotifyModalLabel">@Translate("getNotification", "Find out when product is back on stock")</div>
998 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
999 </div>
1000 <div class="modal-body">
1001 <div class="grid mb-3">
1002 <div class="g-col-12 form-stock-noty-wrapper">
1003 <form name="" id="NotificationForm_" method="post" class="u-margin-auto grid__col-auto-width" action="/Default.aspx?ID=@productPageId">
1004 <input type="hidden" name="ProductID" id="ProductID" value="" />
1005 <input type="hidden" name="VariantID" id="VariantID" value="" />
1006 <input type="hidden" name="LanguageID" id="LanguageID" value="@productLanguageID" />
1007 <input type="hidden" name="CartCmd" id="CartCmd" value="createnotificationforthisproduct" />
1008
1009
1010 <div class="g-col-12">
1011 <div class="form-floating">
1012 <input type="email" class="form-control" name="NotificationEmail" id="NotificationEmail" value="" placeholder="@Translate("Email")">
1013 <label for="EcomOrderDeliveryEmail">@Translate("Email")</label>
1014 </div>
1015 </div>
1016 <button type="submit" value="@createNotificationText" class="btn btn-primary w-100 mt-2 stocknotify__send-trigger">@Translate("Send")</button>
1017 </form>
1018 </div>
1019 <div class="g-col-12 stock-notify-sent-success d-none">
1020 <h4 class="h5 custom-green"><span class="me-1">@ReadFile(iconPath + "check-circle-green.svg")</span>@Translate("stock notify sent")</h4>
1021 </div>
1022 <div class="g-col-12 stock-notify-sent-error d-none">
1023 <h4 class="h5 custom-red" style="color: red;"><span class="me-1">@ReadFile(iconPath + "x-square-red.svg")</span>@Translate("stock notify error")</h4>
1024 </div>
1025 </div>
1026 </div>
1027 </div>
1028 </div>
1029 </div>
1030 }
1031 @helper RenderModalMultiAddToCart() {
1032
1033 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/";
1034 int cartPageId = GetPageIdByNavigationTag("CartPage");
1035 string cartPageUrl= "Default.aspx?ID=" + cartPageId;
1036
1037 <div class="modal fade" id="MultiAddtoCartModal" tabindex="-1" aria-labelledby="MultiAddtoCartModalLabel" aria-hidden="true">
1038 <div class="modal-dialog modal-dialog-centered">
1039 <div class="modal-content p-4">
1040 <div class="modal-header border-0 align-items-start">
1041 <div class="multiaddtocartmodal__modal-title h5" id="MultiAddtoCartModalLabel">@Translate("Pridané do košíka")</div>
1042 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
1043 </div>
1044 <div class="modal-body">
1045 @* insert code with javascript*@
1046 <div class="modal-body_template">
1047 </div>
1048 <div class="modal-body-shipping__information custom-green">
1049 </div>
1050 </div>
1051 <div class="modal-footer d-flex flex-column border-0">
1052 <a href="@cartPageUrl" class="btn btn-primary p-2 m-0 mb-2 w-100" >@Translate("Prejsť do košíka")</a>
1053 <button type="button" class="btn btn-secondary p-2 m-0 w-100" data-bs-dismiss="modal"><span class="me-2">@ReadFile(iconPath + "arrow-left.svg")</span>@Translate("Pokračovať v nákupe")</button>
1054 </div>
1055 </div>
1056 </div>
1057 </div>
1058 }
1059 <!-- Modal -->
1060
1061 @helper RenderModalCartErrors() {
1062
1063 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/";
1064
1065 <div class="modal fade" id="CartErrorsModal" tabindex="-1" aria-labelledby="CartErrorsModalLabel" aria-hidden="true">
1066 <div class="modal-dialog modal-dialog-centered">
1067 <div class="modal-content p-4">
1068 <div class="modal-header border-0 p-0 align-items-start">
1069 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
1070 </div>
1071 <div class="modal-body" data-select-address="@Translate("Select delivery address")" data-select-payment="@Translate("Select payment method")" data-select-shipping="@Translate("Select shipping method")">
1072 <div class="grid mb-3">
1073 <div class="g-col-12">
1074 <div
1075 class="cartErrorsmodal__message d-flex gap-2 align-items-center"
1076 data-email-format-msg="@Translate("The email must be in the correct format")"
1077 data-tel-format-msg="@Translate("The phone number must be in the correct format")"
1078 >
1079 <span>@ReadFile(iconPath + "alert-triangle-red.svg")</span><span class="error-text">@Translate("Fill all required fields")</span>
1080 </div>
1081 </div>
1082 </div>
1083 </div>
1084 </div>
1085 </div>
1086 </div>
1087 }
1088 <!-- Modal -->
1089
1090 @helper RenderModalAddAddressB2B() {
1091
1092 var currentUser = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser();
1093 string userEmail = "";
1094 if(currentUser != null ){
1095 userEmail = currentUser.Email;
1096 }
1097
1098 var currentAreaId = Pageview.Area.ID;
1099 string countryCode = currentAreaId == 27 ? "SK" : "CZ";
1100 string countryName = currentAreaId == 27 ? "Slovensko" : "Česká republika";
1101
1102
1103
1104 <div class="modal fade" id="AddAddressB2BModal" tabindex="-1" aria-labelledby="AddAddressB2BModalLabel" aria-hidden="true">
1105 <div class="modal-dialog modal-dialog-centered">
1106 <div class="modal-content p-4">
1107 <div class="modal-header border-0 align-items-start">
1108 <div class="addaddressb2bmodal__modal-title h5" id="AddAddressB2BModalLabel"></div>
1109 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
1110 </div>
1111 <div class="modal-body">
1112 <form id="FormSendAddress">
1113 <div class="grid gap-3">
1114 <input type="hidden" name="isShipping" id="isShipping" value="true"/>
1115 <input type="hidden" id="UserManagement_Form_Email" name="email" value="@userEmail"/>
1116 <input type="hidden" name="id" id="id" value="">
1117
1118 <div class="g-col-12">
1119 <div class="form-floating">
1120 <input type="text" class="form-control" placeholder="@Translate("Description")" id="description" name="description" value="" required>
1121 <label for="description" class="form-label">@Translate("Description")<span class="is-required">*</span></label>
1122 </div>
1123 </div>
1124 <div class="g-col-12">
1125 <div class="form-floating">
1126 <input type="text" class="form-control" placeholder="@Translate("Name and surname")" id="name" name="name" value="" required>
1127 <label for="name" class="form-label">@Translate("Name and surname")<span class="is-required">*</span></label>
1128 </div>
1129 </div>
1130 <div class="g-col-12">
1131 <div class="form-floating">
1132 <input type="text" class="form-control" placeholder="@Translate("Address")" id="address" name="address" value="" required>
1133 <label for="address" class="form-label">@Translate("Address")<span class="is-required">*</span></label>
1134 </div>
1135 </div>
1136 <div class="g-col-12">
1137 <div class="form-floating">
1138 <input type="text" class="form-control" placeholder="@Translate("Town / City")" id="city" name="city" value="" required>
1139 <label for="city" class="form-label">@Translate("Town / City")<span class="is-required">*</span></label>
1140 </div>
1141 </div>
1142 <div class="g-col-12 g-col-lg-6">
1143 <div class="form-floating">
1144 <input type="text" class="form-control" placeholder="@Translate("Zip")" id="zip" name="zip" value="" required>
1145 <label for="zip" class="form-label">@Translate("Zip code")<span class="is-required">*</span></label>
1146 </div>
1147 </div>
1148 <div class="g-col-12 g-col-lg-6">
1149 <div class="form-floating">
1150 <input type="tel" class="form-control" placeholder="@Translate("Phone")" id="phone" name="phone" value="" maxlength="12" data-minlength="10" data-tel-format-msg="@Translate("The phone number must be in the correct format")" required>
1151 <label for="phone" class="form-label">@Translate("Phone number")<span class="is-required">*</span></label>
1152 </div>
1153 </div>
1154 <div class="g-col-12">
1155 <div class="form-floating">
1156 <input type="hidden" name="countryCodeValue" id="countryCodeValue" value="@countryCode">
1157 <input type="text" class="form-control" id="countryCode" value="@countryName" placeholder="Krajina" disabled="disabled">
1158 <label for="countryCode" class="form-label">@Translate("Country")</label>
1159 </div>
1160 </div>
1161 <div class="g-col-12">
1162 <div class="form-check">
1163 <input class="form-check-input" type="checkbox" id="isDefault" name="isDefault">
1164 <label class="form-check-label" for="isDefault">
1165 @Translate("Set this address as your default address")
1166 </label>
1167 </div>
1168 </div>
1169 <div class="g-col-12 text-end mt-2">
1170 <button type="submit" class="btn btn-primary" id="submitAddress" data-successmessage="Adresa bola uložená" data-errormessage="Vyskytla sa chyba, skúste to znova" name="Submit">@Translate("Send")</button>
1171 </div>
1172 </div>
1173 </form>
1174 <div class="sendAddressSuccess custom-green d-none">@Translate("Adresa bola uložená")</div>
1175 <div class="sendAddressError custom-alert d-none">@Translate("Vyskytla sa chyba, skúste to znova")</div>
1176 </div>
1177 </div>
1178 </div>
1179 </div>
1180 }