Error executing template "Designs/Swift/_parsed/Swift_Page.parsed.cshtml"
System.ArgumentException: Page ID must be greater than 0, but it was 0
   at Dynamicweb.Core.Ensure.That[TException](Boolean condition, String message)
   at Dynamicweb.Content.ParagraphService.GetParagraphsByPageId(Int32 pageId, ParagraphSort sortBy)
   at Dynamicweb.Frontend.Content.GetParagraphs(Int32 pageId)
   at Dynamicweb.Frontend.Content.CreateGridContent(Int32 contentId, Boolean ignoreVisualEdit)
   at Dynamicweb.Frontend.Content.RenderExternalGrid(Int32 pageId, String container)
   at CompiledRazorTemplates.Dynamic.RazorEngine_a54396f406a7474987ad740fb4fc990b.Execute() in C:\inetpub\wwwroot\AllMedia\Production\Files\Templates\Designs\Swift\_parsed\Swift_Page.parsed.cshtml:line 609
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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