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 system cannot find the file specified
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_6542ee9a7f094da38b648bc24198be88.Execute() in C:\inetpub\wwwroot\DWShop2023\Solutions\Swift_v1.21.0\Files\Templates\Designs\Swift\_parsed\Swift_Page.parsed.cshtml:line 370
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:2,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 <script type="application/ld+json">
152 {
153 "@@context": "https://schema.org/",
154 "@@type": "Organization",
155 "name": "Potomac grupa d.o.o.",
156 "url": "https://www.croata.hr/",
157 "logo": "https://www.croata.hr/Files/Images/Logos/Croata_Logo.jpg",
158 "sameAs": ["https://www.facebook.com/CROATAlife/", "https://www.instagram.com/croatalife/", "https://www.pinterest.com/croatalife/", "https://www.linkedin.com/showcase/croata", "https://www.youtube.com/channel/UC6UKVh1GFpwBX74ve2obh4Q" ],
159 "contactPoint" : [
160 { "@@type" : "ContactPoint",
161 "telephone" : "+385 1 645 7010",
162 "email": "info@croata.hr",
163 "availableLanguage" : @Translate("schema_languages"),
164 "contactType" : @Translate("schema_customerservice")
165 }]
166 }
167 </script>
168 <!-- @swiftVersion -->
169 @* Required meta tags *@
170 <meta charset="utf-8">
171 <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0">
172 <link rel="shortcut icon" href="@favicon">
173 <link rel="apple-touch-icon" href="/Files/Templates/Designs/Swift/Assets/Images/logo_transparent.png">
174
175 @* Preventing page from caching because of not loading cart content
176 Dignet 28.07.2023.
177 *@
178 <meta http-equiv="cache-control" content="max-age=0">
179 <meta http-equiv="cache-control" content="no-cache">
180 <meta http-equiv="expires" content="-1">
181 <meta http-equiv="expires" content="Tue, 01 Jan 1980 11:00:00 GMT">
182 <meta http-equiv="pragma" content="no-cache">
183 @*------- end Dignet 28.07.2023. *@
184
185 @Model.MetaTags
186
187 <title>@Model.Title</title>
188 @* Bootstrap + Swift stylesheet *@
189 <link href="/Files/Templates/Designs/Swift/Assets/css/styles.css?@cssStyleFileInfo.LastWriteTime.Ticks" rel="stylesheet" media="all" type="text/css">
190
191 @{
192 basePageUrl = url.Host;
193 pageURL = (basePageUrl.Substring(basePageUrl.Length - 3, 3) == "com" ? "/in-en" : "/hr-hr") + pageURL;
194 }
195 <link rel="canonical" href="https://@basePageUrl@pageURL" />
196 <link rel="alternate" href="https://@basePageUrl/hr-hr/@alternatePageAddress" hreflang="hr-hr" />
197
198 @{
199 basePageUrl = basePageUrl.Replace(".hr", ".com");
200 alternatePageAddress = Dynamicweb.Context.Current.Request.RawUrl.Split('?')[0].Replace("/proizvodi/","/products/").Replace("/"+pageDomain+"/","").Replace("/"+pageDomain,"");
201 alternatePageAddress = alternatePageAddress.Length > 1 ? alternatePageAddress : "";
202 }
203
204 <link rel="alternate" href="https://@basePageUrl/eu-en/@alternatePageAddress" hreflang="en-eu" />
205 <link rel="alternate" href="https://@basePageUrl/na-en/@alternatePageAddress" hreflang="en-ca" />
206 <link rel="alternate" href="https://@basePageUrl/na-en/@alternatePageAddress" hreflang="en-us" />
207 <link rel="alternate" href="https://@basePageUrl/ch-en/@alternatePageAddress" hreflang="en-cn" />
208 <link rel="alternate" href="https://@basePageUrl/jp-en/@alternatePageAddress" hreflang="en-jp" />
209 <link rel="alternate" href="https://@basePageUrl/sa-en/@alternatePageAddress" hreflang="es-xl" />
210 <link rel="alternate" href="https://@basePageUrl/uk-en/@alternatePageAddress" hreflang="en-gb" />
211 <link rel="alternate" href="https://@basePageUrl/au-en/@alternatePageAddress" hreflang="en-au" />
212 <link rel="alternate" href="https://@basePageUrl/in-en/@alternatePageAddress" hreflang="en" />
213 <link rel="alternate" href="https://@basePageUrl/in-en/@alternatePageAddress" hreflang="x-default" />
214
215
216 @if (disableWideBreakpoints != "disableBoth")
217 {
218 <style>
219 @@media ( min-width: 1600px ) {
220 .container-xxl,
221 .container-xl,
222 .container-lg,
223 .container-md,
224 .container-sm,
225 .container {
226 max-width: 1520px;
227 }
228 }
229 </style>
230
231
232
233 if (disableWideBreakpoints != "disableUltraWideOnly")
234 {
235 <style>
236 @@media ( min-width: 1920px ) {
237 .container-xxl,
238 .container-xl,
239 .container-lg,
240 .container-md,
241 .container-sm,
242 .container {
243 max-width: 1820px;
244 }
245 }
246 </style>
247 }
248 }
249
250 @* Branding and Themes min stylesheet *@
251 <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">
252 <script src="/Files/Templates/Designs/Swift/Assets/js/aos.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
253 <script src="/Files/Templates/Designs/Swift/Assets/js/scripts.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
254
255 <script type="module">
256 AOS.init({ duration: 400, delay: 100, easing: 'ease-in-out', mirror: false, disable: window.matchMedia('(prefers-reduced-motion: reduce)') });
257 swift.Scroll.hideHeadersOnScroll();
258 swift.Scroll.handleAlternativeTheme();
259 </script>
260
261 @* Google tag manager *@
262 @if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking)
263 {
264 <script>
265 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
266 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
267 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
268 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
269 })(window, document, 'script', 'dataLayer', '@(googleTagManagerID)');
270
271 function gtag() { dataLayer.push(arguments); }
272 </script>
273 }
274
275 @if (!string.IsNullOrWhiteSpace(googleAnalyticsMeasurementID) && allowTracking)
276 {
277 var GoogleAnalyticsDebugMode = "";
278 bool isLoggedInBackendUser = false;
279
280 if (Dynamicweb.Security.UserManagement.User.GetCurrentBackendUser() != null)
281 {
282 isLoggedInBackendUser = true;
283 }
284
285 if (Model.Area.Item.GetBoolean("EnableGoogleAnalyticsDebugMode") && isLoggedInBackendUser)
286 {
287 GoogleAnalyticsDebugMode = ", {'debug_mode': true}";
288 }
289
290 <script async src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsMeasurementID"></script>
291 <script>
292 window.dataLayer = window.dataLayer || [];
293 function gtag() { dataLayer.push(arguments); }
294 gtag('js', new Date());
295 gtag('config', '@googleAnalyticsMeasurementID'@GoogleAnalyticsDebugMode);
296 </script>
297 }
298
299 @if (!string.IsNullOrWhiteSpace(customHeaderInclude))
300 {
301 @RenderPartial($"Components/Custom/{customHeaderInclude}")
302 }
303
304 </head>
305 <body class="brand @(masterTheme)" id="page@(Model.ID)" onload="checkCookie()">
306 @* Google tag manager *@
307 @if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking)
308 {
309 <noscript>
310 <iframe src="https://www.googletagmanager.com/ns.html?id=@(googleTagManagerID)"
311 height="0" width="0" style="display:none;visibility:hidden"></iframe>
312 </noscript>
313 }
314
315 @if (renderAsResponsive || !renderMobile)
316 {
317 <header class="page-header @headerCssClass top-0@(responsiveClassDesktop)" id="page-header-desktop">
318 @if (@Model.Area.Item.GetLink("HeaderDesktop") != null)
319 {
320 @RenderGrid(@Model.Area.Item.GetLink("HeaderDesktop").PageId)
321 }
322 </header>
323 }
324
325 @if ((renderAsResponsive || renderMobile))
326 {
327 <header class="page-header @headerCssClass top-0@(responsiveClassMobile)" id="page-header-mobile">
328 @if (@Model.Area.Item.GetLink("HeaderMobile") != null)
329 {
330 @RenderGrid(@Model.Area.Item.GetLink("HeaderMobile").PageId)
331 }
332 </header>
333 }
334
335 <main id="content" @(schemaOrgType)>
336 <div data-intersect></div>
337 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
338 @using System
339 @using Dynamicweb.Ecommerce.ProductCatalog
340
341
342 @{
343 string productIdFromUrl = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : string.Empty;
344 bool isProductDetail = !string.IsNullOrEmpty(productIdFromUrl) && Pageview.Page.NavigationTag.ToLower() == "shop";
345
346 bool isArticlePagePage = Model.ItemType == "Swift_Article";
347 bool isArticleListPage = Model.ItemType == "Swift_ArticleListPage";
348 string schemaOrgProp = string.Empty;
349 if(isArticlePagePage)
350 {
351 schemaOrgProp = "itemprop=\"articleBody\"";
352 }
353
354 string theme = "";
355 string gridContent = "";
356
357 if (Model.PropertyItem != null)
358 {
359 theme = !string.IsNullOrWhiteSpace(Model.PropertyItem.GetRawValueString("Theme")) ? "theme " + Model.PropertyItem.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
360 }
361
362 if (Model.Item != null || Pageview.IsVisualEditorMode)
363 {
364 if (!isProductDetail)
365 {
366 gridContent = Model.Grid("Grid", "Grid", "default:true;sort:1", "Page");
367 }
368 else
369 {
370 var productObject = Dynamicweb.Ecommerce.Services.Products.GetProductById(productIdFromUrl, "", Pageview.Area.EcomLanguageId);
371 var detailPage = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(productObject.PrimaryGroupId)?.Meta.PrimaryPage ?? string.Empty;
372 var detailPageId = detailPage != string.Empty ? Convert.ToInt16(detailPage.Substring(detailPage.LastIndexOf('=') + 1)) : GetPageIdByNavigationTag("ProductDetailPage");
373
374 @RenderGrid(detailPageId)
375 }
376 }
377
378 bool doNotRenderPage = false;
379
380 //Check if we are on the poduct detail page, and if there is data to render
381 ProductViewModel product = new ProductViewModel();
382 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails"))
383 {
384 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"];
385 if (string.IsNullOrEmpty(product.Id)) {
386 doNotRenderPage = true;
387 }
388 }
389
390 //Render the page
391 if (!doNotRenderPage) {
392 string itemIdentifier = Model?.Item?.SystemName != null ? "item_" + Model.Item.SystemName.ToLower() : "item_Swift_Page";
393
394
395 <div class="@theme @itemIdentifier" @schemaOrgProp>
396 @if (isArticleListPage)
397 {
398 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\"";
399
400 <form @hx id="ArticleFacetForm">
401 @gridContent
402 </form>
403 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/htmx.js"></script>
404 <script type="module">
405 document.addEventListener('htmx:confirm', (event) => {
406 let filters = event.detail.elt.querySelectorAll('select');
407 for (var i = 0; i < filters.length; i++) {
408 let input = filters[i];
409 if (input.name && !input.value) {
410 input.name = '';
411 }
412 }
413 });
414
415 document.addEventListener('htmx:beforeOnLoad', (event) => {
416 swift.Scroll.stopIntersectionObserver();
417 });
418
419 document.addEventListener('htmx:afterOnLoad', () => {
420 swift.Scroll.hideHeadersOnScroll();
421 swift.Scroll.handleAlternativeTheme();
422 });
423 </script>
424 }
425 else
426 {
427 @gridContent
428 }
429 </div>
430
431 } else {
432 <div class="container">
433 <div class="alert alert-info" role="alert">@Translate("Sorry. There is nothing to view here")</div>
434 </div>
435 }
436
437 if (!Model.IsCurrentUserAllowed)
438 {
439 int signInPage = GetPageIdByNavigationTag("SignInPage");
440 int dashboardPage = GetPageIdByNavigationTag("MyAccountDashboardPage");
441
442 if (!Pageview.IsVisualEditorMode)
443 {
444 if (signInPage != 0)
445 {
446 if (signInPage != Model.ID) {
447 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + signInPage);
448 } else {
449 if (dashboardPage != 0) {
450 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + dashboardPage);
451 } else {
452 Dynamicweb.Context.Current.Response.Redirect("/");
453 }
454 }
455 }
456 else
457 {
458 <div class="alert alert-dark m-0" role="alert">
459 <span>@Translate("You do not have access to this page")</span>
460 </div>
461 }
462 }
463 else
464 {
465 <div class="alert alert-dark m-0" role="alert">
466 <span>@Translate("To work on this page, you must be signed in, in the frontend")</span>
467 </div>
468 }
469 }
470 }
471
472 </main>
473
474 @if (renderAsResponsive || !renderMobile)
475 {
476 <footer class="page-footer@(responsiveClassDesktop)" id="page-footer-desktop">
477 @if (@Model.Area.Item.GetLink("FooterDesktop") != null)
478 {
479 @RenderGrid(@Model.Area.Item.GetLink("FooterDesktop").PageId)
480 }
481 </footer>
482 }
483
484 @if (renderAsResponsive || renderMobile)
485 {
486 <footer class="page-footer@(responsiveClassMobile)" id="page-footer-mobile">
487 @if (@Model.Area.Item.GetLink("FooterMobile") != null)
488 {
489 @RenderGrid(@Model.Area.Item.GetLink("FooterMobile").PageId)
490 }
491 </footer>
492 }
493
494 @* Render any offcanvas menu here *@
495 @RenderSnippet("offcanvas")
496
497 @{
498 bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Context.Current.Items["IsWebServiceConnectionAvailable"]);
499 }
500
501 @* Language selector modal *@
502 @if (languages.Count > 1 || ecomCountries.Count > 1 || ecomCurrencies.Count() > 1)
503 {
504 <div class="modal fade" id="PreferencesModal" tabindex="-1" aria-hidden="true">
505 <div class="modal-dialog modal-dialog-centered modal-sm" id="PreferencesModalContent">
506 @* The content here comes from an external request *@
507 </div>
508 </div>
509 }
510
511 @* Favorite toast *@
512 <div aria-live="polite" aria-atomic="true">
513 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
514 <div id="favoriteNotificationToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
515 <div class="toast-header">
516 <strong class="me-auto">@Translate("Favorite list updated")</strong>
517 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
518 </div>
519 <div class="toast-body d-flex gap-3">
520 <div id="favoriteNotificationToast_Image"></div>
521 <div id="favoriteNotificationToast_Text"></div>
522 </div>
523 </div>
524 </div>
525 </div>
526
527 @* Modal for dynamic content *@
528 <div class="modal fade js-product" id="DynamicModal" tabindex="-1" aria-hidden="true">
529 <div class="modal-dialog modal-dialog-centered modal-md">
530 <div class="modal-content theme light" id="DynamicModalContent">
531 @* The content here comes from an external request *@
532 </div>
533 </div>
534 </div>
535
536 @* Offcanvas for dynamic content *@
537 <div class="offcanvas offcanvas-end theme light" tabindex="-1" id="DynamicOffcanvas" style="width: 30rem">
538 @* The content here comes from an external request *@
539 </div>
540
541 @if (isErpConnectionDown && Model.Area.Item.GetBoolean("ShowErpDownMessage"))
542 {
543 string erpDownMessageTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ErpDownMessageTheme")) ? " theme " + Model.Area.Item.GetRawValueString("ErpDownMessageTheme").Replace(" ", "").Trim().ToLower() : "theme light";
544
545 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 1040">
546 <div class="toast fade show border-0 @erpDownMessageTheme" role="alert" aria-live="assertive" aria-atomic="true">
547 <div class="toast-header">
548 <strong class="me-auto">@Translate("Connection down")</strong>
549 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
550 </div>
551 <div class="toast-body">
552 @Translate("We are experiencing some connectivity issues. Not all features may be available to you.")
553 </div>
554 </div>
555 </div>
556 }
557
558 </body>
559 </html>
560 @functions {
561 void SetMetaTags()
562 {
563 //Verification Tokens
564 string siteVerificationGoogle = Model.Area.Item.GetString("Google_Site_Verification") != null ? Model.Area.Item.GetString("Google_Site_Verification") : "";
565 //string siteVerificationYandex = Model.Area.Item.GetString("Yandex_Verification") != null ? Model.Area.Item.GetString("Yandex_Verification") : "";
566 //string siteVerificationMS = Model.Area.Item.GetString("Msvalidate_01") != null ? Model.Area.Item.GetString("Msvalidate_01") : "";
567 //string siteVerificationAlexa = Model.Area.Item.GetString("AlexaVerifyID") != null ? Model.Area.Item.GetString("AlexaVerifyID") : "";
568 //string siteVerificationPinterest = Model.Area.Item.GetString("P_domain_verify") != null ? Model.Area.Item.GetString("P_domain_verify") : "";
569 //string siteVerificationNorton = Model.Area.Item.GetString("Norton_safeweb_site_verification") != null ? Model.Area.Item.GetString("Norton_safeweb_site_verification") : "";
570
571 //Generic Site Values
572 string openGraphFacebookAppID = Model.Area.Item.GetString("Fb_app_id") != null ? Model.Area.Item.GetString("Fb_app_id") : "";
573 string openGraphType = Model.Area.Item.GetString("Open_Graph_Type") != null ? Model.Area.Item.GetString("Open_Graph_Type") : "";
574 string openGraphSiteName = Model.Area.Item.GetString("Open_Graph_Site_Name") != null ? Model.Area.Item.GetString("Open_Graph_Site_Name") : "";
575
576 string twitterCardSite = Model.Area.Item.GetString("Twitter_Site") != null ? Model.Area.Item.GetString("Twitter_Site") : "";
577
578 //Page specific values
579 string openGraphSiteTitle = Model.Area.Item.GetString("Open_Graph_Title") != null ? Model.Area.Item.GetString("Open_Graph_Title") : "";
580 FileViewModel openGraphImage = Model.Area.Item.GetFile("Open_Graph_Image");
581 string openGraphImageALT = Model.Area.Item.GetString("Open_Graph_Image_ALT") != null ? Model.Area.Item.GetString("Open_Graph_Image_ALT") : "";
582 string openGraphDescription = Model.Area.Item.GetString("Open_Graph_Description") != null ? Model.Area.Item.GetString("Open_Graph_Description") : "";
583
584 string twitterCardURL = Model.Area.Item.GetString("Twitter_URL") != null ? Model.Area.Item.GetString("Twitter_URL") : "";
585 string twitterCardTitle = Model.Area.Item.GetString("Twitter_Title") != null ? Model.Area.Item.GetString("Twitter_Title") : "";
586 string twitterCardDescription = Model.Area.Item.GetString("Twitter_Description") != null ? Model.Area.Item.GetString("Twitter_Description") : "";
587 FileViewModel twitterCardImage = Model.Area.Item.GetFile("Twitter_Image");
588 string twitterCardImageALT = Model.Area.Item.GetString("Twitter_Image_ALT") != null ? Model.Area.Item.GetString("Twitter_Image_ALT") : "";
589
590 if (string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
591 {
592 if (!string.IsNullOrEmpty(Model.Description))
593 {
594 Pageview.Meta.AddTag($"<meta property=\"og:description\" content=\"{Model.Description}\" />");
595 }
596 else
597 {
598 Pageview.Meta.AddTag($"<meta property=\"og:description\" content=\"{openGraphDescription}\" />");
599 }
600
601 if (!string.IsNullOrEmpty(Pageview.Page.TopImage))
602 {
603 Pageview.Meta.AddTag($"<meta property=\"og:image\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}/Files{Pageview.Page.TopImage}\" />");
604 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}\" />");
605 }
606 else if (openGraphImage != null)
607 {
608 Pageview.Meta.AddTag($"<meta property=\"og:image\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}{openGraphImage.Path}\" />");
609 Pageview.Meta.AddTag($"<meta property=\"og:image:secure_url\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}{openGraphImage.Path}\" />");
610 }
611
612 if (!string.IsNullOrEmpty(openGraphImageALT))
613 {
614 Pageview.Meta.AddTag($"<meta property=\"og:image:alt\" content=\"{openGraphImageALT}\" />");
615 }
616 if (!string.IsNullOrEmpty(twitterCardDescription))
617 {
618 Pageview.Meta.AddTag("twitter:description", twitterCardDescription);
619 }
620
621 if (!string.IsNullOrEmpty(Pageview.Page.TopImage))
622 {
623 Pageview.Meta.AddTag("twitter:image", $"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}/Files{Pageview.Page.TopImage}");
624 }
625 else if (twitterCardImage != null)
626 {
627 Pageview.Meta.AddTag("twitter:image", $"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}{openGraphImage.Path}");
628 }
629
630 if (!string.IsNullOrEmpty(twitterCardImageALT))
631 {
632 Pageview.Meta.AddTag("twitter:image:alt", twitterCardImageALT);
633 }
634 }
635
636 if (!string.IsNullOrEmpty(siteVerificationGoogle))
637 {
638 Pageview.Meta.AddTag("google-site-verification", siteVerificationGoogle);
639 }
640
641 if (!string.IsNullOrEmpty(openGraphFacebookAppID))
642 {
643 Pageview.Meta.AddTag($"<meta property=\"fb:app_id\" content=\"{openGraphFacebookAppID}\" />");
644 }
645
646 if (!string.IsNullOrEmpty(openGraphType))
647 {
648 Pageview.Meta.AddTag($"<meta property=\"og:type\" content=\"{openGraphType}\" />");
649 }
650
651 if (!string.IsNullOrEmpty(openGraphSiteName))
652 {
653 Pageview.Meta.AddTag($"<meta property=\"og:url\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}{Pageview.SearchFriendlyUrl}\" />");
654 }
655
656 if (!string.IsNullOrEmpty(openGraphSiteName))
657 {
658 Pageview.Meta.AddTag($"<meta property=\"og:site_name\" content=\"{openGraphSiteName}\" />");
659 }
660
661 if (!string.IsNullOrEmpty(Model.Title))
662 {
663 Pageview.Meta.AddTag($"<meta property=\"og:title\" content=\"{Model.Title}\" />");
664 }
665 else
666 {
667 Pageview.Meta.AddTag($"<meta property=\"og:title\" content=\"{openGraphSiteTitle}\" />");
668 }
669
670 if (!string.IsNullOrEmpty(twitterCardSite))
671 {
672 Pageview.Meta.AddTag("twitter:site", twitterCardSite);
673 }
674
675 if (!string.IsNullOrEmpty(twitterCardURL))
676 {
677 Pageview.Meta.AddTag("twitter:url", twitterCardURL);
678 }
679
680 if (!string.IsNullOrEmpty(twitterCardTitle))
681 {
682 Pageview.Meta.AddTag("twitter:title", twitterCardTitle);
683 }
684 }
685 }
686 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
687
688 @using System
689 @using Dynamicweb
690 @using Dynamicweb.Environment
691 @using Dynamicweb.Frontend
692 @using System.Web
693 @using System.Web.SessionState
694
695 @{
696 var sessionRegion =(string)Dynamicweb.Context.Current.Session["selectedregion"];
697 var hostNameForRedirect = Dynamicweb.Context.Current.Request.Url.Host.Replace(".hr", ".com");
698 string HostPageLink = @Dynamicweb.Context.Current.Request.Url.Host;
699 }
700
701 <div id="regionSelector" class="changeLocationDiv" style="display: none;">
702 <div class="chooseLangMain">
703 <div>@Translate("Please select your region to proceed"):</div>
704 @if (pageDomain == "hr-hr") {
705 <div class="languages">
706 <div class="firstRowLang langColumn">
707 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
708 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
709 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
710 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/hr-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
711 </div>
712 <div class="secondRowLang langColumn">
713 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
714 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
715 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
716 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
717 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
718 </div>
719 </div>
720 } else if (pageDomain == "b2ball-hr") {
721 <div class="languages">
722 <div class="firstRowLang langColumn">
723 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
724 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
725 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
726 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/b2ball-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
727 </div>
728 <div class="secondRowLang langColumn">
729 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
730 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
731 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
732 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
733 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
734 </div>
735 </div>
736 } else if (pageDomain == "b2b-hr") {
737 <div class="languages">
738 <div class="firstRowLang langColumn">
739 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
740 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
741 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
742 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/b2b-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
743 </div>
744 <div class="secondRowLang langColumn">
745 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
746 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
747 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
748 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
749 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
750 </div>
751 </div>
752 } else if (pageDomain == "b2i-hr") {
753 <div class="languages">
754 <div class="firstRowLang langColumn">
755 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
756 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
757 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
758 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/b2i-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
759 </div>
760 <div class="secondRowLang langColumn">
761 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
762 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
763 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
764 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
765 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
766 </div>
767 </div>
768 } else {
769 <div class="languages">
770 <div class="firstRowLang langColumn">
771 <p><a href="https://@hostNameForRedirect/eu-en/@urlEng?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
772 <p><a href="https://@hostNameForRedirect/na-en/@urlEng?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
773 <p><a href="https://@hostNameForRedirect/ch-en/@urlEng?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
774 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/hr-hr?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
775 </div>
776 <div class="secondRowLang langColumn">
777 <p><a href="https://@hostNameForRedirect/jp-en/@urlEng?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
778 <p><a href="https://@hostNameForRedirect/sa-en/@urlEng?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
779 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/@urlEng?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
780 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/@urlEng?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
781 <p><a href="https://@hostNameForRedirect/in-en/@urlEng?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
782 </div>
783 </div>
784 }
785 </div>
786 <div id="toggleregionSelector" class="u-pull--right" style="position: absolute;right: 10px;top: 0;" onclick="document.getElementById('regionSelector').style.display = 'none';">
787 <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;">
788 </div>
789 </div>
790
791
792
793
794 <div id="warningModal" class="" style="display:none">
795 <div class="">
796 <h2>@Translate("Changing language")</h2>
797 </div>
798 <div class="">
799 <p class="u-no-margin" id="">@Translate("You are changing language. If you continue, basket will be cleared. Do you wish to continue?")</p>
800 <div class="product-list__grid-item__footer dw-mod" style="border:0;">
801 <label id="backToPage" class="btn u-margin-left--lg btn--secondary btn--condensed u-no-margin u-pull--right dw-mod">@Translate("No")</label>
802 <button class="btn btn--primary btn--condensed u-no-margin u-pull--right dw-mod" onclick="" id="ChangeLanguageButton">@Translate("Yes")</button>
803 </div>
804 </div>
805 </div>
806
807 <style>
808 .regionSelectorShow {
809 diplay: flex !important
810 }
811 </style>
812
813 <script>
814
815 function setCookie(cname, cvalue, exdays) {
816 const d = new Date();
817 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
818 let expires = "expires=" + d.toUTCString();
819 document.cookie = cname + "=" + cvalue + ";" + expires;
820 }
821
822 function getCookie(cname) {
823 let name = cname + "=";
824 let decodedCookie = decodeURIComponent(document.cookie);
825 let ca = decodedCookie.split(';');
826 for (let i = 0; i < ca.length; i++) {
827 let c = ca[i];
828 while (c.charAt(0) == ' ') {
829 c = c.substring(1);
830 }
831 if (c.indexOf(name) == 0) {
832 return c.substring(name.length, c.length);
833 }
834 }
835 return "";
836 }
837 function createCookie2() {
838 let usernameCookie = getCookie("usernameCookie");
839 usernameCookie = "Visited";
840 setCookie("usernameCookie", usernameCookie, 30);
841 document.querySelector("#FormCookie").classList.remove("FormShow");
842 }
843
844 function checkCookie() {
845 let user = getCookie("usernameCookie");
846 if (user != "Visited") {
847 document.querySelector("#regionSelector").classList.add("regionSelectorShow");
848 } else {
849 document.querySelector("#regionSelector").classList.remove("regionSelectorShow");
850 }
851 }
852 </script>
853
854
855 <style type="text/css">
856 .FormButton {
857 position: absolute;
858 top: 10%;
859 right: 20px;
860 border-radius: 48%;
861 color: red;
862 background-color: white;
863 width: 30px;
864 height: 30px;
865 }
866
867 .FormMain {
868 height: auto;
869 display: flex;
870 align-items: flex-start;
871 justify-content: center;
872 flex-direction: column;
873 font-family: "Montserrat";
874 font-size: 1.2em;
875 color: black;
876 font-weight: 500;
877 }
878
879 .FormCookie {
880 position: fixed;
881 left: 0;
882 top: 10%;
883 right: 0;
884 margin: auto;
885 display: flex;
886 width: 100vw;
887 height: auto;
888 justify-content: center;
889 align-items: center;
890 z-index: 90;
891 max-width: 500px;
892 padding: 20px;
893 }
894
895 .FormShow {
896 display: flex !important
897 }
898 </style>
899
900 <div class="FormCookie" id="FormCookie" style="display:none">
901 <div class="FormMain">
902 <div id="regionSelector" class="changeLocationDiv">
903 <div class="chooseLangMain">
904 <div>@Translate("Please select your region to proceed"):</div>
905 @if (pageDomain == "hr-hr") {
906 <div class="languages">
907 <div class="firstRowLang langColumn">
908 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
909 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
910 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
911 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/hr-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
912 </div>
913 <div class="secondRowLang langColumn">
914 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
915 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
916 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
917 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
918 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
919 </div>
920 </div>
921 } else if (pageDomain == "b2ball-hr") {
922 <div class="languages">
923 <div class="firstRowLang langColumn">
924 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
925 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
926 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
927 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/b2ball-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
928 </div>
929 <div class="secondRowLang langColumn">
930 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
931 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
932 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
933 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
934 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
935 </div>
936 </div>
937 } else if (pageDomain == "b2b-hr") {
938 <div class="languages">
939 <div class="firstRowLang langColumn">
940 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
941 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
942 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
943 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/b2b-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
944 </div>
945 <div class="secondRowLang langColumn">
946 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
947 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
948 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
949 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
950 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
951 </div>
952 </div>
953 } else if (pageDomain == "b2i-hr") {
954 <div class="languages">
955 <div class="firstRowLang langColumn">
956 <p><a href="https://@hostNameForRedirect/eu-en/?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
957 <p><a href="https://@hostNameForRedirect/na-en/?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
958 <p><a href="https://@hostNameForRedirect/ch-en/?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
959 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/b2i-hr/@urlCro?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
960 </div>
961 <div class="secondRowLang langColumn">
962 <p><a href="https://@hostNameForRedirect/jp-en/?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
963 <p><a href="https://@hostNameForRedirect/sa-en/?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
964 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
965 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
966 <p><a href="https://@hostNameForRedirect/in-en/?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
967 </div>
968 </div>
969 } else {
970 <div class="languages">
971 <div class="firstRowLang langColumn">
972 <p><a href="https://@hostNameForRedirect/eu-en/@urlEng?CurrencyCode=EUR&region=EU&cartcmd=emptycart" onclick="createCookie2()">Europe (EUR)</a></p>
973 <p><a href="https://@hostNameForRedirect/na-en/@urlEng?CurrencyCode=USD&region=NA&cartcmd=emptycart" onclick="createCookie2()">US & Canada (USD)</a></p>
974 <p><a href="https://@hostNameForRedirect/ch-en/@urlEng?CurrencyCode=CNY&region=CH&cartcmd=emptycart" onclick="createCookie2()">China (CNY)</a></p>
975 <p><a href="https://@hostNameForRedirect.Replace(".com", ".hr")/hr-hr?CurrencyCode=EUR&region=HR&cartcmd=emptycart" onclick="createCookie2()">Croatia (Hrvatska) (EUR)</a></p>
976 </div>
977 <div class="secondRowLang langColumn">
978 <p><a href="https://@hostNameForRedirect/jp-en/@urlEng?CurrencyCode=JPY&region=JP&cartcmd=emptycart" onclick="createCookie2()">Japan (JPY)</a></p>
979 <p><a href="https://@hostNameForRedirect/sa-en/@urlEng?CurrencyCode=USD&region=LA&cartcmd=emptycart" onclick="createCookie2()">Latin America (USD)</a></p>
980 <p style="display:none;"><a href="https://@hostNameForRedirect/uk-en/@urlEng?CurrencyCode=GBP&region=GB&cartcmd=emptycart" onclick="createCookie2()">United Kingdom (GBP)</a></p>
981 <p style="display:none;"><a href="https://@hostNameForRedirect/au-en/@urlEng?CurrencyCode=AUD&region=AU&cartcmd=emptycart" onclick="createCookie2()">Australia (AUD)</a></p>
982 <p><a href="https://@hostNameForRedirect/in-en/@urlEng?CurrencyCode=USD&region=IN&cartcmd=emptycart" onclick="createCookie2()">All Other Countries (USD)</a></p>
983 </div>
984 </div>
985 }
986 </div>
987 <div id="toggleregionSelector" class="u-pull--right" style="position: absolute; right: 10px;top: 0;" onclick="document.getElementById('regionSelector').style.display = 'none';">
988 <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;">
989 </div>
990 </div>
991 </div>
992 </div>
993
994
995 <script>
996
997 function setCookie(cname, cvalue, exdays) {
998 const d = new Date();
999 d.setTime(d.getTime() + (d * 24 * 60 * 60 * 1000));
1000 let expires = "expires=" + d.toUTCString();
1001 document.cookie = cname + "=" + cvalue + ";" + expires;
1002 }
1003
1004 function getCookie(cname) {
1005 let name = cname + "=";
1006 let decodedCookie = decodeURIComponent(document.cookie);
1007 let ca = decodedCookie.split(';');
1008 for (let i = 0; i < ca.length; i++) {
1009 let c = ca[i];
1010 while (c.charAt(0) == ' ') {
1011 c = c.substring(1);
1012 }
1013 if (c.indexOf(name) == 0) {
1014 return c.substring(name.length, c.length);
1015 }
1016 }
1017 return "";
1018 }
1019 function createCookie2() {
1020 let usernameCookie = getCookie("usernameCookie");
1021 usernameCookie = "Visited";
1022 setCookie("usernameCookie", usernameCookie, 30);
1023 document.querySelector("#FormCookie").classList.remove("FormShow");
1024 }
1025
1026 function checkCookie() {
1027 let user = getCookie("usernameCookie");
1028 if (user != "Visited") {
1029 document.querySelector("#FormCookie").classList.add("FormShow");
1030 } else {
1031 document.querySelector("#FormCookie").classList.remove("FormShow");
1032 }
1033 }
1034 </script>
1035