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