Error executing template "Designs/Swift/_parsed/Swift_Page.parsed.cshtml"
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): The network path was not found
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at Dynamicweb.Data.DatabaseConnectionProvider.CreateConnection(Boolean open)
at Dynamicweb.Data.Database.CreateConnection()
at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout)
at Dynamicweb.Ecommerce.Products.ProductRepository.GetProductById(String productId, String productVariantId, String productLanguageId)
at Dynamicweb.Ecommerce.Products.ProductService.FetchMissingProductsInternal(IProductRepository repo, IEnumerable`1 keys)
at Dynamicweb.Caching.ServiceCache`2.GetCache(IEnumerable`1 keys)
at Dynamicweb.Caching.ServiceCache`2.GetCache(TKey key)
at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, String productLanguageId, User user, Boolean showUntranslated)
at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, String productLanguageId, Boolean useAssortments)
at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, String productLanguageId)
at CompiledRazorTemplates.Dynamic.RazorEngine_dcb6eda5c0d04b61b028693b5e6da086.Execute() in C:\inetpub\wwwroot\DWShop2023\Solutions\Swift_v1.21.0\Files\Templates\Designs\Swift\_parsed\Swift_Page.parsed.cshtml:line 352
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()
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:53,State:0,Class:20
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
2 @using System
3 @using Dynamicweb
4 @using Dynamicweb.Environment
5 @using Dynamicweb.Frontend
6
7 @{
8 string pageDomain = Pageview.Area.UrlName;
9 var basePageUrl = "";
10 var pageURL = "";
11
12 var alternatePageAddress = Dynamicweb.Context.Current.Request.RawUrl.Split('?')[0].Replace("/products/","/proizvodi/").Replace("/"+pageDomain+"/","").Replace("/"+pageDomain,"");
13 alternatePageAddress = alternatePageAddress.Length > 1 ? alternatePageAddress : "";
14
15 string swiftVersion = ReadFile("/Files/Templates/Designs/Swift/swift_version.txt");
16 bool renderAsResponsive = Model.Area.Item.GetString("DeviceRendering", "responsive").Equals("responsive", StringComparison.OrdinalIgnoreCase);
17 bool renderMobile = Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Mobile || Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Tablet;
18 string responsiveClassDesktop = string.Empty;
19 string responsiveClassMobile = string.Empty;
20 if (renderAsResponsive)
21 {
22 responsiveClassDesktop = " d-none d-xl-block";
23 responsiveClassMobile = " d-block d-xl-none";
24 }
25
26 var disableWideBreakpoints = Model.Area?.Item?.GetRawValueString("DisableWideBreakpoints", "default");
27
28 var brandingPageId = Model.Area.Item.GetLink("BrandingPage") != null ? Model.Area.Item.GetLink("BrandingPage").PageId : 0;
29 var themePageId = Model.Area.Item.GetLink("ThemesPage") != null ? Model.Area.Item.GetLink("ThemesPage").PageId : 0;
30 string customHeaderInclude = Model.Area.Item.GetFile("CustomHeaderInclude") != null ? Model.Area.Item.GetFile("CustomHeaderInclude").Name : string.Empty;
31
32 var brandingPage = Dynamicweb.Content.Services.Pages?.GetPage(brandingPageId) ?? null;
33 var themesParagraphLastChanged = Dynamicweb.Content.Services.Paragraphs.GetParagraphsByPageId(themePageId).OrderByDescending(p => p.Audit.LastModifiedAt).FirstOrDefault();
34
35 var cssLastModified = brandingPage.Audit.LastModifiedAt > themesParagraphLastChanged.Audit.LastModifiedAt ? brandingPage.Audit.LastModifiedAt : themesParagraphLastChanged.Audit.LastModifiedAt;
36 var cssThemeAndBrandingStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath($"/Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_{Model.Area.ID}.min.css"));
37
38 // Schema.org details for PDP
39 string productId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : "";
40 bool isProductDetailsPage = !string.IsNullOrEmpty(productId);
41 bool isArticlePage = Model.ItemType == "Swift_Article";
42 string schemaOrgType = string.Empty;
43
44 char[] MyChar = {'/'};
45 var urlCro = Dynamicweb.Context.Current.Request.RawUrl.Split('?')[0].Replace("/products/","/proizvodi/").Replace("/"+pageDomain+"/","").Replace("/"+pageDomain,"").Replace("Default.aspx","").TrimStart(MyChar);
46 var urlEng = Dynamicweb.Context.Current.Request.RawUrl.Split('?')[0].Replace("/"+pageDomain+"/","").Replace("/"+pageDomain,"").Replace("Default.aspx","").TrimStart(MyChar);
47
48 if (isProductDetailsPage)
49 {
50 schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Product\"";
51 }
52
53 if (isArticlePage)
54 {
55 schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Article\"";
56 }
57
58 if (!cssThemeAndBrandingStyleFileInfo.Exists || cssThemeAndBrandingStyleFileInfo.LastWriteTime < brandingPage.Audit.LastModifiedAt)
59 {
60 //Branding page has been saved or the file is missing. Rewrite the file to disc.
61 if (brandingPageId > 0)
62 {
63 var brandingPageview = Dynamicweb.Frontend.PageView.GetPageviewByPageID(brandingPageId);
64 brandingPageview.Redirect = false;
65 brandingPageview.Output();
66 }
67 }
68
69 if (!cssThemeAndBrandingStyleFileInfo.Exists || cssThemeAndBrandingStyleFileInfo.LastWriteTime < themesParagraphLastChanged.Audit.LastModifiedAt)
70 {
71 //Branding page has been saved or the file is missing. Rewrite the file to disc.
72 if (themePageId > 0)
73 {
74 var themePageview = Dynamicweb.Frontend.PageView.GetPageviewByPageID(themePageId);
75 themePageview.Redirect = false;
76 themePageview.Output();
77 }
78 }
79
80 var cssStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath("/Files/Templates/Designs/Swift/Assets/css/styles.css"));
81 var jsFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath("/Files/Templates/Designs/Swift/Assets/js/scripts.js"));
82
83 string masterTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("Theme")) ? " theme " + Model.Area.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
84
85 string favicon = Model.Area.Item.GetFile("Favicon") != null ? Model.Area.Item.GetFile("Favicon").Path : "/Files/Templates/Designs/Swift/Assets/Images/favicon.png";
86
87 string headerCssClass = "sticky-top";
88 bool movePageBehind = false;
89
90 if (Pageview.Page.PropertyItem != null)
91 {
92 headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top";
93 movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false;
94 }
95
96 headerCssClass = headerCssClass == "" ? "sticky-top" : headerCssClass;
97 headerCssClass = Pageview.IsVisualEditorMode ? "" : headerCssClass;
98
99 string googleTagManagerID = Model.Area.Item.GetString("GoogleTagManagerID");
100 string googleAnalyticsMeasurementID = Model.Area.Item.GetString("GoogleAnalyticsMeasurementID");
101 var cookieOptInLevel = CookieManager.GetCookieOptInLevel();
102 bool allowTracking = cookieOptInLevel == CookieOptInLevel.All || (cookieOptInLevel == CookieOptInLevel.Functional && CookieManager.GetCookieOptInCategories().Contains("Statistical"));
103
104 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/css/styles.css?{cssStyleFileInfo.LastWriteTime.Ticks}>; rel=preload; as=style;");
105 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;");
106 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/js/aos.js?{jsFileInfo.LastWriteTime.Ticks}; rel=preload; as=script;");
107 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/js/scripts.js?{jsFileInfo.LastWriteTime.Ticks}; rel=preload; as=script;");
108 //Dynamicweb.Context.Current.Response.Flush(); //This sends the headers where we are now in the rendering making the TTFB faster
109
110 SetMetaTags();
111
112 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>();
113
114 if (Pageview.Area.IsMaster)
115 {
116 languages.Add(Pageview.Page);
117 if (Pageview.Page.Languages != null)
118 {
119 foreach (var language in Pageview.Page.Languages)
120 {
121 languages.Add(language);
122 }
123 }
124 }
125 else
126 {
127 languages.Add(Pageview.Page.MasterPage);
128 if (Pageview.Page.MasterPage != null)
129 {
130 if (Pageview.Page.MasterPage.Languages != null)
131 {
132 foreach (var language in Pageview.Page.MasterPage.Languages)
133 {
134 languages.Add(language);
135 }
136 }
137 }
138 }
139
140 string siteLanguage = Pageview.Area.CultureInfo.Name;
141 Uri url = Dynamicweb.Context.Current.Request.Url;
142 string hostName = url.Host; // domain.com/da-dk or domain.com/en-us
143
144 var ecomCountries = Dynamicweb.Ecommerce.Services.Countries.GetCountries();
145 var ecomCurrencies = Dynamicweb.Ecommerce.Services.Currencies.GetAllCurrencies();
146
147 }
148 <!doctype html>
149 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">
150 <head>
151 <!-- @swiftVersion -->
152 @* Required meta tags *@
153 <meta charset="utf-8">
154 <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0">
155 <link rel="shortcut icon" href="@favicon">
156 <link rel="apple-touch-icon" href="/Files/Templates/Designs/Swift/Assets/Images/logo_transparent.png">
157
158 @* Preventing page from caching because of not loading cart content
159 Dignet 28.07.2023.
160 *@
161 <meta http-equiv="cache-control" content="max-age=0">
162 <meta http-equiv="cache-control" content="no-cache">
163 <meta http-equiv="expires" content="-1">
164 <meta http-equiv="expires" content="Tue, 01 Jan 1980 11:00:00 GMT">
165 <meta http-equiv="pragma" content="no-cache">
166 @*------- end Dignet 28.07.2023. *@
167
168 @Model.MetaTags
169
170 <title>@Model.Title</title>
171 @* Bootstrap + Swift stylesheet *@
172 <link href="/Files/Templates/Designs/Swift/Assets/css/styles.css?@cssStyleFileInfo.LastWriteTime.Ticks" rel="stylesheet" media="all" type="text/css">
173
174 @{
175 basePageUrl = url.Host;
176 pageURL = (basePageUrl.Substring(basePageUrl.Length - 3, 3) == "com" ? "/in-en" : "/hr-hr") + pageURL;
177 }
178 <link rel="canonical" href="https://@basePageUrl@pageURL" />
179 <link rel="alternate" href="https://@basePageUrl/hr-hr/@alternatePageAddress" hreflang="hr-hr" />
180
181 @{
182 basePageUrl = basePageUrl.Replace(".hr", ".com");
183 alternatePageAddress = Dynamicweb.Context.Current.Request.RawUrl.Split('?')[0].Replace("/proizvodi/","/products/").Replace("/"+pageDomain+"/","").Replace("/"+pageDomain,"");
184 alternatePageAddress = alternatePageAddress.Length > 1 ? alternatePageAddress : "";
185 }
186
187 <link rel="alternate" href="https://@basePageUrl/eu-en/@alternatePageAddress" hreflang="en-eu" />
188 <link rel="alternate" href="https://@basePageUrl/na-en/@alternatePageAddress" hreflang="en-ca" />
189 <link rel="alternate" href="https://@basePageUrl/na-en/@alternatePageAddress" hreflang="en-us" />
190 <link rel="alternate" href="https://@basePageUrl/ch-en/@alternatePageAddress" hreflang="en-cn" />
191 <link rel="alternate" href="https://@basePageUrl/jp-en/@alternatePageAddress" hreflang="en-jp" />
192 <link rel="alternate" href="https://@basePageUrl/sa-en/@alternatePageAddress" hreflang="es-xl" />
193 <link rel="alternate" href="https://@basePageUrl/uk-en/@alternatePageAddress" hreflang="en-gb" />
194 <link rel="alternate" href="https://@basePageUrl/au-en/@alternatePageAddress" hreflang="en-au" />
195 <link rel="alternate" href="https://@basePageUrl/in-en/@alternatePageAddress" hreflang="en" />
196 <link rel="alternate" href="https://@basePageUrl/in-en/@alternatePageAddress" hreflang="x-default" />
197
198
199 @if (disableWideBreakpoints != "disableBoth")
200 {
201 <style>
202 @@media ( min-width: 1600px ) {
203 .container-xxl,
204 .container-xl,
205 .container-lg,
206 .container-md,
207 .container-sm,
208 .container {
209 max-width: 1520px;
210 }
211 }
212 </style>
213
214
215
216 if (disableWideBreakpoints != "disableUltraWideOnly")
217 {
218 <style>
219 @@media ( min-width: 1920px ) {
220 .container-xxl,
221 .container-xl,
222 .container-lg,
223 .container-md,
224 .container-sm,
225 .container {
226 max-width: 1820px;
227 }
228 }
229 </style>
230 }
231 }
232
233 @* Branding and Themes min stylesheet *@
234 <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">
235 <script src="/Files/Templates/Designs/Swift/Assets/js/aos.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
236 <script src="/Files/Templates/Designs/Swift/Assets/js/scripts.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
237
238 <script type="module">
239 AOS.init({ duration: 400, delay: 100, easing: 'ease-in-out', mirror: false, disable: window.matchMedia('(prefers-reduced-motion: reduce)') });
240 swift.Scroll.hideHeadersOnScroll();
241 swift.Scroll.handleAlternativeTheme();
242 </script>
243
244 @* Google tag manager *@
245 @if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking)
246 {
247 <script>
248 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
249 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
250 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
251 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
252 })(window, document, 'script', 'dataLayer', '@(googleTagManagerID)');
253
254 function gtag() { dataLayer.push(arguments); }
255 </script>
256 }
257
258 @if (!string.IsNullOrWhiteSpace(googleAnalyticsMeasurementID) && allowTracking)
259 {
260 var GoogleAnalyticsDebugMode = "";
261 bool isLoggedInBackendUser = false;
262
263 if (Dynamicweb.Security.UserManagement.User.GetCurrentBackendUser() != null)
264 {
265 isLoggedInBackendUser = true;
266 }
267
268 if (Model.Area.Item.GetBoolean("EnableGoogleAnalyticsDebugMode") && isLoggedInBackendUser)
269 {
270 GoogleAnalyticsDebugMode = ", {'debug_mode': true}";
271 }
272
273 <script async src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsMeasurementID"></script>
274 <script>
275 window.dataLayer = window.dataLayer || [];
276 function gtag() { dataLayer.push(arguments); }
277 gtag('js', new Date());
278 gtag('config', '@googleAnalyticsMeasurementID'@GoogleAnalyticsDebugMode);
279 </script>
280 }
281
282 @if (!string.IsNullOrWhiteSpace(customHeaderInclude))
283 {
284 @RenderPartial($"Components/Custom/{customHeaderInclude}")
285 }
286 </head>
287 <body class="brand @(masterTheme)" id="page@(Model.ID)" onload="checkCookie()">
288 @* Google tag manager *@
289 @if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking)
290 {
291 <noscript>
292 <iframe src="https://www.googletagmanager.com/ns.html?id=@(googleTagManagerID)"
293 height="0" width="0" style="display:none;visibility:hidden"></iframe>
294 </noscript>
295 }
296
297 @if (renderAsResponsive || !renderMobile)
298 {
299 <header class="page-header @headerCssClass top-0@(responsiveClassDesktop)" id="page-header-desktop">
300 @if (@Model.Area.Item.GetLink("HeaderDesktop") != null)
301 {
302 @RenderGrid(@Model.Area.Item.GetLink("HeaderDesktop").PageId)
303 }
304 </header>
305 }
306
307 @if ((renderAsResponsive || renderMobile))
308 {
309 <header class="page-header @headerCssClass top-0@(responsiveClassMobile)" id="page-header-mobile">
310 @if (@Model.Area.Item.GetLink("HeaderMobile") != null)
311 {
312 @RenderGrid(@Model.Area.Item.GetLink("HeaderMobile").PageId)
313 }
314 </header>
315 }
316
317 <main id="content" @(schemaOrgType)>
318 <div data-intersect></div>
319 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
320 @using System
321 @using Dynamicweb.Ecommerce.ProductCatalog
322
323
324 @{
325 string productIdFromUrl = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : string.Empty;
326 bool isProductDetail = !string.IsNullOrEmpty(productIdFromUrl) && Pageview.Page.NavigationTag.ToLower() == "shop";
327
328 bool isArticlePagePage = Model.ItemType == "Swift_Article";
329 bool isArticleListPage = Model.ItemType == "Swift_ArticleListPage";
330 string schemaOrgProp = string.Empty;
331 if(isArticlePagePage)
332 {
333 schemaOrgProp = "itemprop=\"articleBody\"";
334 }
335
336 string theme = "";
337 string gridContent = "";
338
339 if (Model.PropertyItem != null)
340 {
341 theme = !string.IsNullOrWhiteSpace(Model.PropertyItem.GetRawValueString("Theme")) ? "theme " + Model.PropertyItem.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
342 }
343
344 if (Model.Item != null || Pageview.IsVisualEditorMode)
345 {
346 if (!isProductDetail)
347 {
348 gridContent = Model.Grid("Grid", "Grid", "default:true;sort:1", "Page");
349 }
350 else
351 {
352 var productObject = Dynamicweb.Ecommerce.Services.Products.GetProductById(productIdFromUrl, "", Pageview.Area.EcomLanguageId);
353 var detailPage = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(productObject.PrimaryGroupId)?.Meta.PrimaryPage ?? string.Empty;
354 var detailPageId = detailPage != string.Empty ? Convert.ToInt16(detailPage.Substring(detailPage.LastIndexOf('=') + 1)) : GetPageIdByNavigationTag("ProductDetailPage");
355
356 @RenderGrid(detailPageId)
357 }
358 }
359
360 bool doNotRenderPage = false;
361
362 //Check if we are on the poduct detail page, and if there is data to render
363 ProductViewModel product = new ProductViewModel();
364 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails"))
365 {
366 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"];
367 if (string.IsNullOrEmpty(product.Id)) {
368 doNotRenderPage = true;
369 }
370 }
371
372 //Render the page
373 if (!doNotRenderPage) {
374 string itemIdentifier = Model?.Item?.SystemName != null ? "item_" + Model.Item.SystemName.ToLower() : "item_Swift_Page";
375
376
377 <div class="@theme @itemIdentifier" @schemaOrgProp>
378 @if (isArticleListPage)
379 {
380 var hx = $"hx-get=\"{Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(Model.ID)}\" hx-select=\"#content\" hx-target=\"#content\" hx-swap=\"outerHTML\" hx-trigger=\"change\" hx-headers='{{\"feed\": \"true\"}}' hx-push-url=\"true\" hx-indicator=\"#ArticleFacetForm\"";
381
382 <form @hx id="ArticleFacetForm">
383 @gridContent
384 </form>
385 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/htmx.js"></script>
386 <script type="module">
387 document.addEventListener('htmx:confirm', (event) => {
388 let filters = event.detail.elt.querySelectorAll('select');
389 for (var i = 0; i < filters.length; i++) {
390 let input = filters[i];
391 if (input.name && !input.value) {
392 input.name = '';
393 }
394 }
395 });
396
397 document.addEventListener('htmx:beforeOnLoad', (event) => {
398 swift.Scroll.stopIntersectionObserver();
399 });
400
401 document.addEventListener('htmx:afterOnLoad', () => {
402 swift.Scroll.hideHeadersOnScroll();
403 swift.Scroll.handleAlternativeTheme();
404 });
405 </script>
406 }
407 else
408 {
409 @gridContent
410 }
411 </div>
412
413 } else {
414 <div class="container">
415 <div class="alert alert-info" role="alert">@Translate("Sorry. There is nothing to view here")</div>
416 </div>
417 }
418
419 if (!Model.IsCurrentUserAllowed)
420 {
421 int signInPage = GetPageIdByNavigationTag("SignInPage");
422 int dashboardPage = GetPageIdByNavigationTag("MyAccountDashboardPage");
423
424 if (!Pageview.IsVisualEditorMode)
425 {
426 if (signInPage != 0)
427 {
428 if (signInPage != Model.ID) {
429 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + signInPage);
430 } else {
431 if (dashboardPage != 0) {
432 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + dashboardPage);
433 } else {
434 Dynamicweb.Context.Current.Response.Redirect("/");
435 }
436 }
437 }
438 else
439 {
440 <div class="alert alert-dark m-0" role="alert">
441 <span>@Translate("You do not have access to this page")</span>
442 </div>
443 }
444 }
445 else
446 {
447 <div class="alert alert-dark m-0" role="alert">
448 <span>@Translate("To work on this page, you must be signed in, in the frontend")</span>
449 </div>
450 }
451 }
452 }
453
454 </main>
455
456 @if (renderAsResponsive || !renderMobile)
457 {
458 <footer class="page-footer@(responsiveClassDesktop)" id="page-footer-desktop">
459 @if (@Model.Area.Item.GetLink("FooterDesktop") != null)
460 {
461 @RenderGrid(@Model.Area.Item.GetLink("FooterDesktop").PageId)
462 }
463 </footer>
464 }
465
466 @if (renderAsResponsive || renderMobile)
467 {
468 <footer class="page-footer@(responsiveClassMobile)" id="page-footer-mobile">
469 @if (@Model.Area.Item.GetLink("FooterMobile") != null)
470 {
471 @RenderGrid(@Model.Area.Item.GetLink("FooterMobile").PageId)
472 }
473 </footer>
474 }
475
476 @* Render any offcanvas menu here *@
477 @RenderSnippet("offcanvas")
478
479 @{
480 bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Context.Current.Items["IsWebServiceConnectionAvailable"]);
481 }
482
483 @* Language selector modal *@
484 @if (languages.Count > 1 || ecomCountries.Count > 1 || ecomCurrencies.Count() > 1)
485 {
486 <div class="modal fade" id="PreferencesModal" tabindex="-1" aria-hidden="true">
487 <div class="modal-dialog modal-dialog-centered modal-sm" id="PreferencesModalContent">
488 @* The content here comes from an external request *@
489 </div>
490 </div>
491 }
492
493 @* Favorite toast *@
494 <div aria-live="polite" aria-atomic="true">
495 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
496 <div id="favoriteNotificationToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
497 <div class="toast-header">
498 <strong class="me-auto">@Translate("Favorite list updated")</strong>
499 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
500 </div>
501 <div class="toast-body d-flex gap-3">
502 <div id="favoriteNotificationToast_Image"></div>
503 <div id="favoriteNotificationToast_Text"></div>
504 </div>
505 </div>
506 </div>
507 </div>
508
509 @* Modal for dynamic content *@
510 <div class="modal fade js-product" id="DynamicModal" tabindex="-1" aria-hidden="true">
511 <div class="modal-dialog modal-dialog-centered modal-md">
512 <div class="modal-content theme light" id="DynamicModalContent">
513 @* The content here comes from an external request *@
514 </div>
515 </div>
516 </div>
517
518 @* Offcanvas for dynamic content *@
519 <div class="offcanvas offcanvas-end theme light" tabindex="-1" id="DynamicOffcanvas" style="width: 30rem">
520 @* The content here comes from an external request *@
521 </div>
522
523 @if (isErpConnectionDown && Model.Area.Item.GetBoolean("ShowErpDownMessage"))
524 {
525 string erpDownMessageTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ErpDownMessageTheme")) ? " theme " + Model.Area.Item.GetRawValueString("ErpDownMessageTheme").Replace(" ", "").Trim().ToLower() : "theme light";
526
527 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 1040">
528 <div class="toast fade show border-0 @erpDownMessageTheme" role="alert" aria-live="assertive" aria-atomic="true">
529 <div class="toast-header">
530 <strong class="me-auto">@Translate("Connection down")</strong>
531 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
532 </div>
533 <div class="toast-body">
534 @Translate("We are experiencing some connectivity issues. Not all features may be available to you.")
535 </div>
536 </div>
537 </div>
538 }
539
540 </body>
541 </html>
542 @functions {
543 void SetMetaTags()
544 {
545 //Verification Tokens
546 string siteVerificationGoogle = Model.Area.Item.GetString("Google_Site_Verification") != null ? Model.Area.Item.GetString("Google_Site_Verification") : "";
547 //string siteVerificationYandex = Model.Area.Item.GetString("Yandex_Verification") != null ? Model.Area.Item.GetString("Yandex_Verification") : "";
548 //string siteVerificationMS = Model.Area.Item.GetString("Msvalidate_01") != null ? Model.Area.Item.GetString("Msvalidate_01") : "";
549 //string siteVerificationAlexa = Model.Area.Item.GetString("AlexaVerifyID") != null ? Model.Area.Item.GetString("AlexaVerifyID") : "";
550 //string siteVerificationPinterest = Model.Area.Item.GetString("P_domain_verify") != null ? Model.Area.Item.GetString("P_domain_verify") : "";
551 //string siteVerificationNorton = Model.Area.Item.GetString("Norton_safeweb_site_verification") != null ? Model.Area.Item.GetString("Norton_safeweb_site_verification") : "";
552
553 //Generic Site Values
554 string openGraphFacebookAppID = Model.Area.Item.GetString("Fb_app_id") != null ? Model.Area.Item.GetString("Fb_app_id") : "";
555 string openGraphType = Model.Area.Item.GetString("Open_Graph_Type") != null ? Model.Area.Item.GetString("Open_Graph_Type") : "";
556 string openGraphSiteName = Model.Area.Item.GetString("Open_Graph_Site_Name") != null ? Model.Area.Item.GetString("Open_Graph_Site_Name") : "";
557
558 string twitterCardSite = Model.Area.Item.GetString("Twitter_Site") != null ? Model.Area.Item.GetString("Twitter_Site") : "";
559
560 //Page specific values
561 string openGraphSiteTitle = Model.Area.Item.GetString("Open_Graph_Title") != null ? Model.Area.Item.GetString("Open_Graph_Title") : "";
562 FileViewModel openGraphImage = Model.Area.Item.GetFile("Open_Graph_Image");
563 string openGraphImageALT = Model.Area.Item.GetString("Open_Graph_Image_ALT") != null ? Model.Area.Item.GetString("Open_Graph_Image_ALT") : "";
564 string openGraphDescription = Model.Area.Item.GetString("Open_Graph_Description") != null ? Model.Area.Item.GetString("Open_Graph_Description") : "";
565
566 string twitterCardURL = Model.Area.Item.GetString("Twitter_URL") != null ? Model.Area.Item.GetString("Twitter_URL") : "";
567 string twitterCardTitle = Model.Area.Item.GetString("Twitter_Title") != null ? Model.Area.Item.GetString("Twitter_Title") : "";
568 string twitterCardDescription = Model.Area.Item.GetString("Twitter_Description") != null ? Model.Area.Item.GetString("Twitter_Description") : "";
569 FileViewModel twitterCardImage = Model.Area.Item.GetFile("Twitter_Image");
570 string twitterCardImageALT = Model.Area.Item.GetString("Twitter_Image_ALT") != null ? Model.Area.Item.GetString("Twitter_Image_ALT") : "";
571
572 if (string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
573 {
574 if (!string.IsNullOrEmpty(Model.Description))
575 {
576 Pageview.Meta.AddTag($"<meta property=\"og:description\" content=\"{Model.Description}\" />");
577 }
578 else
579 {
580 Pageview.Meta.AddTag($"<meta property=\"og:description\" content=\"{openGraphDescription}\" />");
581 }
582
583 if (!string.IsNullOrEmpty(Pageview.Page.TopImage))
584 {
585 Pageview.Meta.AddTag($"<meta property=\"og:image\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}/Files{Pageview.Page.TopImage}\" />");
586 Pageview.Meta.AddTag($"<meta property=\"og:image:secure_url\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}/Files{Pageview.Page.TopImage}\" />");
587 }
588 else if (openGraphImage != null)
589 {
590 Pageview.Meta.AddTag($"<meta property=\"og:image\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}{openGraphImage.Path}\" />");
591 Pageview.Meta.AddTag($"<meta property=\"og:image:secure_url\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}{openGraphImage.Path}\" />");
592 }
593
594 if (!string.IsNullOrEmpty(openGraphImageALT))
595 {
596 Pageview.Meta.AddTag($"<meta property=\"og:image:alt\" content=\"{openGraphImageALT}\" />");
597 }
598 if (!string.IsNullOrEmpty(twitterCardDescription))
599 {
600 Pageview.Meta.AddTag("twitter:description", twitterCardDescription);
601 }
602
603 if (!string.IsNullOrEmpty(Pageview.Page.TopImage))
604 {
605 Pageview.Meta.AddTag("twitter:image", $"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}/Files{Pageview.Page.TopImage}");
606 }
607 else if (twitterCardImage != null)
608 {
609 Pageview.Meta.AddTag("twitter:image", $"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}{openGraphImage.Path}");
610 }
611
612 if (!string.IsNullOrEmpty(twitterCardImageALT))
613 {
614 Pageview.Meta.AddTag("twitter:image:alt", twitterCardImageALT);
615 }
616 }
617
618 if (!string.IsNullOrEmpty(siteVerificationGoogle))
619 {
620 Pageview.Meta.AddTag("google-site-verification", siteVerificationGoogle);
621 }
622
623 if (!string.IsNullOrEmpty(openGraphFacebookAppID))
624 {
625 Pageview.Meta.AddTag($"<meta property=\"fb:app_id\" content=\"{openGraphFacebookAppID}\" />");
626 }
627
628 if (!string.IsNullOrEmpty(openGraphType))
629 {
630 Pageview.Meta.AddTag($"<meta property=\"og:type\" content=\"{openGraphType}\" />");
631 }
632
633 if (!string.IsNullOrEmpty(openGraphSiteName))
634 {
635 Pageview.Meta.AddTag($"<meta property=\"og:url\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}{Pageview.SearchFriendlyUrl}\" />");
636 }
637
638 if (!string.IsNullOrEmpty(openGraphSiteName))
639 {
640 Pageview.Meta.AddTag($"<meta property=\"og:site_name\" content=\"{openGraphSiteName}\" />");
641 }
642
643 if (!string.IsNullOrEmpty(Model.Title))
644 {
645 Pageview.Meta.AddTag($"<meta property=\"og:title\" content=\"{Model.Title}\" />");
646 }
647 else
648 {
649 Pageview.Meta.AddTag($"<meta property=\"og:title\" content=\"{openGraphSiteTitle}\" />");
650 }
651
652 if (!string.IsNullOrEmpty(twitterCardSite))
653 {
654 Pageview.Meta.AddTag("twitter:site", twitterCardSite);
655 }
656
657 if (!string.IsNullOrEmpty(twitterCardURL))
658 {
659 Pageview.Meta.AddTag("twitter:url", twitterCardURL);
660 }
661
662 if (!string.IsNullOrEmpty(twitterCardTitle))
663 {
664 Pageview.Meta.AddTag("twitter:title", twitterCardTitle);
665 }
666 }
667 }
668 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
669
670 @using System
671 @using Dynamicweb
672 @using Dynamicweb.Environment
673 @using Dynamicweb.Frontend
674 @using System.Web
675 @using System.Web.SessionState
676
677 @{
678 var sessionRegion =(string)Dynamicweb.Context.Current.Session["selectedregion"];
679 var hostNameForRedirect = Dynamicweb.Context.Current.Request.Url.Host.Replace(".hr", ".com");
680 string HostPageLink = @Dynamicweb.Context.Current.Request.Url.Host;
681 }
682
683 <div id="regionSelector" class="changeLocationDiv" style="display: none;">
684 <div class="chooseLangMain">
685 <div>@Translate("Please select your region to proceed"):</div>
686 @if (pageDomain == "hr-hr") {
687 <div class="languages">
688 <div class="firstRowLang langColumn">
689 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
690 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
691 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
692 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/hr-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
693 </div>
694 <div class="secondRowLang langColumn">
695 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
696 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
697 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
698 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
699 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
700 </div>
701 </div>
702 } else if (pageDomain == "b2ball-hr") {
703 <div class="languages">
704 <div class="firstRowLang langColumn">
705 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
706 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
707 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
708 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/b2ball-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
709 </div>
710 <div class="secondRowLang langColumn">
711 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
712 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
713 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
714 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
715 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
716 </div>
717 </div>
718 } else if (pageDomain == "b2b-hr") {
719 <div class="languages">
720 <div class="firstRowLang langColumn">
721 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
722 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
723 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
724 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/b2b-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
725 </div>
726 <div class="secondRowLang langColumn">
727 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
728 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
729 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
730 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
731 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
732 </div>
733 </div>
734 } else if (pageDomain == "b2i-hr") {
735 <div class="languages">
736 <div class="firstRowLang langColumn">
737 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
738 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
739 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
740 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/b2i-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
741 </div>
742 <div class="secondRowLang langColumn">
743 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
744 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
745 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
746 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
747 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
748 </div>
749 </div>
750 } else {
751 <div class="languages">
752 <div class="firstRowLang langColumn">
753 <p><a href="https://@hostNameForRedirect/eu-en/@urlEng?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
754 <p><a href="https://@hostNameForRedirect/na-en/@urlEng?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
755 <p><a href="https://@hostNameForRedirect/ch-en/@urlEng?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
756 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/hr-hr?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
757 </div>
758 <div class="secondRowLang langColumn">
759 <p><a href="https://@hostNameForRedirect/jp-en/@urlEng?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
760 <p><a href="https://@hostNameForRedirect/sa-en/@urlEng?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
761 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/@urlEng?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
762 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/@urlEng?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
763 <p><a href="https://@hostNameForRedirect/in-en/@urlEng?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
764 </div>
765 </div>
766 }
767 </div>
768 <div id="toggleregionSelector" class="u-pull--right" style="position: absolute;right: 10px;top: 0;" onclick="document.getElementById('regionSelector').style.display = 'none';">
769 <img class="grid--external-bleed-y" src="/Files/Images/icons8-multiply-50.png" width="24" height="24" alt="Multiply icon" style="float: right;cursor: pointer;">
770 </div>
771 </div>
772
773
774
775
776 <div id="warningModal" class="" style="display:none">
777 <div class="">
778 <h2>@Translate("Changing language")</h2>
779 </div>
780 <div class="">
781 <p class="u-no-margin" id="">@Translate("You are changing language. If you continue, basket will be cleared. Do you wish to continue?")</p>
782 <div class="product-list__grid-item__footer dw-mod" style="border:0;">
783 <label id="backToPage" class="btn u-margin-left--lg btn--secondary btn--condensed u-no-margin u-pull--right dw-mod">@Translate("No")</label>
784 <button class="btn btn--primary btn--condensed u-no-margin u-pull--right dw-mod" onclick="" id="ChangeLanguageButton">@Translate("Yes")</button>
785 </div>
786 </div>
787 </div>
788
789 <style>
790 .regionSelectorShow {
791 diplay: flex !important
792 }
793 </style>
794
795 <script>
796
797 function setCookie(cname, cvalue, exdays) {
798 const d = new Date();
799 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
800 let expires = "expires=" + d.toUTCString();
801 document.cookie = cname + "=" + cvalue + ";" + expires;
802 }
803
804 function getCookie(cname) {
805 let name = cname + "=";
806 let decodedCookie = decodeURIComponent(document.cookie);
807 let ca = decodedCookie.split(';');
808 for (let i = 0; i < ca.length; i++) {
809 let c = ca[i];
810 while (c.charAt(0) == ' ') {
811 c = c.substring(1);
812 }
813 if (c.indexOf(name) == 0) {
814 return c.substring(name.length, c.length);
815 }
816 }
817 return "";
818 }
819 function createCookie2() {
820 let usernameCookie = getCookie("usernameCookie");
821 usernameCookie = "Visited";
822 setCookie("usernameCookie", usernameCookie, 30);
823 document.querySelector("#FormCookie").classList.remove("FormShow");
824 }
825
826 function checkCookie() {
827 let user = getCookie("usernameCookie");
828 if (user != "Visited") {
829 document.querySelector("#regionSelector").classList.add("regionSelectorShow");
830 } else {
831 document.querySelector("#regionSelector").classList.remove("regionSelectorShow");
832 }
833 }
834 </script>
835
836
837 <style type="text/css">
838 .FormButton {
839 position: absolute;
840 top: 10%;
841 right: 20px;
842 border-radius: 48%;
843 color: red;
844 background-color: white;
845 width: 30px;
846 height: 30px;
847 }
848
849 .FormMain {
850 height: auto;
851 display: flex;
852 align-items: flex-start;
853 justify-content: center;
854 flex-direction: column;
855 font-family: "Montserrat";
856 font-size: 1.2em;
857 color: black;
858 font-weight: 500;
859 }
860
861 .FormCookie {
862 position: fixed;
863 left: 0;
864 top: 10%;
865 right: 0;
866 margin: auto;
867 display: flex;
868 width: 100vw;
869 height: auto;
870 justify-content: center;
871 align-items: center;
872 z-index: 90;
873 max-width: 500px;
874 padding: 20px;
875 }
876
877 .FormShow {
878 display: flex !important
879 }
880 </style>
881
882 <div class="FormCookie" id="FormCookie" style="display:none">
883 <div class="FormMain">
884 <div id="regionSelector" class="changeLocationDiv">
885 <div class="chooseLangMain">
886 <div>@Translate("Please select your region to proceed"):</div>
887 @if (pageDomain == "hr-hr") {
888 <div class="languages">
889 <div class="firstRowLang langColumn">
890 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
891 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
892 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
893 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/hr-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
894 </div>
895 <div class="secondRowLang langColumn">
896 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
897 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
898 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
899 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
900 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
901 </div>
902 </div>
903 } else if (pageDomain == "b2ball-hr") {
904 <div class="languages">
905 <div class="firstRowLang langColumn">
906 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
907 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
908 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
909 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/b2ball-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
910 </div>
911 <div class="secondRowLang langColumn">
912 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
913 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
914 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
915 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
916 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
917 </div>
918 </div>
919 } else if (pageDomain == "b2b-hr") {
920 <div class="languages">
921 <div class="firstRowLang langColumn">
922 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
923 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
924 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
925 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/b2b-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
926 </div>
927 <div class="secondRowLang langColumn">
928 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
929 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
930 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
931 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
932 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
933 </div>
934 </div>
935 } else if (pageDomain == "b2i-hr") {
936 <div class="languages">
937 <div class="firstRowLang langColumn">
938 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
939 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
940 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
941 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/b2i-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
942 </div>
943 <div class="secondRowLang langColumn">
944 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
945 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
946 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
947 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
948 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
949 </div>
950 </div>
951 } else {
952 <div class="languages">
953 <div class="firstRowLang langColumn">
954 <p><a href="https://@hostNameForRedirect/eu-en/@urlEng?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
955 <p><a href="https://@hostNameForRedirect/na-en/@urlEng?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
956 <p><a href="https://@hostNameForRedirect/ch-en/@urlEng?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
957 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/hr-hr?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
958 </div>
959 <div class="secondRowLang langColumn">
960 <p><a href="https://@hostNameForRedirect/jp-en/@urlEng?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
961 <p><a href="https://@hostNameForRedirect/sa-en/@urlEng?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
962 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/@urlEng?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
963 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/@urlEng?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
964 <p><a href="https://@hostNameForRedirect/in-en/@urlEng?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
965 </div>
966 </div>
967 }
968 </div>
969 <div id="toggleregionSelector" class="u-pull--right" style="position: absolute; right: 10px;top: 0;" onclick="document.getElementById('regionSelector').style.display = 'none';">
970 <img class="grid--external-bleed-y" src="/Files/Images/icons8-multiply-50.png" width="24" height="24" alt="Multiply icon" style="float: right;cursor: pointer;">
971 </div>
972 </div>
973 </div>
974 </div>
975
976
977 <script>
978
979 function setCookie(cname, cvalue, exdays) {
980 const d = new Date();
981 d.setTime(d.getTime() + (d * 24 * 60 * 60 * 1000));
982 let expires = "expires=" + d.toUTCString();
983 document.cookie = cname + "=" + cvalue + ";" + expires;
984 }
985
986 function getCookie(cname) {
987 let name = cname + "=";
988 let decodedCookie = decodeURIComponent(document.cookie);
989 let ca = decodedCookie.split(';');
990 for (let i = 0; i < ca.length; i++) {
991 let c = ca[i];
992 while (c.charAt(0) == ' ') {
993 c = c.substring(1);
994 }
995 if (c.indexOf(name) == 0) {
996 return c.substring(name.length, c.length);
997 }
998 }
999 return "";
1000 }
1001 function createCookie2() {
1002 let usernameCookie = getCookie("usernameCookie");
1003 usernameCookie = "Visited";
1004 setCookie("usernameCookie", usernameCookie, 30);
1005 document.querySelector("#FormCookie").classList.remove("FormShow");
1006 }
1007
1008 function checkCookie() {
1009 let user = getCookie("usernameCookie");
1010 if (user != "Visited") {
1011 document.querySelector("#FormCookie").classList.add("FormShow");
1012 } else {
1013 document.querySelector("#FormCookie").classList.remove("FormShow");
1014 }
1015 }
1016 </script>
1017