Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_b1fd1e061908468ea35fbca59015bcf7.b__70_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\bosch.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 3298
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_b1fd1e061908468ea35fbca59015bcf7.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\bosch.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_b1fd1e061908468ea35fbca59015bcf7.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\bosch.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_b1fd1e061908468ea35fbca59015bcf7.b__69_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\bosch.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 3282
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_b1fd1e061908468ea35fbca59015bcf7.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\bosch.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_b1fd1e061908468ea35fbca59015bcf7.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\bosch.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_b1fd1e061908468ea35fbca59015bcf7.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\bosch.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 166
   at CompiledRazorTemplates.Dynamic.RazorEngine_b1fd1e061908468ea35fbca59015bcf7.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\bosch.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_b1fd1e061908468ea35fbca59015bcf7.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\bosch.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 3265
   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.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2 3 @* Rapido version 3.0.1 *@ 4 5 @using System.Web; 6 @using Dynamicweb.Frontend 7 @using Dynamicweb.Frontend.Devices 8 @using Dynamicweb.Extensibility 9 @using Dynamicweb.Content 10 @using Dynamicweb.Security 11 @using Dynamicweb.Core 12 @using System 13 @using System.Web 14 @using System.IO 15 @using Dynamicweb.Rapido.Blocks 16 17 @functions { 18 BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); 19 20 string getFontFamily(params string[] items) 21 { 22 var itemParent = Pageview.AreaSettings; 23 foreach (var item in items) 24 { 25 itemParent = itemParent.GetItem(item); 26 if (itemParent == null) 27 { 28 return null; 29 } 30 } 31 32 var googleFont = itemParent.GetGoogleFont("FontFamily"); 33 if (googleFont == null) 34 { 35 return null; 36 } 37 return googleFont.Family.Replace(" ", "+"); 38 } 39 } 40 @{ 41 //Font settings 42 var fonts = new string[] { 43 getFontFamily("Layout", "HeaderFont"), 44 getFontFamily("Layout", "SubheaderFont"), 45 getFontFamily("Layout", "TertiaryHeaderFont"), 46 getFontFamily("Layout", "Header", "ToolsFont"), 47 getFontFamily("Layout", "Header", "NavigationFont"), 48 getFontFamily("Layout", "MobileNavigation", "Font"), 49 getFontFamily("ProductList", "Facets", "HeaderFont"), 50 getFontFamily("ProductPage", "PriceFontDesign"), 51 getFontFamily("Ecommerce", "SaleSticker", "Font"), 52 getFontFamily("Ecommerce", "NewSticker", "Font"), 53 getFontFamily("Ecommerce", "CustomSticker", "Font") 54 }; 55 56 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 57 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 58 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 59 } 60 61 @{ 62 Block master = new Block() 63 { 64 Id = "Master", 65 BlocksList = new List<Block> { 66 new Block { 67 Id = "MasterTopSnippets", 68 SortId = 10 69 }, 70 new Block { 71 Id = "MasterMain", 72 SortId = 20, 73 Template = RenderMain(), 74 SkipRenderBlocksList = true, 75 BlocksList = new List<Block> { 76 new Block 77 { 78 Id = "MasterHeader", 79 SortId = 10, 80 Template = RenderMasterHeader(), 81 SkipRenderBlocksList = true 82 }, 83 new Block { 84 Id = "MasterPageContent", 85 SortId = 20, 86 Template = RenderPageContent() 87 } 88 } 89 }, 90 new Block { 91 Id = "MasterFooter", 92 SortId = 30 93 }, 94 new Block { 95 Id = "MasterReferences", 96 SortId = 40 97 }, 98 new Block { 99 Id = "MasterBottomSnippets", 100 SortId = 50 101 } 102 } 103 }; 104 masterPage.Add(master); 105 } 106 107 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 108 @using System.Text.RegularExpressions 109 @using System.Collections.Generic 110 @using Dynamicweb.Rapido.Blocks 111 112 113 @*--- START: Base block renderers ---*@ 114 115 @helper RenderBlockList(List<Block> blocks) 116 { 117 blocks = blocks.OrderBy(item => item.SortId).ToList(); 118 119 foreach (Block item in blocks) 120 { 121 <!-- START: @item.Id --> 122 123 if (item.Design == null) 124 { 125 @RenderBlock(item) 126 } 127 else if (item.Design.RenderType != RenderType.Hide) 128 { 129 if (item.Design.RenderType == RenderType.Row) 130 { 131 <div class="grid grid--align-content-start"> 132 @RenderBlock(item) 133 </div> 134 } 135 136 if (item.Design.RenderType == RenderType.Column) 137 { 138 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 139 string size = item.Design.Size != null ? item.Design.Size : "12"; 140 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 141 142 <div class="grid__col-lg-@item.Design.Size grid__col-md-@item.Design.Size grid__col-sm-12 grid__col-xs-12 @hidePadding" id="Block__@item.Id"> 143 @RenderBlock(item) 144 </div> 145 } 146 147 if (item.SkipRenderBlocksList == true) 148 { 149 @RenderBlock(item) 150 } 151 } 152 153 <!-- END: @item.Id --> 154 } 155 } 156 157 @helper RenderBlock(Block item) 158 { 159 if (item.Template != null) 160 { 161 @BlocksPage.RenderTemplate(item.Template) 162 } 163 164 if (item.BlocksList.Count > 0 && item.SkipRenderBlocksList == false) 165 { 166 @RenderBlockList(item.BlocksList) 167 } 168 } 169 170 @*--- END: Base block renderers ---*@ 171 172 173 @* Include the Blocks for the page *@ 174 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 175 176 @using System 177 @using System.Web 178 @using System.Collections.Generic 179 @using Dynamicweb.Rapido.Blocks.Extensibility 180 @using Dynamicweb.Rapido.Blocks 181 182 @{ 183 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 184 185 Block tagManager = new Block() 186 { 187 Id = "TagManager", 188 SortId = 1, 189 Template = RenderGoogleTagManager() 190 }; 191 192 Block facebookPixel = new Block() 193 { 194 Id = "FacebookPixel", 195 SortId = 2, 196 Template = RenderFacebookPixel() 197 }; 198 199 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager); 200 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 201 } 202 203 @helper RenderGoogleTagManager() { 204 string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID") != null ? Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID") : ""; 205 206 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 207 { 208 <script> 209 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 210 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 211 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 212 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 213 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 214 </script> 215 <!-- Google Tag Manager (noscript) --> 216 <noscript> 217 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 218 height="0" width="0" style="display:none;visibility:hidden"></iframe> 219 </noscript> 220 <!-- End Google Tag Manager (noscript) --> 221 } 222 } 223 224 @helper RenderFacebookPixel() { 225 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID") != null ? Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID") : ""; 226 227 if (!string.IsNullOrWhiteSpace(FacebookPixelID)) 228 { 229 <!-- Facebook Pixel Code --> 230 <script> 231 !function(f,b,e,v,n,t,s) 232 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 233 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 234 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 235 n.queue=[];t=b.createElement(e);t.async=!0; 236 t.src=v;s=b.getElementsByTagName(e)[0]; 237 s.parentNode.insertBefore(t,s)}(window, document,'script', 238 'https://connect.facebook.net/en_US/fbevents.js'); 239 fbq('init', '@FacebookPixelID'); 240 fbq('track', 'PageView'); 241 </script> 242 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 243 } 244 } 245 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 246 247 @using System 248 @using System.Web 249 @using System.Collections.Generic 250 @using Dynamicweb.Rapido.Blocks.Extensibility 251 @using Dynamicweb.Rapido.Blocks 252 253 254 @{ 255 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 256 257 Block loginModal = new Block() 258 { 259 Id = "LoginModal", 260 SortId = 10, 261 Template = LoginModal() 262 }; 263 264 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 265 } 266 267 @helper LoginModal() { 268 int pageId = Model.TopPage.ID; 269 string userSignedInError = !Model.LogOnFailed ? "" : "checked"; 270 string userSignedInErrorText = ""; 271 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 272 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 273 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 274 275 if (Model.LogOnFailed) { 276 switch (Model.LogOnFailedReason) 277 { 278 case Dynamicweb.Security.UserManagement.LogOnFailedReason.PasswordLengthInvalid: 279 userSignedInErrorText = Translate("Password length is invalid"); 280 break; 281 case Dynamicweb.Security.UserManagement.LogOnFailedReason.IncorrectLogin: 282 userSignedInErrorText = Translate("Invalid email or password"); 283 break; 284 case Dynamicweb.Security.UserManagement.LogOnFailedReason.ExceededFailedLogOnLimit: 285 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 286 break; 287 case Dynamicweb.Security.UserManagement.LogOnFailedReason.LoginLocked: 288 userSignedInErrorText = Translate("The user account is temporarily locked"); 289 break; 290 case Dynamicweb.Security.UserManagement.LogOnFailedReason.PasswordExpired: 291 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 292 break; 293 default: 294 userSignedInErrorText = Translate("An unknown error occured"); 295 break; 296 } 297 } 298 299 <!-- Trigger for the login modal --> 300 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError /> 301 302 <!-- Login modal --> 303 <div class="modal-container"> 304 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label> 305 <div class="modal modal--xs" id="SignInModal"> 306 <div class="modal__header"> 307 <h2>@Translate("Sign in")</h2> 308 </div> 309 <div class="modal__body"> 310 <form method="post" id="LoginForm" class="u-no-margin"> 311 <input type="hidden" name="ID" value="@pageId" /> 312 <input type="hidden" name="DWExtranetUsernameRemember" value="True" /> 313 <input type="hidden" name="DWExtranetPasswordRemember" value="True" /> 314 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" /> 315 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" /> 316 <div class="field-error dw-mod">@userSignedInErrorText</div> 317 318 <div class="form__field-group dw-mod"> 319 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control"> 320 <label for="LoginRememberMe"> 321 @Translate("Remember me", "Remember me") 322 </label> 323 </div> 324 325 <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button> 326 327 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a> 328 329 <a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> 330 </form> 331 </div> 332 </div> 333 </div> 334 } 335 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 336 { 337 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 338 339 @using System 340 @using System.Web 341 @using System.Collections.Generic 342 @using Dynamicweb.Rapido.Blocks.Extensibility 343 @using Dynamicweb.Rapido.Blocks 344 345 346 @functions { 347 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 348 } 349 350 @{ 351 var mobileTopLayout = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetString("Design")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 352 bool hideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 353 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 354 bool hideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 355 356 357 Block mobileHeader = new Block() 358 { 359 Id = "MobileTop", 360 SortId = 10, 361 Template = RenderMobileTop(), 362 SkipRenderBlocksList = true 363 }; 364 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 365 366 Block mobileHeaderNavigation = new Block() 367 { 368 Id = "MobileHeaderNavigation", 369 SortId = 10, 370 Template = RenderMobileHeaderNavigation(), 371 SkipRenderBlocksList = true, 372 BlocksList = new List<Block> { 373 new Block { 374 Id = "MobileHeaderNavigationTrigger", 375 SortId = 10, 376 Template = RenderMobileHeaderNavigationTrigger() 377 } 378 } 379 }; 380 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 381 382 383 Block mobileHeaderLogo = new Block() 384 { 385 Id = "MobileHeaderLogo", 386 SortId = 20, 387 Template = RenderMobileHeaderLogo(), 388 SkipRenderBlocksList = true 389 }; 390 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 391 392 Block mobileHeaderActions = new Block() 393 { 394 Id = "MobileHeaderActions", 395 SortId = 30, 396 Template = RenderMobileTopActions(), 397 SkipRenderBlocksList = true 398 }; 399 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 400 401 if (hideSearch == false) 402 { 403 Block mobileHeaderSearch = new Block 404 { 405 Id = "MobileHeaderSearch", 406 SortId = 10, 407 Template = RenderMobileTopSearch() 408 }; 409 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 410 } 411 412 Block mobileHeaderMiniCart; 413 414 if (hideCart == false) 415 { 416 mobileHeaderMiniCart = new Block 417 { 418 Id = "MobileHeaderMiniCart", 419 SortId = 20, 420 Template = RenderMobileTopMiniCart() 421 }; 422 } 423 else 424 { 425 mobileHeaderMiniCart = new Block 426 { 427 Id = "MobileHeaderMiniCart", 428 SortId = 20 429 }; 430 } 431 432 if (hideSearch == false) 433 { 434 Block mobileHeaderSearchBar = new Block() 435 { 436 Id = "MobileHeaderSearchBar", 437 SortId = 30, 438 Template = RenderMobileTopSearchBar() 439 }; 440 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 441 } 442 443 switch (mobileTopLayout) 444 { 445 case "nav-left": 446 mobileHeaderNavigation.SortId = 10; 447 mobileHeaderLogo.SortId = 20; 448 mobileHeaderActions.SortId = 30; 449 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 450 break; 451 case "nav-right": 452 mobileHeaderLogo.SortId = 10; 453 mobileHeaderActions.SortId = 20; 454 mobileHeaderNavigation.SortId = 30; 455 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 456 break; 457 case "nav-search-left": 458 mobileHeaderNavigation.SortId = 10; 459 mobileHeaderLogo.SortId = 20; 460 mobileHeaderActions.SortId = 30; 461 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 462 break; 463 case "search-left": 464 mobileHeaderActions.SortId = 10; 465 mobileHeaderLogo.SortId = 20; 466 mobileHeaderNavigation.SortId = 30; 467 mobileHeaderMiniCart.SortId = 0; 468 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 469 break; 470 } 471 } 472 473 474 @helper RenderMobileTop() 475 { 476 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 477 478 <nav class="main-navigation-mobile dw-mod"> 479 <div class="center-container top-container__center-container dw-mod"> 480 <div class="grid grid--align-center"> 481 @RenderBlockList(subBlocks) 482 </div> 483 </div> 484 </nav> 485 } 486 487 @helper RenderMobileHeaderNavigation() 488 { 489 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 490 491 <div class="grid__col-auto-width"> 492 <ul class="menu dw-mod"> 493 @RenderBlockList(subBlocks) 494 </ul> 495 </div> 496 } 497 498 @helper RenderMobileHeaderNavigationTrigger() 499 { 500 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 501 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 502 </li> 503 } 504 505 @helper RenderMobileHeaderLogo() 506 { 507 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 508 509 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 510 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 511 512 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 513 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 514 { 515 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 516 } 517 518 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 519 { 520 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 521 } 522 else 523 { 524 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 525 } 526 527 <div class="grid__col-auto"> 528 <div class="logo dw-mod"> 529 <a href="/Default.aspx?ID=@firstPageId"> 530 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 531 </a> 532 </div> 533 534 @RenderBlockList(subBlocks) 535 </div> 536 } 537 538 @helper RenderMobileTopActions() 539 { 540 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 541 542 <div class="grid__col-auto-width"> 543 <ul class="menu dw-mod"> 544 @RenderBlockList(subBlocks) 545 </ul> 546 </div> 547 } 548 549 @helper RenderMobileTopSearch() 550 { 551 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 552 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 553 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 554 </label> 555 </li> 556 } 557 558 @helper RenderMobileTopMiniCart() 559 { 560 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 561 int cartPageId = GetPageIdByNavigationTag("CartPage"); 562 double cartProductsCount = Model.Cart.TotalProductsCount; 563 564 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper" onmouseenter="Cart.UpdateMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 565 <div class="mini-cart dw-mod"> 566 <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="menu__link menu__link--icon menu__link--mobile dw-mod js-mini-cart-button u-w50px"> 567 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 568 <div class="mini-cart__counter mini-cart__counter--inline dw-mod"> 569 <div class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=Counter" data-init-onload="false" data-preloader="false"> 570 <div class="js-mini-cart-counter-content"> 571 @cartProductsCount 572 </div> 573 </div> 574 </div> 575 </a> 576 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 577 { 578 <div class="mini-cart-dropdown js-handlebars-root js-mini-cart dw-mod" id="miniCart" data-template="MiniCartContent" data-cart-id="@miniCartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 579 } 580 </div> 581 </li> 582 } 583 584 @helper RenderMobileTopSearchBar() 585 { 586 string searchFeedId = ""; 587 string searchSecondFeedId = ""; 588 int groupsFeedId; 589 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 590 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 591 string resultPageLink; 592 string searchPlaceholder; 593 string searchType = "product-search"; 594 string searchTemplate; 595 string searchContentTemplate = ""; 596 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 597 bool showGroups = true; 598 599 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 600 { 601 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 602 resultPageLink = contentSearchPageLink; 603 searchPlaceholder = Translate("Search page"); 604 groupsFeedId = 0; 605 searchType = "content-search"; 606 searchTemplate = "SearchPagesTemplate"; 607 showGroups = false; 608 } 609 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 610 { 611 searchFeedId = productsPageId + "&feed=true"; 612 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 613 resultPageLink = Converter.ToString(productsPageId); 614 searchPlaceholder = Translate("Search products or pages"); 615 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 616 searchType = "combined-search"; 617 searchTemplate = "SearchProductsTemplateWrap"; 618 searchContentTemplate = "SearchPagesTemplateWrap"; 619 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 620 } 621 else 622 { 623 resultPageLink = Converter.ToString(productsPageId); 624 searchFeedId = productsPageId + "&feed=true"; 625 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 626 searchPlaceholder = Translate("Search products"); 627 searchTemplate = "SearchProductsTemplate"; 628 searchType = "product-search"; 629 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 630 } 631 632 633 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 634 635 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 636 <div class="center-container top-container__center-container dw-mod"> 637 <div class="grid"> 638 <div class="grid__col-auto"> 639 <div class="typeahead-mobile__search-field dw-mod js-typeahead" data-page-size="@(searchType == "combined-search" ? 4 : 8)" id="MobileProductSearch" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-search-type="@searchType"> 640 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 641 @if (string.IsNullOrEmpty(searchSecondFeedId)) 642 { 643 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 644 } 645 else 646 { 647 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 648 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></div> 649 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="MobileContentSearchBarContent" data-template="@searchContentTemplate" data-json-feed="/Default.aspx?ID=@searchSecondFeedId" data-init-onload="false"></div> 650 </div> 651 } 652 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> 653 </div> 654 </div> 655 <div class="grid__col-auto-width"> 656 <ul class="menu dw-mod"> 657 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 658 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 659 <i class="fas fa-times fa-1_5x"></i> 660 </label> 661 </li> 662 </ul> 663 </div> 664 </div> 665 </div> 666 </div> 667 } </text> 668 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 669 670 @using System 671 @using System.Web 672 @using System.Collections.Generic 673 @using Dynamicweb.Rapido.Blocks.Extensibility 674 @using Dynamicweb.Rapido.Blocks 675 676 @functions { 677 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 678 } 679 680 @{ 681 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 682 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 683 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 684 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 685 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 686 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 687 688 Block mobileNavigation = new Block() 689 { 690 Id = "MobileNavigation", 691 SortId = 10, 692 Template = MobileNavigation(), 693 SkipRenderBlocksList = true 694 }; 695 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 696 697 if (Model.CurrentUser.ID > 0 && !hideMyProfileLink) 698 { 699 Block mobileNavigationSignIn = new Block 700 { 701 Id = "MobileNavigationSignIn", 702 SortId = 10, 703 Template = RenderMobileNavigationSignIn() 704 }; 705 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 706 } 707 708 Block mobileNavigationMenu = new Block 709 { 710 Id = "MobileNavigationMenu", 711 SortId = 20, 712 Template = RenderMobileNavigationMenu() 713 }; 714 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 715 716 Block mobileNavigationActions = new Block 717 { 718 Id = "MobileNavigationActions", 719 SortId = 30, 720 Template = RenderMobileNavigationActions(), 721 SkipRenderBlocksList = true 722 }; 723 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 724 725 if (!navigationItemsHideSignIn) 726 { 727 if (Model.CurrentUser.ID <= 0) 728 { 729 Block mobileNavigationSignInAction = new Block 730 { 731 Id = "MobileNavigationSignInAction", 732 SortId = 10, 733 Template = RenderMobileNavigationSignInAction() 734 }; 735 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 736 737 if (!hideCreateAccountLink) 738 { 739 Block mobileNavigationCreateAccountAction = new Block 740 { 741 Id = "MobileNavigationCreateAccountAction", 742 SortId = 20, 743 Template = RenderMobileNavigationCreateAccountAction() 744 }; 745 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 746 } 747 } 748 else 749 { 750 if (!hideMyOrdersLink) 751 { 752 Block mobileNavigationOrdersAction = new Block 753 { 754 Id = "MobileNavigationOrdersAction", 755 SortId = 20, 756 Template = RenderMobileNavigationOrdersAction() 757 }; 758 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 759 } 760 if (!hideMyFavoritesLink) 761 { 762 Block mobileNavigationFavoritesAction = new Block 763 { 764 Id = "MobileNavigationFavoritesAction", 765 SortId = 30, 766 Template = RenderMobileNavigationFavoritesAction() 767 }; 768 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 769 } 770 if (!hideMySavedCardsLink) 771 { 772 Block mobileNavigationSavedCardsAction = new Block 773 { 774 Id = "MobileNavigationSavedCardsAction", 775 SortId = 30, 776 Template = RenderMobileNavigationSavedCardsAction() 777 }; 778 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 779 } 780 781 Block mobileNavigationSignOutAction = new Block 782 { 783 Id = "MobileNavigationSignOutAction", 784 SortId = 40, 785 Template = RenderMobileNavigationSignOutAction() 786 }; 787 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 788 } 789 } 790 791 if (Model.Languages.Count > 1) 792 { 793 Block mobileNavigationLanguagesAction = new Block 794 { 795 Id = "MobileNavigationLanguagesAction", 796 SortId = 50, 797 Template = RenderMobileNavigationLanguagesAction() 798 }; 799 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 800 } 801 } 802 803 804 @helper MobileNavigation() 805 { 806 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 807 808 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 809 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 810 int cartFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 811 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 812 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 813 814 <!-- Trigger for mobile navigation --> 815 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 816 817 <!-- Mobile navigation --> 818 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 819 @RenderBlockList(subBlocks) 820 </nav> 821 822 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 823 824 if (!onlyPreview) 825 { 826 <div class="u-visually-hidden js-handlebars-root js-mini-cart" id="miniCart" data-template="MiniCartContent" data-cart-id="@cartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 827 } 828 } 829 830 @helper RenderMobileNavigationSignIn() 831 { 832 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 833 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 834 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 835 string myProfilePageLink = linkStart + myProfilePageId; 836 string userName = Model.CurrentUser.FirstName != null ? Model.CurrentUser.FirstName : ""; 837 userName += " " + Model.CurrentUser.LastName != null ? Model.CurrentUser.LastName : ""; 838 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; 839 840 <ul class="menu menu-mobile"> 841 <li class="menu-mobile__item"> 842 <a href="@myProfilePageLink" class="menu-mobile__link dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @userName</a> 843 </li> 844 </ul> 845 } 846 847 @helper RenderMobileNavigationMenu() 848 { 849 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 850 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 851 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 852 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 853 int startLevel = renderPagesInToolBar ? 1 : 0; 854 855 @RenderNavigation(new 856 { 857 id = "mobilenavigation", 858 cssclass = "menu menu-mobile dwnavigation", 859 startLevel = @startLevel, 860 ecomStartLevel = @startLevel + 1, 861 endlevel = @levels, 862 expandmode = "all", 863 template = @menuTemplate 864 }) 865 866 if (renderPagesInToolBar) 867 { 868 @RenderNavigation(new 869 { 870 id = "topToolsMobileNavigation", 871 cssclass = "menu menu-mobile dwnavigation", 872 template = "ToolsMenuForMobile.xslt" 873 }) 874 } 875 } 876 877 @helper RenderMobileNavigationActions() 878 { 879 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 880 881 <ul class="menu menu-mobile"> 882 @RenderBlockList(subBlocks) 883 </ul> 884 } 885 886 @helper RenderMobileNavigationSignInAction() 887 { 888 <li class="menu-mobile__item"> 889 <label for="SignInModalTrigger" onclick="document.getElementById('MobileNavTrigger').checked = false;" class="menu-mobile__link dw-mod menu-mobile__link--highlighted"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Sign in")</label> 890 </li> 891 } 892 893 @helper RenderMobileNavigationCreateAccountAction() 894 { 895 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 896 897 <li class="menu-mobile__item"> 898 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Default.aspx?ID=@createAccountPageId"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Create account")</a> 899 </li> 900 } 901 902 @helper RenderMobileNavigationProfileAction() 903 { 904 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 905 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 906 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 907 string myProfilePageLink = linkStart + myProfilePageId; 908 909 <li class="menu-mobile__item"> 910 <a href="@myProfilePageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("My Profile")</a> 911 </li> 912 } 913 914 @helper RenderMobileNavigationOrdersAction() 915 { 916 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 917 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 918 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 919 string myOrdersPageLink = linkStart + myOrdersPageId; 920 921 <li class="menu-mobile__item"> 922 <a href="@myOrdersPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="fas fa-list menu-mobile__link-icon"></i> @Translate("My Orders")</a> 923 </li> 924 } 925 926 @helper RenderMobileNavigationFavoritesAction() 927 { 928 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 929 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 930 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 931 string myFavoritesPageLink = linkStart + myFavoritesPageId; 932 string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star"; 933 934 935 <li class="menu-mobile__item"> 936 <a href="@myFavoritesPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@favoritesIcon menu-mobile__link-icon"></i> @Translate("My Favorites")</a> 937 </li> 938 } 939 940 @helper RenderMobileNavigationSavedCardsAction() 941 { 942 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 943 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 944 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 945 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 946 string savedCardsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards").SelectedValue : "fas fa-credit-card"; 947 948 <li class="menu-mobile__item"> 949 <a href="@mySavedCardsPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@savedCardsIcon menu-mobile__link-icon"></i> @Translate("My Saved Cards")</a> 950 </li> 951 } 952 953 @helper RenderMobileNavigationSignOutAction() 954 { 955 int pageId = Model.TopPage.ID; 956 string signOutIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon").SelectedValue : "far fa-sign-out-alt"; 957 958 959 <li class="menu-mobile__item"> 960 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId"><i class="@signOutIcon menu-mobile__link-icon"></i> @Translate("Sign out")</a> 961 </li> 962 } 963 964 @helper RenderMobileNavigationLanguagesAction() 965 { 966 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 967 968 string selectedLanguage = ""; 969 foreach (var lang in Model.Languages) 970 { 971 if (lang.IsCurrent) 972 { 973 selectedLanguage = lang.Name; 974 } 975 } 976 977 <li class="menu-mobile__item dw-mod"> 978 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 979 <div class="menu-mobile__link__wrap"> 980 <label for="MobileMenuCheck_Language" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue menu-mobile__link-icon"></i> @selectedLanguage</label> 981 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 982 </div> 983 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 984 @if (isSlidesDesign) 985 { 986 <li class="menu-mobile__item dw-mod"> 987 <div class="menu-mobile__link__wrap"> 988 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 989 <label for="MobileMenuCheck_Language" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 990 </div> 991 </li> 992 } 993 @foreach (var lang in Model.Languages) 994 { 995 <li class="menu-mobile__item dw-mod"> 996 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod menu-mobile__link--level-1" href="/Default.aspx?ID=@lang.Page.ID">@lang.Name</a> 997 </li> 998 } 999 </ul> 1000 </li> 1001 }</text> 1002 } 1003 else 1004 { 1005 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 1006 1007 @using System 1008 @using System.Web 1009 @using System.Collections.Generic 1010 @using Dynamicweb.Rapido.Blocks.Extensibility 1011 @using Dynamicweb.Rapido.Blocks 1012 1013 @functions { 1014 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 1015 } 1016 1017 @{ 1018 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 1019 bool navigationActionHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 1020 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 1021 bool showSearchIcon = false; 1022 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1023 1024 if (topLayout == "minimal" || topLayout == "minimal-right" || topLayout == "two-lines" || topLayout == "two-lines-centered") 1025 { 1026 showSearchIcon = true; 1027 } 1028 bool headerOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 1029 1030 if (renderPagesInToolBar && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 1031 { 1032 Block masterTools = new Block() 1033 { 1034 Id = "MasterDesktopTools", 1035 SortId = 10, 1036 Template = RenderDesktopTools(), 1037 SkipRenderBlocksList = true, 1038 BlocksList = new List<Block> 1039 { 1040 new Block { 1041 Id = "MasterDesktopToolsText", 1042 SortId = 10, 1043 Template = RenderDesktopToolsText(), 1044 Design = new Design 1045 { 1046 Size = "auto", 1047 HidePadding = true, 1048 RenderType = RenderType.Column 1049 } 1050 }, 1051 new Block { 1052 Id = "MasterDesktopToolsNavigation", 1053 SortId = 20, 1054 Template = RenderDesktopToolsNavigation(), 1055 Design = new Design 1056 { 1057 Size = "auto-width", 1058 HidePadding = true, 1059 RenderType = RenderType.Column 1060 } 1061 } 1062 } 1063 }; 1064 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterTools); 1065 }; 1066 1067 Block masterDesktopExtra = new Block() 1068 { 1069 Id = "MasterDesktopExtra", 1070 SortId = 10, 1071 Template = RenderDesktopExtra(), 1072 SkipRenderBlocksList = true 1073 }; 1074 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterDesktopExtra); 1075 1076 Block masterDesktopNavigation = new Block() 1077 { 1078 Id = "MasterDesktopNavigation", 1079 SortId = 20, 1080 Template = RenderDesktopNavigation(), 1081 SkipRenderBlocksList = true 1082 }; 1083 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterDesktopNavigation); 1084 1085 Block masterDesktopLogo = new Block 1086 { 1087 Id = "MasterDesktopLogo", 1088 SortId = 10, 1089 Template = RenderDesktopLogo(), 1090 Design = new Design 1091 { 1092 Size = "auto-width", 1093 HidePadding = true, 1094 RenderType = RenderType.Column 1095 } 1096 }; 1097 1098 Block masterDesktopMenu = new Block 1099 { 1100 Id = "MasterDesktopMenu", 1101 SortId = 20, 1102 Template = RenderDesktopMenu(), 1103 Design = new Design() 1104 { 1105 Size = "auto", 1106 HidePadding = true, 1107 RenderType = RenderType.Column 1108 } 1109 }; 1110 1111 Block masterDesktopActionsMenuContainer = new Block 1112 { 1113 Id = "MasterDesktopActionsMenuContainer", 1114 SortId = 30, 1115 Design = new Design 1116 { 1117 RenderType = RenderType.Column, 1118 Size = "auto" 1119 } 1120 }; 1121 1122 Block masterDesktopActionsMenu = new Block 1123 { 1124 Id = "MasterDesktopActionsMenu", 1125 SortId = 10, 1126 Template = RenderDesktopActionsMenu(), 1127 SkipRenderBlocksList = true 1128 }; 1129 1130 if (!navigationActionHideSearch && showSearchIcon) 1131 { 1132 Block masterDesktopActionsMenuSearch = new Block 1133 { 1134 Id = "MasterDesktopActionsMenuSearch", 1135 SortId = 10, 1136 Template = RenderMiniSearch() 1137 }; 1138 masterDesktopActionsMenu.Add(masterDesktopActionsMenuSearch); 1139 } 1140 1141 Block masterDesktopActionsMenuSignIn = new Block 1142 { 1143 Id = "MasterDesktopActionsMenuSignIn", 1144 SortId = 20, 1145 Template = RenderSignIn() 1146 }; 1147 masterDesktopActionsMenu.Add(masterDesktopActionsMenuSignIn); 1148 1149 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 1150 { 1151 Block masterDesktopActionsMenuFavorites = new Block 1152 { 1153 Id = "MasterDesktopActionsMenuFavorites", 1154 SortId = 30, 1155 Template = RenderFavorites() 1156 }; 1157 masterDesktopActionsMenu.Add(masterDesktopActionsMenuFavorites); 1158 } 1159 1160 Block masterDesktopActionsMenuLanguageSelector = new Block 1161 { 1162 Id = "MasterDesktopActionsMenuLanguageSelector", 1163 SortId = 40, 1164 Template = RenderLanguageSelector() 1165 }; 1166 masterDesktopActionsMenu.Add(masterDesktopActionsMenuLanguageSelector); 1167 1168 if (!headerOnlyPreview) 1169 { 1170 Block masterDesktopActionsMenuMiniCart = new Block 1171 { 1172 Id = "MasterDesktopActionsMenuMiniCart", 1173 SortId = 50, 1174 Template = RenderMiniCart() 1175 }; 1176 masterDesktopActionsMenu.Add(masterDesktopActionsMenuMiniCart); 1177 } 1178 1179 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 1180 { 1181 Block masterDesktopActionsHeaderButton = new Block 1182 { 1183 Id = "MasterDesktopActionsHeaderButton", 1184 SortId = 60, 1185 Template = RenderHeaderButton() 1186 }; 1187 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 1188 } 1189 1190 Block searchBar = new Block() 1191 { 1192 Id = "SearchBar", 1193 SortId = 40, 1194 Template = RenderSearchBar(), 1195 Design = new Design() 1196 { 1197 Size = "auto", 1198 HidePadding = true, 1199 RenderType = RenderType.Column 1200 } 1201 }; 1202 1203 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 1204 { 1205 Block impersonationBar = new Block() 1206 { 1207 Id = "ImpersonationBar", 1208 SortId = 50, 1209 Template = RenderImpersonationBar(), 1210 Design = new Design() 1211 { 1212 Size = "auto-width", 1213 HidePadding = true, 1214 RenderType = RenderType.Column 1215 } 1216 }; 1217 headerBlocksPage.Add(MasterBlockId.MasterHeader, impersonationBar); 1218 } 1219 1220 switch (topLayout) 1221 { 1222 case "condensed": //2 1223 masterDesktopLogo.SortId = 10; 1224 masterDesktopLogo.Design.Size = "auto-width"; 1225 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1226 masterDesktopMenu.SortId = 20; 1227 masterDesktopMenu.Design.Size = "auto"; 1228 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1229 masterDesktopActionsMenuContainer.SortId = 30; 1230 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1231 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1232 if (!navigationActionHideSearch) 1233 { 1234 searchBar.SortId = 40; 1235 searchBar.Design.Size = "12"; 1236 masterDesktopExtra.SortId = 50; 1237 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1238 } 1239 break; 1240 case "minimal": //4 1241 masterDesktopLogo.SortId = 10; 1242 masterDesktopLogo.Design.Size = "auto-width"; 1243 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1244 masterDesktopMenu.SortId = 10; 1245 masterDesktopMenu.Design.Size = "auto"; 1246 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1247 masterDesktopActionsMenuContainer.SortId = 20; 1248 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1249 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1250 break; 1251 case "minimal-right": //5 1252 masterDesktopLogo.SortId = 10; 1253 masterDesktopLogo.Design.Size = "auto-width"; 1254 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1255 masterDesktopMenu.SortId = 10; 1256 masterDesktopMenu.Design.Size = "auto"; 1257 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1258 masterDesktopActionsMenuContainer.SortId = 20; 1259 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1260 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1261 break; 1262 case "two-lines": //6 1263 masterDesktopLogo.SortId = 10; 1264 masterDesktopLogo.Design.Size = "auto"; 1265 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1266 masterDesktopMenu.SortId = 10; 1267 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1268 masterDesktopActionsMenuContainer.SortId = 20; 1269 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1270 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1271 break; 1272 case "two-lines-centered": //7 1273 masterDesktopLogo.SortId = 10; 1274 masterDesktopLogo.Design.Size = "auto"; 1275 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1276 masterDesktopMenu.SortId = 10; 1277 masterDesktopMenu.Design.Size = "auto"; 1278 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1279 masterDesktopActionsMenuContainer.SortId = 20; 1280 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1281 break; 1282 case "splitted": //3 1283 masterDesktopLogo.SortId = 10; 1284 masterDesktopLogo.Design.Size = "auto"; 1285 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1286 if (!navigationActionHideSearch) 1287 { 1288 searchBar.SortId = 20; 1289 searchBar.Design.Size = "auto"; 1290 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1291 } 1292 masterDesktopMenu.SortId = 10; 1293 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1294 masterDesktopActionsMenuContainer.SortId = 20; 1295 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1296 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1297 break; 1298 case "normal": //1 1299 default: 1300 masterDesktopLogo.SortId = 10; 1301 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1302 if (!navigationActionHideSearch) 1303 { 1304 searchBar.SortId = 20; 1305 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1306 } 1307 masterDesktopActionsMenuContainer.SortId = 30; 1308 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopActionsMenuContainer); 1309 masterDesktopMenu.SortId = 10; 1310 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1311 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1312 break; 1313 } 1314 1315 headerBlocksPage.Add("MasterDesktopActionsMenuContainer", masterDesktopActionsMenu); 1316 } 1317 1318 @helper RenderDesktopTools() 1319 { 1320 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 1321 1322 <div class="tools-navigation dw-mod"> 1323 <div class="center-container grid top-container__center-container dw-mod"> 1324 @RenderBlockList(subBlocks) 1325 </div> 1326 </div> 1327 } 1328 1329 @helper RenderDesktopToolsText() 1330 { 1331 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 1332 1333 <div class="u-margin-top">@toolsText</div> 1334 } 1335 1336 @helper RenderDesktopToolsNavigation() 1337 { 1338 <div> 1339 @RenderNavigation(new 1340 { 1341 id = "topToolsNavigation", 1342 cssclass = "menu menu-tools dw-mod dwnavigation", 1343 template = "TopMenu.xslt" 1344 }) 1345 </div> 1346 } 1347 1348 @helper RenderDesktopNavigation() 1349 { 1350 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 1351 1352 <nav class="main-navigation dw-mod"> 1353 <div class="center-container top-container__center-container grid grid--align-center dw-mod"> 1354 @RenderBlockList(subBlocks) 1355 </div> 1356 </nav> 1357 } 1358 1359 @helper RenderDesktopExtra() 1360 { 1361 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 1362 1363 if (subBlocks.Count > 0) 1364 { 1365 <div class="header header-top dw-mod"> 1366 <div class="center-container top-container__center-container grid grid--align-center grid--justify-space-between dw-mod"> 1367 @RenderBlockList(subBlocks) 1368 </div> 1369 </div> 1370 } 1371 } 1372 1373 @helper RenderDesktopLogo() 1374 { 1375 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 1376 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1377 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 1378 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 1379 string logoHeight = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetString("LogoHeight")) ? Model.Area.Item.GetItem("Layout").GetString("LogoHeight") : "40"; 1380 logoHeight = logoHeight != "0" ? logoHeight : "40"; 1381 if (Path.GetExtension(logo).ToLower() != ".svg") 1382 { 1383 logo = "/Admin/Public/GetImage.ashx?height=" + logoHeight + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 1384 1385 if (Pageview.Device.ToString() == "Mobile") 1386 { 1387 logoHeight = "40"; 1388 } 1389 } 1390 else 1391 { 1392 logo = HttpUtility.UrlDecode(logo); 1393 } 1394 1395 <div class="logo @alignClass dw-mod"> 1396 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 1397 <img class="grid__cell-img logo__img dw-mod" src="@logo" /> 1398 </a> 1399 </div> 1400 } 1401 1402 @helper RenderDesktopMenu() 1403 { 1404 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1405 string menuAlignment = topLayout == "two-lines-centered" || topLayout == "minimal-right" ? "u-pull--right" : ""; 1406 1407 bool megaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue.ToLower() == "true" ? true : false; 1408 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 1409 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 1410 int startLevel = renderPagesInToolBar ? 1 : 0; 1411 1412 <div class="grid__cell"> 1413 <div class="@menuAlignment"> 1414 @if (!megaMenu) 1415 { 1416 @RenderNavigation(new 1417 { 1418 id = "topnavigation", 1419 cssclass = "menu dw-mod dwnavigation u-full-max-width", 1420 startLevel = @startLevel, 1421 ecomStartLevel = @startLevel + 1, 1422 endlevel = 5, 1423 expandmode = "all", 1424 template = "BaseMenuWithDropdown.xslt" 1425 }); 1426 } 1427 else 1428 { 1429 @RenderNavigation(new 1430 { 1431 id = "topnavigation", 1432 cssclass = "menu dw-mod dwnavigation u-full-max-width", 1433 startLevel = @startLevel, 1434 ecomStartLevel = @startLevel + 1, 1435 endlevel = 5, 1436 promotionImage = megamenuPromotionImage, 1437 promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"), 1438 expandmode = "all", 1439 template = "BaseMegaMenu.xslt" 1440 }); 1441 } 1442 </div> 1443 </div> 1444 } 1445 1446 @helper RenderDesktopActionsMenu() 1447 { 1448 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 1449 1450 <ul class="menu dw-mod"> 1451 @RenderBlockList(subBlocks) 1452 </ul> 1453 } 1454 1455 @helper RenderLanguageSelector() 1456 { 1457 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1458 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod u-hidden-xxs" : "menu__item menu__item--horizontal menu--clean dw-mod"; 1459 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1460 string languageViewType = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue) ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue.ToLower() : ""; 1461 1462 if (Model.Languages.Count > 1) 1463 { 1464 <li class="@liClasses is-dropdown is-dropdown--no-icon"> 1465 <div class="@menuLinkClass menu__link--icon dw-mod"> 1466 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 1467 </div> 1468 <div class="menu menu--dropdown dw-mod"> 1469 @foreach (var lang in Model.Languages) 1470 { 1471 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 1472 1473 if (languageViewType == "flag") 1474 { 1475 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + "\"></span>"; 1476 } 1477 1478 if (languageViewType == "name") 1479 { 1480 langInfo = lang.Name; 1481 } 1482 1483 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__item menu-dropdown__item--link dw-mod">@langInfo</a> 1484 } 1485 </div> 1486 </li> 1487 } 1488 } 1489 1490 @helper RenderMiniCart() 1491 { 1492 bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 1493 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 1494 int cartPageId = GetPageIdByNavigationTag("CartPage"); 1495 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 1496 1497 if (!onlyPreview && !navigationItemsHideCart) 1498 { 1499 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1500 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod" : "menu__item menu__item--horizontal menu--clean dw-mod"; 1501 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1502 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 1503 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue; 1504 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 1505 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 1506 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 1507 1508 if (showPrice && counterPosition == "right") 1509 { 1510 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 1511 } 1512 1513 1514 <li class="@liClasses" id="miniCartWrapper" onmouseenter="Cart.UpdateMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 1515 <div class="mini-cart dw-mod"> 1516 <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="@menuLinkClass menu__link--icon dw-mod js-mini-cart-button"> 1517 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 1518 <div class="mini-cart__counter dw-mod"> 1519 <div class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=Counter" data-init-onload="false" data-preloader="false"> 1520 <div class="js-mini-cart-counter-content"> 1521 @cartProductsCount 1522 @cartProductsTotalPrice 1523 </div> 1524 </div> 1525 </div> 1526 </a> 1527 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 1528 { 1529 <div class="mini-cart-dropdown js-handlebars-root js-mini-cart dw-mod" id="miniCart" data-template="MiniCartContent" data-cart-id="@miniCartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 1530 } 1531 </div> 1532 </li> 1533 } 1534 } 1535 1536 @helper RenderSignIn() 1537 { 1538 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 1539 string userInitials = ""; 1540 int pageId = Model.TopPage.ID; 1541 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 1542 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 1543 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 1544 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 1545 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 1546 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 1547 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 1548 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 1549 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 1550 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 1551 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 1552 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 1553 1554 string linkStart = "/Default.aspx?ID="; 1555 if (Model.CurrentUser.ID <= 0) 1556 { 1557 linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; 1558 } 1559 1560 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 1561 string myProfilePageLink = linkStart + myProfilePageId; 1562 string myOrdersPageLink = linkStart + myOrdersPageId; 1563 string myFavoritesPageLink = linkStart + myFavoritesPageId; 1564 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 1565 1566 if (Model.CurrentUser.ID != 0) 1567 { 1568 if (!String.IsNullOrEmpty(Model.CurrentUser.Name)) 1569 { 1570 string[] names = Model.CurrentUser.Name.Split(' '); 1571 userInitials += Model.CurrentUser.Name.Substring(0, 1); 1572 1573 if (names.Length > 1) 1574 { 1575 userInitials += names[names.Length - 1].Substring(0, 1); 1576 } 1577 } 1578 else 1579 { 1580 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : ""; 1581 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : ""; 1582 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : ""; 1583 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : ""; 1584 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : ""; 1585 } 1586 } 1587 1588 if (!navigationItemsHideSignIn) 1589 { 1590 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1591 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod u-hidden-xxs" : "menu__item menu__item--horizontal menu__item--clean dw-mod"; 1592 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1593 1594 <li class="@liClasses is-dropdown is-dropdown--no-icon"> 1595 <div class="@menuLinkClass menu__link--icon dw-mod"> 1596 @if (Model.CurrentUser.ID <= 0) 1597 { 1598 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i> 1599 } 1600 else 1601 { 1602 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 1603 } 1604 </div> 1605 <div class="menu menu--dropdown sign-in-dropdown dw-mod"> 1606 <ul class="list list--clean dw-mod"> 1607 @if (Model.CurrentUser.ID <= 0) 1608 { 1609 <li> 1610 <label for="SignInModalTrigger" class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)">@Translate("Sign in")</label> 1611 </li> 1612 if (!hideCreateAccountLink) 1613 { 1614 <li> 1615 <a href="/default.aspx?ID=@createAccountPageId" class="list__link dw-mod">@Translate("Create account")</a> 1616 </li> 1617 } 1618 <li> 1619 <a href="@forgotPasswordPageLink" class="list__link dw-mod">@Translate("Forgot your password?")</a> 1620 </li> 1621 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 1622 { 1623 <li class="list__seperator dw-mod"></li> 1624 } 1625 } 1626 @if (!hideMyProfileLink) 1627 { 1628 <li> 1629 <a href="@myProfilePageLink" class="list__link dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue u-margin-right"></i>@Translate("My Profile")</a> 1630 </li> 1631 } 1632 @if (!hideMyOrdersLink) 1633 { 1634 <li> 1635 <a href="@myOrdersPageLink" class="list__link dw-mod"><i class="fas fa-list u-margin-right"></i>@Translate("My Orders")</a> 1636 </li> 1637 } 1638 @if (!hideMyFavoritesLink) 1639 { 1640 <li> 1641 <a href="@myFavoritesPageLink" class="list__link dw-mod"><i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue u-margin-right"></i>@Translate("My Favorites")</a> 1642 </li> 1643 } 1644 @if (!hideMySavedCardsLink) 1645 { 1646 <li> 1647 <a href="@mySavedCardsPageLink" class="list__link dw-mod"><i class="fas fa-credit-card u-margin-right"></i>@Translate("My Saved cards")</a> 1648 </li> 1649 } 1650 @if (Model.CurrentUser.ID > 0) 1651 { 1652 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 1653 { 1654 <li class="list__seperator dw-mod"></li> 1655 } 1656 <li> 1657 <a href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId" class="list__link dw-mod">@Translate("Sign out")</a> 1658 </li> 1659 } 1660 </ul> 1661 </div> 1662 </li> 1663 } 1664 } 1665 1666 @helper RenderFavorites() 1667 { 1668 bool navigationItemsHideFavorites = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 1669 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 1670 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 1671 1672 string linkStart = "/Default.aspx?ID="; 1673 if (Model.CurrentUser.ID <= 0) 1674 { 1675 linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; 1676 } 1677 1678 string myFavoritesPageLink = linkStart + myFavoritesPageId; 1679 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1680 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod u-hidden-xxs" : "menu__item menu__item--horizontal menu--clean dw-mod"; 1681 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1682 1683 <li class="@liClasses"> 1684 <a href="@myFavoritesPageLink" class="@menuLinkClass menu__link--icon dw-mod"> 1685 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 1686 </a> 1687 </li> 1688 } 1689 1690 @helper RenderHeaderButton() 1691 { 1692 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 1693 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 1694 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 1695 1696 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 1697 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 1698 </li> 1699 } 1700 1701 @helper RenderSearchBar(string alignment = "left") 1702 { 1703 string searchFeedId = ""; 1704 string searchSecondFeedId = ""; 1705 int groupsFeedId; 1706 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 1707 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 1708 string resultPageLink; 1709 string searchPlaceholder; 1710 string searchType = "product-search"; 1711 string searchTemplate; 1712 string searchContentTemplate = ""; 1713 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 1714 bool showGroups = true; 1715 1716 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 1717 { 1718 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1719 resultPageLink = contentSearchPageLink; 1720 searchPlaceholder = Translate("Search page"); 1721 groupsFeedId = 0; 1722 searchType = "content-search"; 1723 searchTemplate = "SearchPagesTemplate"; 1724 showGroups = false; 1725 } 1726 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 1727 { 1728 searchFeedId = productsPageId + "&feed=true"; 1729 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1730 resultPageLink = Converter.ToString(productsPageId); 1731 searchPlaceholder = Translate("Search products or pages"); 1732 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1733 searchType = "combined-search"; 1734 searchTemplate = "SearchProductsTemplateWrap"; 1735 searchContentTemplate = "SearchPagesTemplateWrap"; 1736 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1737 } 1738 else 1739 { 1740 resultPageLink = Converter.ToString(productsPageId); 1741 searchFeedId = productsPageId + "&feed=true"; 1742 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1743 searchPlaceholder = Translate("Search products"); 1744 searchTemplate = "SearchProductsTemplate"; 1745 searchType = "product-search"; 1746 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1747 } 1748 1749 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" data-page-size="7" id="ProductSearchBar" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-groups-page-id="@groupsFeedId" data-search-type="@searchType"> 1750 @if (showGroups) 1751 { 1752 <button type="button" class="btn btn--condensed u-color-light-gray--bg typeahead-group-btn dw-mod js-typeahead-groups-btn" data-group-id="all">@Translate("All")</button> 1753 <ul class="dropdown dropdown--absolute-position u-min-w220px js-handlebars-root js-typeahead-groups-content dw-mod" id="ProductSearchBarGroupsContent" data-template="SearchGroupsTemplate" data-json-feed="/Default.aspx?ID=@groupsFeedId&feedType=productGroups" data-init-onload="false" data-preloader="minimal"></ul> 1754 } 1755 <div class="typeahead-search-field"> 1756 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@searchPlaceholder" value="@searchValue"> 1757 @if (string.IsNullOrEmpty(searchSecondFeedId)) 1758 { 1759 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 1760 } 1761 else 1762 { 1763 <div class="dropdown dropdown--absolute-position dropdown--combined grid @(alignment == "right" ? "dropdown--right-aligned" : "")"> 1764 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></div> 1765 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@searchContentTemplate" data-json-feed="/Default.aspx?ID=@searchSecondFeedId" data-init-onload="false"></div> 1766 </div> 1767 } 1768 </div> 1769 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> 1770 </div> 1771 } 1772 1773 @helper RenderMiniSearch() 1774 { 1775 string searchFeedId = ""; 1776 string searchSecondFeedId = ""; 1777 int groupsFeedId; 1778 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 1779 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 1780 string resultPageLink; 1781 string searchPlaceholder; 1782 string searchType = "product-search"; 1783 string searchTemplate; 1784 string searchContentTemplate = ""; 1785 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 1786 bool showGroups = true; 1787 1788 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 1789 { 1790 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1791 resultPageLink = contentSearchPageLink; 1792 searchPlaceholder = Translate("Search page"); 1793 groupsFeedId = 0; 1794 searchType = "content-search"; 1795 searchTemplate = "SearchPagesTemplate"; 1796 showGroups = false; 1797 } 1798 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 1799 { 1800 searchFeedId = productsPageId + "&feed=true"; 1801 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1802 resultPageLink = Converter.ToString(productsPageId); 1803 searchPlaceholder = Translate("Search products or pages"); 1804 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1805 searchType = "combined-search"; 1806 searchTemplate = "SearchProductsTemplateWrap"; 1807 searchContentTemplate = "SearchPagesTemplateWrap"; 1808 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1809 } 1810 else 1811 { 1812 resultPageLink = Converter.ToString(productsPageId); 1813 searchFeedId = productsPageId + "&feed=true"; 1814 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1815 searchPlaceholder = Translate("Search products"); 1816 searchTemplate = "SearchProductsTemplate"; 1817 searchType = "product-search"; 1818 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1819 } 1820 1821 <li class="menu__item menu__item--horizontal menu__item--top-level u-hidden-xxs is-dropdown is-dropdown--no-icon dw-mod" onmouseover="document.getElementById('headerSearch').focus()"> 1822 <div class="menu__link menu__link--icon dw-mod"> 1823 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 1824 </div> 1825 <div class="menu menu--dropdown u-w380px top-micro-search dw-mod"> 1826 <div class="typeahead js-typeahead" data-page-size="7" id="ProductSearchBar" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-search-type="@searchType"> 1827 <div class="typeahead-search-field"> 1828 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@searchPlaceholder" value="@searchValue"> 1829 @if (string.IsNullOrEmpty(searchSecondFeedId)) 1830 { 1831 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 1832 } 1833 else 1834 { 1835 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 1836 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></div> 1837 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@searchContentTemplate" data-json-feed="/Default.aspx?ID=@searchSecondFeedId" data-init-onload="false"></div> 1838 </div> 1839 } 1840 </div> 1841 </div> 1842 </div> 1843 </li> 1844 } 1845 1846 @helper RenderImpersonationBar() 1847 { 1848 int impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 1849 1850 <div class="u-color-warning--bg"> 1851 <div class="center-container top-container__center-container dw-mod"> 1852 @*Impersonation*@ 1853 <div class="grid"> 1854 <div class="grid--align-self-center grid__col-x"> 1855 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 1856 { 1857 string stopImpersonateTranslation = Translate("Stop impersonation"); 1858 string username = ""; 1859 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName)) 1860 { 1861 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName; 1862 } 1863 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name)) 1864 { 1865 username = Model.CurrentSecondaryUser.Name; 1866 } 1867 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email)) 1868 { 1869 username = Model.CurrentSecondaryUser.Email; 1870 } 1871 else 1872 { 1873 username = Model.CurrentSecondaryUser.UserName; 1874 } 1875 <div class="grid-cell"> 1876 <div class="u-pull--left u-bold u-margin-top"> 1877 <i class="fas fa-user-secret"></i> 1878 @Pageview.User.UserName<text>&nbsp;</text>@Translate("is impersonating")<text>&nbsp;</text>@username 1879 </div> 1880 <form method="post" class="u-pull--right u-no-margin"> 1881 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation"> 1882 </form> 1883 </div> 1884 } 1885 else 1886 { 1887 string viewListTranslation = Translate("View the list of users you can impersonate"); 1888 <div class="grid-cell u-bold"> 1889 <i class="fas fa-user-secret"></i> 1890 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a> 1891 </div> 1892 } 1893 </div> 1894 </div> 1895 </div> 1896 </div> 1897 } 1898 1899 </text> 1900 } 1901 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 1902 1903 @using System 1904 @using System.Web 1905 @using System.Collections.Generic 1906 @using Dynamicweb.Rapido.Blocks.Extensibility 1907 @using Dynamicweb.Rapido.Blocks 1908 1909 @functions { 1910 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 1911 } 1912 1913 @{ 1914 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content") : ""; 1915 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content") : ""; 1916 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content") : ""; 1917 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header") : ""; 1918 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header") : ""; 1919 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header") : ""; 1920 1921 Block masterFooterContent = new Block() 1922 { 1923 Id = "MasterFooterContent", 1924 SortId = 10, 1925 Template = RenderFooter(), 1926 SkipRenderBlocksList = true 1927 }; 1928 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 1929 1930 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 1931 { 1932 Block masterFooterColumnOne = new Block 1933 { 1934 Id = "MasterFooterColumnOne", 1935 SortId = 10, 1936 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 1937 Design = new Design { 1938 Size = "auto", 1939 RenderType = RenderType.Column 1940 } 1941 }; 1942 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 1943 } 1944 1945 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 1946 { 1947 Block masterFooterColumnTwo = new Block 1948 { 1949 Id = "MasterFooterColumnTwo", 1950 SortId = 20, 1951 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 1952 Design = new Design 1953 { 1954 Size = "auto", 1955 RenderType = RenderType.Column 1956 } 1957 }; 1958 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 1959 } 1960 1961 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 1962 { 1963 Block masterFooterColumnThree = new Block 1964 { 1965 Id = "MasterFooterColumnThree", 1966 SortId = 30, 1967 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 1968 Design = new Design 1969 { 1970 Size = "auto", 1971 RenderType = RenderType.Column 1972 } 1973 }; 1974 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 1975 } 1976 1977 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 1978 { 1979 Block masterFooterNewsletterSignUp = new Block 1980 { 1981 Id = "MasterFooterNewsletterSignUp", 1982 SortId = 40, 1983 Template = RenderFooterNewsletterSignUp(), 1984 Design = new Design 1985 { 1986 Size = "auto", 1987 RenderType = RenderType.Column 1988 } 1989 }; 1990 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 1991 } 1992 1993 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 1994 { 1995 Block masterFooterSocialLinks = new Block 1996 { 1997 Id = "MasterFooterSocialLinks", 1998 SortId = 50, 1999 Template = RenderFooterSocialLinks(), 2000 Design = new Design 2001 { 2002 Size = "auto", 2003 RenderType = RenderType.Column 2004 } 2005 }; 2006 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 2007 } 2008 2009 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 2010 { 2011 Block masterFooterPayments = new Block 2012 { 2013 Id = "MasterFooterPayments", 2014 SortId = 60, 2015 Template = RenderFooterPayments(), 2016 Design = new Design 2017 { 2018 Size = "12", 2019 RenderType = RenderType.Column 2020 } 2021 }; 2022 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 2023 } 2024 2025 Block masterFooterCopyright = new Block 2026 { 2027 Id = "MasterFooterCopyright", 2028 SortId = 70, 2029 Template = RenderFooterCopyright(), 2030 Design = new Design 2031 { 2032 Size = "12", 2033 RenderType = RenderType.Column 2034 } 2035 }; 2036 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 2037 } 2038 2039 @helper RenderFooter() { 2040 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 2041 2042 <footer class="footer dw-mod"> 2043 <div class="center-container top-container__center-container dw-mod"> 2044 <div class="grid grid--external-bleed-x"> 2045 @RenderBlockList(subBlocks) 2046 </div> 2047 </div> 2048 </footer> 2049 } 2050 2051 @helper RenderFooterColumn(string header, string content) { 2052 <h3 class="footer__heading dw-mod">@header</h3> 2053 <div class="footer__content dw-mod"> 2054 @content 2055 </div> 2056 } 2057 2058 @helper RenderFooterNewsletterSignUp() { 2059 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 2060 2061 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 2062 <div class="footer__content dw-mod"> 2063 <p>@Translate("Sign up if you would like to receive occasional treats from us", "Sign up if you would like to receive occasional treats from us").</p> 2064 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> 2065 <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> 2066 <div class="form__field-combi"> 2067 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' /> 2068 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' /> 2069 </div> 2070 </form> 2071 </div> 2072 } 2073 2074 @helper RenderFooterSocialLinks() { 2075 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 2076 <div class="footer__content dw-mod"> 2077 <div class="collection dw-mod"> 2078 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 2079 { 2080 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 2081 string socialIconClass = socialIcon.SelectedValue; 2082 string socialIconTitle = socialIcon.SelectedName; 2083 string socialLink = socialitem.GetString("Link"); 2084 2085 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px"><i class="@socialIconClass fa-2x"></i></a> 2086 } 2087 </div> 2088 </div> 2089 } 2090 2091 @helper RenderFooterPayments() { 2092 <div class="footer__content dw-mod"> 2093 <div class="collection dw-mod"> 2094 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 2095 { 2096 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 2097 string paymentImage = null; 2098 string paymentTitle = paymentItem.SelectedName; 2099 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 2100 if (selected != null) 2101 { 2102 paymentImage = selected.Icon; 2103 } 2104 2105 <div class="footer__card-type"> 2106 <img src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> 2107 </div> 2108 } 2109 </div> 2110 </div> 2111 } 2112 2113 @helper RenderFooterCopyright() { 2114 <div class="grid__col-12 footer__copyright dw-mod"> 2115 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 2116 </div> 2117 } 2118 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2119 2120 @using System 2121 @using System.Web 2122 @using System.Collections.Generic 2123 @using Dynamicweb.Rapido.Blocks.Extensibility 2124 @using Dynamicweb.Rapido.Blocks 2125 2126 @{ 2127 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 2128 bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 2129 2130 if (!navigationItemsHideCart) 2131 { 2132 Block miniCartScriptTemplates = new Block() 2133 { 2134 Id = "MasterMiniCartTemplates", 2135 SortId = 1, 2136 Template = RenderMiniCartScriptTemplates(), 2137 SkipRenderBlocksList = true, 2138 BlocksList = new List<Block> 2139 { 2140 new Block { 2141 Id = "MiniCartHeader", 2142 SortId = 10, 2143 Template = RenderMiniCartHeader() 2144 }, 2145 new Block { 2146 Id = "MiniCartOrderLines", 2147 SortId = 20, 2148 Template = RenderMiniCartOrderLines() 2149 }, 2150 new Block { 2151 Id = "MiniCartFees", 2152 SortId = 30, 2153 Template = RenderMiniCartFees() 2154 }, 2155 new Block { 2156 Id = "MiniCartPoints", 2157 SortId = 40, 2158 Template = RenderMiniCartPoints() 2159 }, 2160 new Block { 2161 Id = "MiniCartTotal", 2162 SortId = 50 , 2163 Template = RenderMiniCartTotal() 2164 } 2165 } 2166 }; 2167 2168 miniCartBlocksPage.Add(MasterBlockId.MasterBottomSnippets, miniCartScriptTemplates); 2169 } 2170 } 2171 2172 @helper RenderMiniCartScriptTemplates() 2173 { 2174 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 2175 2176 int cartPageId = GetPageIdByNavigationTag("CartPage"); 2177 bool showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 2178 showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue == "right" ? showPriceInMiniCartCounter : false; 2179 showPriceInMiniCartCounter = Pageview.Device.ToString() == "Mobile" ? false : showPriceInMiniCartCounter; 2180 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2181 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2182 string addingToCartNotification = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 2183 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 2184 2185 2186 <script id="MiniCartCounterContent" type="text/x-template"> 2187 {{#.}} 2188 <div class="js-mini-cart-counter-content dw-mod"> 2189 @if (showPriceInMiniCartCounter) { 2190 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 2191 } else { 2192 <text>{{numberofproducts}}</text> 2193 } 2194 </div> 2195 {{/.}} 2196 </script> 2197 2198 <script id="MiniCartContent" type="text/x-template"> 2199 {{#.}} 2200 @if (useGoogleTagManager) 2201 { 2202 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 2203 } 2204 <div class="mini-cart-dropdown__inner {{isempty}} dw-mod"> 2205 <h4 class="u-ta-center u-no-margin u-margin-bottom u-margin-top">@Translate("Shopping cart")</h4> 2206 <div class="mini-cart-dropdown__body dw-mod"> 2207 <table class="table mini-cart-table dw-mod"> 2208 @RenderBlockList(subBlocks) 2209 </table> 2210 </div> 2211 2212 <table class="table mini-cart-table dw-mod"> 2213 <tr class="mini-cart-orderlines__footer dw-mod"> 2214 <td colspan="2"><button type="button" class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button></td> 2215 <td colspan="2" class="u-ta-right"><a href="/Default.aspx?ID=@cartPageId" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a></td> 2216 </tr> 2217 </table> 2218 </div> 2219 {{/.}} 2220 </script> 2221 2222 <script id="MiniCartOrderline" type="text/x-template"> 2223 <tr class="{{isempty}}"> 2224 <td><a href="{{link}}" class="{{hideimage}}"><img src="/Admin/Public/GetImage.ashx?width=50&height=50&crop=5&Compression=75&image={{image}}" alt="{{name}}"></a></td> 2225 <td> 2226 <a href="{{link}}" class="mini-cart-orderlines__name" title="{{name}}">{{name}}</a> 2227 {{#if variantname}} 2228 <a href="{{link}}" class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{variantname}}</a> 2229 {{/if}} 2230 {{#if unitname}} 2231 <div class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{unitname}}</div> 2232 {{/if}} 2233 </td> 2234 <td class="u-ta-right">{{quantity}}</td> 2235 <td class="u-ta-right"> 2236 {{#if pointsTotal}} 2237 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 2238 {{else}} 2239 {{totalprice}} 2240 {{/if}} 2241 </td> 2242 </tr> 2243 </script> 2244 2245 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 2246 <tr class="table__row--no-border {{isempty}}"> 2247 <td>&nbsp;</td> 2248 <td><div class="mini-cart-orderlines__name dw-mod">{{name}}</div></td> 2249 <td class="u-ta-right">&nbsp;</td> 2250 <td class="u-ta-right">{{totalprice}}</td> 2251 </tr> 2252 </script> 2253 2254 if (!onlyPreview && addingToCartNotification == "modal") 2255 { 2256 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 2257 2258 <script id="LastAddedProductTemplate" type="text/x-template"> 2259 <!-- Trigger for the login modal --> 2260 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> 2261 2262 <!-- Login modal --> 2263 <div class="modal-container"> 2264 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> 2265 <div class="modal modal--md"> 2266 <div class="modal__header"> 2267 <h2>@Translate("Product is added to the cart")</h2> 2268 </div> 2269 <div class="modal__body"> 2270 <div class="grid"> 2271 <div class="grid__col-2"> 2272 <a href="{{productInfo.link}}"> 2273 <img src="{{productInfo.image}}" alt="{{productInfo.name}}" class="dw-mod" /> 2274 </a> 2275 </div> 2276 <div class="u-padding grid--align-self-center"> 2277 <span>{{quantity}}</span> x 2278 </div> 2279 <div class="grid__col-auto grid--align-self-center"> 2280 <div>{{productInfo.name}}</div> 2281 {{#if productInfo.variantName}} 2282 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 2283 {{/if}} 2284 {{#if productInfo.unitName}} 2285 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 2286 {{/if}} 2287 </div> 2288 </div> 2289 <div class="modal__footer u-margin-top--lg"> 2290 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> 2291 <a href="/cart" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a> 2292 </div> 2293 </div> 2294 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> 2295 </div> 2296 </div> 2297 </script> 2298 <script> 2299 document.addEventListener('addToCart', function (event) { 2300 Cart.ShowLastAddedProductModal(event.detail); 2301 }); 2302 </script> 2303 } 2304 else if (!onlyPreview && addingToCartNotification == "toggle") 2305 { 2306 <script> 2307 document.addEventListener('addToCart', function () { 2308 Cart.ToggleMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 2309 }); 2310 </script> 2311 } 2312 } 2313 2314 @helper RenderMiniCartHeader() { 2315 <thead> 2316 <tr> 2317 <td>&nbsp;</td> 2318 <td>@Translate("Product")</td> 2319 <td class="u-ta-right">@Translate("Qty")</td> 2320 <td class="u-ta-right" width="120">@Translate("Price")</td> 2321 </tr> 2322 </thead> 2323 } 2324 2325 @helper RenderMiniCartOrderLines() { 2326 <text> 2327 {{#OrderLines}} 2328 {{#ifCond template "===" "CartOrderline"}} 2329 {{>MiniCartOrderline}} 2330 {{/ifCond}} 2331 {{#ifCond template "===" "CartOrderlineMobile"}} 2332 {{>MiniCartOrderline}} 2333 {{/ifCond}} 2334 {{#ifCond template "===" "CartOrderlineDiscount"}} 2335 {{>MiniCartOrderlineDiscount}} 2336 {{/ifCond}} 2337 {{/OrderLines}} 2338 </text> 2339 } 2340 2341 @helper RenderMiniCartFees() { 2342 <tr> 2343 <td><i class="fas fa-credit-card"></i></td> 2344 <td>{{paymentmethod}}</td> 2345 <td colspan="2" class="u-ta-right" width="130">{{paymentfee}}</td> 2346 </tr> 2347 <tr> 2348 <td><i class="fas fa-truck"></i></td> 2349 <td>{{shippingmethod}}</td> 2350 <td colspan="2" class="u-ta-right" width="130">{{shippingfee}}</td> 2351 </tr> 2352 } 2353 2354 @helper RenderMiniCartPoints() { 2355 <text> 2356 {{#if earnings}} 2357 <tr> 2358 <td colspan="2">@Translate("Earnings")</td> 2359 <td colspan="2" class="u-ta-right" width="130"><span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")</td> 2360 </tr> 2361 {{/if}} 2362 </text> 2363 } 2364 2365 @helper RenderMiniCartTotal() { 2366 <tr class="mini-cart-totals dw-mod"> 2367 <td colspan="2">@Translate("Total")</td> 2368 <td class="u-ta-right">{{numberofproducts}}</td> 2369 <td class="u-ta-right" width="130">{{totalprice}}</td> 2370 </tr> 2371 } 2372 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2373 2374 @using System 2375 @using System.Web 2376 @using System.Collections.Generic 2377 @using Dynamicweb.Rapido.Blocks.Extensibility 2378 @using Dynamicweb.Rapido.Blocks 2379 @using Dynamicweb.Ecommerce.Common 2380 2381 @{ 2382 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 2383 2384 Block masterScriptReferences = new Block() 2385 { 2386 Id = "MasterScriptReferences", 2387 SortId = 1, 2388 Template = RenderMasterScriptReferences() 2389 }; 2390 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 2391 } 2392 2393 @helper RenderMasterScriptReferences() { 2394 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.11.js"></script> 2395 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 2396 2397 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 2398 { 2399 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 2400 } 2401 } 2402 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2403 2404 @using System 2405 @using System.Web 2406 @using System.Collections.Generic 2407 @using Dynamicweb.Rapido.Blocks.Extensibility 2408 @using Dynamicweb.Rapido.Blocks 2409 2410 @{ 2411 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 2412 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 2413 2414 if (!navigationItemsHideSearch) 2415 { 2416 Block masterSearchScriptTemplates = new Block() 2417 { 2418 Id = "MasterSearchScriptTemplates", 2419 SortId = 1, 2420 Template = RenderSearchScriptTemplates() 2421 }; 2422 2423 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 2424 } 2425 } 2426 2427 @helper RenderSearchScriptTemplates() 2428 { 2429 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 2430 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 2431 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 2432 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2433 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 2434 bool isDigitalWarehouse = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("EnableDigitalWarehouse"); 2435 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 2436 2437 <script id="SearchGroupsTemplate" type="text/x-template"> 2438 {{#.}} 2439 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 2440 {{/.}} 2441 </script> 2442 2443 <script id="SearchProductsTemplate" type="text/x-template"> 2444 {{#each .}} 2445 {{#Product}} 2446 {{#ifCond template "!==" "SearchMore"}} 2447 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2448 @if (useFacebookPixel) 2449 { 2450 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 2451 } 2452 @if (useGoogleTagManager) 2453 { 2454 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 2455 } 2456 <div> 2457 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 2458 <div class="u-margin-right u-pull--left {{noimage}} u-hidden-xs u-hidden-xxs"><img src="/Admin/Public/GetImage.ashx?width=45&height=36&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}"></div> 2459 <div class="u-pull--left"> 2460 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 2461 @if (!onlyPreview) 2462 { 2463 if (pointShopOnly) 2464 { 2465 <text> 2466 {{#if havePointPrice}} 2467 <div> 2468 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 2469 </div> 2470 {{else}} 2471 <small class="help-text u-no-margin">@Translate("Not available")</small> 2472 {{/if}} 2473 {{#unless canBePurchasedWithPoints}} 2474 {{#if havePointPrice}} 2475 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 2476 {{/if}} 2477 {{/unless}} 2478 </text> 2479 } 2480 else 2481 { 2482 <div>{{price}}</div> 2483 } 2484 } 2485 </div> 2486 </a> 2487 <div class="u-margin-left u-pull--right"> 2488 @if (!onlyPreview) 2489 { 2490 if (pointShopOnly) 2491 { 2492 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside {{#unless canBePurchasedWithPoints}}js-stay-disabled{{/unless}}" name="CartCmd" value="addWithPoints" 2493 onclick="Cart.AddToCart(event, { 2494 id: '{{productId}}', 2495 quantity: 1, 2496 buyForPoints: true, 2497 productInfo: {{productInfo}} 2498 }); {{facebookPixelAction}}" {{disabledBuyButton}}> 2499 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 2500 </button> 2501 } 2502 else 2503 { 2504 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 2505 onclick="Cart.AddToCart(event, { 2506 id: '{{productId}}', 2507 quantity: 1, 2508 productInfo: {{productInfo}} 2509 }); {{facebookPixelAction}}"> 2510 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 2511 </button> 2512 } 2513 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod {{hideViewMore}} js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 2514 } 2515 else if (isDigitalWarehouse) 2516 { 2517 <a class="btn btn--primary u-no-margin btn--condensed dw-mod" href="{{listLink}}"><i class="fas {{listIcon}}"></i></a> 2518 } 2519 else 2520 { 2521 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 2522 } 2523 </div> 2524 </div> 2525 </li> 2526 {{/ifCond}} 2527 {{#ifCond template "===" "SearchMore"}} 2528 {{>SearchMoreProducts}} 2529 {{/ifCond}} 2530 {{/Product}} 2531 {{else}} 2532 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2533 @Translate("Your search gave 0 results") 2534 </li> 2535 {{/each}} 2536 </script> 2537 2538 <script id="SearchMoreProducts" type="text/x-template"> 2539 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 2540 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 2541 @Translate("View all") 2542 </a> 2543 </li> 2544 </script> 2545 2546 <script id="SearchMorePages" type="text/x-template"> 2547 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 2548 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 2549 @Translate("View all") 2550 </a> 2551 </li> 2552 </script> 2553 2554 <script id="SearchPagesTemplate" type="text/x-template"> 2555 {{#each .}} 2556 {{#ifCond template "!==" "SearchMore"}} 2557 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2558 <div> 2559 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 2560 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 2561 <div class="u-pull--left"> 2562 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 2563 </div> 2564 </a> 2565 </div> 2566 </li> 2567 {{/ifCond}} 2568 {{#ifCond template "===" "SearchMore"}} 2569 {{>SearchMorePages}} 2570 {{/ifCond}} 2571 {{else}} 2572 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2573 @Translate("Your search gave 0 results") 2574 </li> 2575 {{/each}} 2576 </script> 2577 2578 <script id="SearchPagesTemplateWrap" type="text/x-template"> 2579 <div class="dropdown__column-header">@Translate("Pages")</div> 2580 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 2581 {{>SearchPagesTemplate}} 2582 </ul> 2583 </script> 2584 2585 <script id="SearchProductsTemplateWrap" type="text/x-template"> 2586 <div class="dropdown__column-header">@Translate("Products")</div> 2587 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 2588 {{>SearchProductsTemplate}} 2589 </ul> 2590 </script> 2591 } 2592 2593 2594 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2595 2596 @using System 2597 @using System.Web 2598 @using System.Collections.Generic 2599 @using Dynamicweb.Rapido.Blocks.Extensibility 2600 @using Dynamicweb.Rapido.Blocks 2601 2602 @{ 2603 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 2604 2605 Block primaryBottomSnippets = new Block() 2606 { 2607 Id = "MasterJavascriptInitializers", 2608 SortId = 100, 2609 Template = RenderPrimaryBottomSnippets() 2610 }; 2611 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 2612 } 2613 2614 @helper RenderPrimaryBottomSnippets() 2615 { 2616 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 2617 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2618 2619 if (isWireframeMode) 2620 { 2621 <script> 2622 Wireframe.Init(true); 2623 </script> 2624 } 2625 2626 2627 if (useGoogleTagManager) 2628 { 2629 <script> 2630 document.addEventListener('addToCart', function(event) { 2631 var googleImpression = event.detail.productInfo.googleImpression; 2632 dataLayer.push({ 2633 'event': 'addToCart', 2634 'ecommerce': { 2635 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code', 2636 'add': { 2637 'products': [{ 2638 'name': googleImpression.name, 2639 'id': googleImpression.id, 2640 'price': googleImpression.price, 2641 'brand': googleImpression.brand, 2642 'category': googleImpression.category, 2643 'variant': googleImpression.variant, 2644 'quantity': event.detail.quantity 2645 }] 2646 } 2647 } 2648 }); 2649 }); 2650 </script> 2651 } 2652 2653 <!--@Javascripts--> 2654 } 2655 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2656 2657 @using System 2658 @using System.Web 2659 @using System.Collections.Generic 2660 @using Dynamicweb.Rapido.Blocks 2661 @using Dynamicweb.Rapido.Blocks.Extensibility 2662 2663 @{ 2664 BlocksPage masterBlocksBlocksPage = BlocksPage.GetBlockPage("Master"); 2665 2666 var currentLanguage = "<!--@Global:Area.Lang-->"; 2667 2668 var bottomSnippetsBlock = masterBlocksBlocksPage.GetBlockById("MasterJavascriptInitializers"); 2669 if (bottomSnippetsBlock != null) 2670 { 2671 bottomSnippetsBlock.Template = RenderPrimaryBottomSnippetsCustom(currentLanguage); 2672 } 2673 2674 bool navigationItemsHideMiniCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 2675 bool navigationItemsHideSearchCustom = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 2676 if (!navigationItemsHideMiniCart) 2677 { 2678 Block customMiniCartScriptTemplates = new Block() 2679 { 2680 Id = "MasterMiniCartTemplates", 2681 SortId = 1, 2682 Template = CustomRenderMiniCartScriptTemplates(), 2683 SkipRenderBlocksList = true, 2684 BlocksList = new List<Block> 2685 { 2686 new Block { 2687 Id = "MiniCartHeader", 2688 SortId = 10, 2689 Template = RenderMiniCartHeader() 2690 }, 2691 new Block { 2692 Id = "MiniCartOrderLines", 2693 SortId = 20, 2694 Template = CustomRenderMiniCartOrderLines() 2695 }, 2696 new Block { 2697 Id = "MiniCartFees", 2698 SortId = 30, 2699 Template = RenderMiniCartFees() 2700 }, 2701 new Block { 2702 Id = "MiniCartPoints", 2703 SortId = 40, 2704 Template = RenderMiniCartPoints() 2705 }, 2706 new Block { 2707 Id = "MiniCartTotal", 2708 SortId = 50 , 2709 Template = CustomRenderMiniCartTotal() 2710 } 2711 } 2712 }; 2713 2714 masterBlocksBlocksPage.ReplaceBlock(customMiniCartScriptTemplates); 2715 } 2716 if (!navigationItemsHideSearchCustom) 2717 { 2718 Block customMasterSearchScriptTemplates = new Block() 2719 { 2720 Id = "MasterSearchScriptTemplates", 2721 SortId = 1, 2722 Template = CustomRenderSearchScriptTemplates() 2723 }; 2724 2725 masterBlocksBlocksPage.ReplaceBlock(customMasterSearchScriptTemplates); 2726 } 2727 } 2728 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2729 2730 @using System 2731 @using System.Web 2732 @using System.Collections.Generic 2733 @using Dynamicweb.Rapido.Blocks.Extensibility 2734 @using Dynamicweb.Rapido.Blocks 2735 2736 @{ 2737 } 2738 2739 @helper CustomRenderMiniCartScriptTemplates() 2740 { 2741 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 2742 2743 int cartPageId = GetPageIdByNavigationTag("CartPage"); 2744 bool showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 2745 showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue == "right" ? showPriceInMiniCartCounter : false; 2746 showPriceInMiniCartCounter = Pageview.Device.ToString() == "Mobile" ? false : showPriceInMiniCartCounter; 2747 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2748 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2749 string addingToCartNotification = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 2750 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 2751 2752 2753 <script id="MiniCartCounterContent" type="text/x-template"> 2754 {{#.}} 2755 <div class="js-mini-cart-counter-content dw-mod"> 2756 @if (showPriceInMiniCartCounter) 2757 { 2758 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 2759 } 2760 else 2761 { 2762 <text>{{numberofproducts}}</text> 2763 } 2764 </div> 2765 {{/.}} 2766 </script> 2767 2768 <script id="MiniCartContent" type="text/x-template"> 2769 {{#.}} 2770 @if (useGoogleTagManager) 2771 { 2772 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 2773 } 2774 <div class="mini-cart-dropdown__inner {{isempty}} dw-mod"> 2775 <h4 class="u-ta-center u-no-margin u-margin-bottom u-margin-top">@Translate("Shopping cart")</h4> 2776 <div class="mini-cart-dropdown__body dw-mod"> 2777 <table class="table mini-cart-table dw-mod"> 2778 @RenderBlockList(subBlocks) 2779 </table> 2780 </div> 2781 2782 <table class="table mini-cart-table dw-mod"> 2783 <tr class="mini-cart-orderlines__footer dw-mod"> 2784 <td colspan="2"><button type="button" class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button></td> 2785 <td colspan="2" class="u-ta-right"><a href="/Default.aspx?ID=@cartPageId" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a></td> 2786 </tr> 2787 </table> 2788 </div> 2789 {{/.}} 2790 </script> 2791 2792 <script id="MiniCartOrderline" type="text/x-template"> 2793 <tr class="{{isempty}}"> 2794 <td><a href="{{link}}" class="{{hideimage}}"><img src="/Admin/Public/GetImage.ashx?width=50&height=50&crop=5&Compression=75&image={{image}}" alt="{{name}}"></a></td> 2795 <td> 2796 <a href="{{link}}" class="mini-cart-orderlines__name" title="{{name}}">{{name}}</a> 2797 {{#if variantname}} 2798 <a href="{{link}}" class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{variantname}}</a> 2799 {{/if}} 2800 {{#if unitname}} 2801 <div class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{unitname}}</div> 2802 {{/if}} 2803 </td> 2804 <td class="u-ta-right">{{quantity}}</td> 2805 <td class="u-ta-right"> 2806 {{#if pointsTotal}} 2807 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 2808 {{else}} 2809 {{totalprice}} 2810 {{/if}} 2811 </td> 2812 </tr> 2813 {{#if hasDepositInfo}} 2814 {{>MiniCartDepositInfo}} 2815 {{/if}} 2816 </script> 2817 2818 <script id="MiniCartDepositInfo" type="text/x-template"> 2819 {{#DepositInfo}} 2820 <tr class="deposit-info"> 2821 <td></td> 2822 <td> 2823 {{name}} 2824 2825 </td> 2826 <td class="u-ta-right">{{quantity}}</td> 2827 <td class="u-ta-right"> 2828 {{price}} 2829 </td> 2830 </tr> 2831 {{/DepositInfo}} 2832 </script> 2833 2834 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 2835 <tr class="table__row--no-border {{isempty}}"> 2836 <td>&nbsp;</td> 2837 <td><div class="mini-cart-orderlines__name dw-mod">{{name}}</div></td> 2838 <td class="u-ta-right">&nbsp;</td> 2839 <td class="u-ta-right">{{totalprice}}</td> 2840 </tr> 2841 </script> 2842 2843 if (!onlyPreview && addingToCartNotification == "modal") 2844 { 2845 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 2846 2847 <script id="LastAddedProductTemplate" type="text/x-template"> 2848 <!-- Trigger for the login modal --> 2849 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> 2850 2851 <!-- Login modal --> 2852 <div class="modal-container"> 2853 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> 2854 <div class="modal modal--md"> 2855 <div class="modal__header"> 2856 <h2>@Translate("Product is added to the cart")</h2> 2857 </div> 2858 <div class="modal__body"> 2859 <div class="grid"> 2860 <div class="grid__col-2"> 2861 <a href="{{productInfo.link}}"> 2862 <img src="{{productInfo.image}}" alt="{{productInfo.name}}" class="dw-mod" /> 2863 </a> 2864 </div> 2865 <div class="u-padding grid--align-self-center"> 2866 <span>{{quantity}}</span> x 2867 </div> 2868 <div class="grid__col-auto grid--align-self-center"> 2869 <div>{{productInfo.name}}</div> 2870 {{#if productInfo.variantName}} 2871 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 2872 {{/if}} 2873 {{#if productInfo.unitName}} 2874 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 2875 {{/if}} 2876 </div> 2877 </div> 2878 <div class="modal__footer u-margin-top--lg"> 2879 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> 2880 <a href="/cart" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a> 2881 </div> 2882 </div> 2883 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> 2884 </div> 2885 </div> 2886 </script> 2887 <script> 2888 document.addEventListener('addToCart', function (event) { 2889 Cart.ShowLastAddedProductModal(event.detail); 2890 }); 2891 </script> 2892 } 2893 else if (!onlyPreview && addingToCartNotification == "toggle") 2894 { 2895 <script> 2896 document.addEventListener('addToCart', function () { 2897 Cart.ToggleMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 2898 }); 2899 </script> 2900 } 2901 } 2902 2903 @helper CustomRenderMiniCartOrderLines() 2904 { 2905 <text> 2906 {{#OrderLines}} 2907 {{#ifCond template "===" "CartOrderline"}} 2908 {{>MiniCartOrderline}} 2909 {{/ifCond}} 2910 {{#ifCond template "===" "CartOrderlineMobile"}} 2911 {{>MiniCartOrderline}} 2912 {{/ifCond}} 2913 {{#ifCond template "===" "CartOrderlineDiscount"}} 2914 {{>MiniCartOrderlineDiscount}} 2915 {{/ifCond}} 2916 {{/OrderLines}} 2917 </text> 2918 } 2919 2920 @helper CustomRenderMiniCartTotal() 2921 { 2922 <tr class="mini-cart-totals dw-mod"> 2923 @if (Pageview.User != null) 2924 { 2925 <td colspan="2">@Translate("Total without VAT")</td> 2926 <td class="u-ta-right">{{numberofproducts}}</td> 2927 <td class="u-ta-right" width="130">{{totalprice}}</td> 2928 } 2929 else 2930 { 2931 <td colspan="2">@Translate("Total with VAT")</td> 2932 <td class="u-ta-right">{{numberofproducts}}</td> 2933 <td class="u-ta-right" width="130">{{totalprice}}</td> 2934 } 2935 2936 </tr> 2937 } 2938 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2939 2940 @using System 2941 @using System.Web 2942 @using System.Collections.Generic 2943 @using Dynamicweb.Rapido.Blocks.Extensibility 2944 @using Dynamicweb.Rapido.Blocks 2945 2946 @helper RenderPrimaryBottomSnippetsCustom(string currentLanguage) 2947 { 2948 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 2949 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2950 2951 if (isWireframeMode) 2952 { 2953 <script> 2954 Wireframe.Init(true); 2955 </script> 2956 } 2957 2958 2959 if (useGoogleTagManager) 2960 { 2961 <script> 2962 document.addEventListener('addToCart', function(event) { 2963 var googleImpression = event.detail.productInfo.googleImpression; 2964 dataLayer.push({ 2965 'event': 'addToCart', 2966 'ecommerce': { 2967 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code', 2968 'add': { 2969 'products': [{ 2970 'name': googleImpression.name, 2971 'id': googleImpression.id, 2972 'price': googleImpression.price, 2973 'brand': googleImpression.brand, 2974 'category': googleImpression.category, 2975 'variant': googleImpression.variant, 2976 'quantity': event.detail.quantity 2977 }] 2978 } 2979 } 2980 }); 2981 }); 2982 </script> 2983 } 2984 2985 <script> 2986 var browserLanguage = navigator.language; 2987 var currentLanguage = "@currentLanguage"; 2988 if (currentLanguage == "da" && browserLanguage != "da") { 2989 document.addEventListener("DOMContentLoaded", function () { 2990 if (document.cookie.split(';').some((item) => item.includes('preferredLanguage'))) { 2991 2992 } else { 2993 var modal = document.getElementById("LanguageModalTrigger"); 2994 modal.checked = true; 2995 } 2996 2997 }) 2998 } 2999 3000 function savePreferredLanguage(element, languageName) { 3001 var url = element.dataset["url"] 3002 document.cookie = "preferredLanguage=" + languageName + "; expires=Fri, 31 Dec 9999 23:59:59 GMT"; 3003 window.location.href = url; 3004 } 3005 </script> 3006 @LanguageChangeModal() 3007 3008 <!--@Javascripts--> 3009 } 3010 3011 @helper LanguageChangeModal() 3012 { 3013 <!-- Trigger for the warning modal --> 3014 <input type="checkbox" id="LanguageModalTrigger" class="modal-trigger" /> 3015 3016 <!-- Warning modal --> 3017 <div class="modal-container"> 3018 <label for="LanguageModalTrigger" class="modal-overlay"></label> 3019 <div class="modal modal--md"> 3020 <div class="modal__header"> 3021 <h2>@Translate("Warning")</h2> 3022 </div> 3023 <div class="modal__body"> 3024 <p>@Translate("Your browser language is different from the chosen site - please choose your preferred language:")</p> 3025 3026 <div class="grid grid--align-center grid--justify-center"> 3027 @foreach (var lang in Model.Languages) 3028 { 3029 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 3030 3031 <span data-url="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="btn btn--primary dw-mod u-margin" onclick="savePreferredLanguage(this, '@lang.Name')">@langInfo</span> 3032 } 3033 </div> 3034 </div> 3035 </div> 3036 </div> 3037 } 3038 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3039 3040 @using System 3041 @using System.Web 3042 @using System.Collections.Generic 3043 @using Dynamicweb.Rapido.Blocks.Extensibility 3044 @using Dynamicweb.Rapido.Blocks 3045 3046 @helper CustomRenderSearchScriptTemplates() 3047 { 3048 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 3049 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 3050 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 3051 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 3052 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 3053 bool isDigitalWarehouse = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("EnableDigitalWarehouse"); 3054 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 3055 3056 <script id="SearchGroupsTemplate" type="text/x-template"> 3057 {{#.}} 3058 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 3059 {{/.}} 3060 </script> 3061 3062 <script id="SearchProductsTemplate" type="text/x-template"> 3063 {{#each .}} 3064 {{#Product}} 3065 {{#ifCond template "!==" "SearchMore"}} 3066 <li class="dropdown__item dropdown__item--seperator dw-mod"> 3067 @if (useFacebookPixel) 3068 { 3069 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 3070 } 3071 @if (useGoogleTagManager) 3072 { 3073 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 3074 } 3075 <div> 3076 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 3077 <div class="u-margin-right u-pull--left {{noimage}} u-hidden-xs u-hidden-xxs"><img src="/Admin/Public/GetImage.ashx?width=45&height=36&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}"></div> 3078 <div class="u-pull--left"> 3079 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 3080 @if (!onlyPreview) 3081 { 3082 if (pointShopOnly) 3083 { 3084 <text> 3085 {{#if havePointPrice}} 3086 <div> 3087 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 3088 </div> 3089 {{else}} 3090 <small class="help-text u-no-margin">@Translate("Not available")</small> 3091 {{/if}} 3092 {{#unless canBePurchasedWithPoints}} 3093 {{#if havePointPrice}} 3094 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 3095 {{/if}} 3096 {{/unless}} 3097 </text> 3098 } 3099 else 3100 { 3101 <text> 3102 {{#if isLogin}} 3103 <div>{{price}}</div> 3104 {{/if}} 3105 </text> 3106 3107 3108 } 3109 } 3110 </div> 3111 </a> 3112 <div class="u-margin-left u-pull--right"> 3113 @if (!onlyPreview) 3114 { 3115 if (pointShopOnly) 3116 { 3117 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside {{#unless canBePurchasedWithPoints}}js-stay-disabled{{/unless}}" name="CartCmd" value="addWithPoints" 3118 onclick="Cart.AddToCart(event, { 3119 id: '{{productId}}', 3120 quantity: 1, 3121 buyForPoints: true, 3122 productInfo: {{productInfo}} 3123 }); {{facebookPixelAction}}" {{disabledBuyButton}}> 3124 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 3125 </button> 3126 } 3127 else 3128 { 3129 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 3130 onclick="Cart.AddToCart(event, { 3131 id: '{{productId}}', 3132 quantity: 1, 3133 productInfo: {{productInfo}} 3134 }); {{facebookPixelAction}}"> 3135 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 3136 </button> 3137 } 3138 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod {{hideViewMore}} js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 3139 } 3140 else if (isDigitalWarehouse) 3141 { 3142 <a class="btn btn--primary u-no-margin btn--condensed dw-mod" href="{{listLink}}"><i class="fas {{listIcon}}"></i></a> 3143 } 3144 else 3145 { 3146 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 3147 } 3148 </div> 3149 </div> 3150 </li> 3151 {{/ifCond}} 3152 {{#ifCond template "===" "SearchMore"}} 3153 {{>SearchMoreProducts}} 3154 {{/ifCond}} 3155 {{/Product}} 3156 {{else}} 3157 <li class="dropdown__item dropdown__item--seperator dw-mod"> 3158 @Translate("Your search gave 0 results") 3159 </li> 3160 {{/each}} 3161 </script> 3162 3163 <script id="SearchMoreProducts" type="text/x-template"> 3164 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 3165 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 3166 @Translate("View all") 3167 </a> 3168 </li> 3169 </script> 3170 3171 <script id="SearchMorePages" type="text/x-template"> 3172 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 3173 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 3174 @Translate("View all") 3175 </a> 3176 </li> 3177 </script> 3178 3179 <script id="SearchPagesTemplate" type="text/x-template"> 3180 {{#each .}} 3181 {{#ifCond template "!==" "SearchMore"}} 3182 <li class="dropdown__item dropdown__item--seperator dw-mod"> 3183 <div> 3184 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 3185 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 3186 <div class="u-pull--left"> 3187 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 3188 </div> 3189 </a> 3190 </div> 3191 </li> 3192 {{/ifCond}} 3193 {{#ifCond template "===" "SearchMore"}} 3194 {{>SearchMorePages}} 3195 {{/ifCond}} 3196 {{else}} 3197 <li class="dropdown__item dropdown__item--seperator dw-mod"> 3198 @Translate("Your search gave 0 results") 3199 </li> 3200 {{/each}} 3201 </script> 3202 3203 <script id="SearchPagesTemplateWrap" type="text/x-template"> 3204 <div class="dropdown__column-header">@Translate("Pages")</div> 3205 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 3206 {{>SearchPagesTemplate}} 3207 </ul> 3208 </script> 3209 3210 <script id="SearchProductsTemplateWrap" type="text/x-template"> 3211 <div class="dropdown__column-header">@Translate("Products")</div> 3212 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 3213 {{>SearchProductsTemplate}} 3214 </ul> 3215 </script> 3216 } 3217 3218 3219 3220 <!DOCTYPE html> 3221 3222 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 3223 <head> 3224 <meta charset="utf-8" /> 3225 <title>@Model.Title</title> 3226 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> 3227 <meta name="robots" content="index, follow"> 3228 3229 @Model.MetaTags 3230 3231 <!-- Favicon --> 3232 <link href="@favicon" rel="icon" type="image/png"> 3233 3234 <!-- Font awesome --> 3235 @if (useFontAwesomePro) 3236 { 3237 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css" type="text/css"> 3238 } 3239 else 3240 { 3241 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css" type="text/css"> 3242 } 3243 <!-- Flag icon --> 3244 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/css/flag-icon.min.css" type="text/css"> 3245 3246 <!-- Base (Default, wireframe) styles --> 3247 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 3248 3249 <!-- Rapido Css from Website Settings --> 3250 <link id="rapidoCss" rel="stylesheet" href="@autoCssLink" type="text/css"> 3251 3252 <!-- Ignite Css (Custom site specific styles) --> 3253 <link id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css" rel="stylesheet"> 3254 3255 <!-- Google fonts --> 3256 @{ 3257 var family = string.Join("%7C", fonts.Where(x => !string.IsNullOrEmpty(x)).Distinct().Select(x => string.Format("{0}:100,200,300,400,500,600,700,800,900", x))); 3258 } 3259 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 3260 </head> 3261 3262 <body> 3263 3264 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 3265 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 3266 3267 3268 @helper RenderMasterHeader() { 3269 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 3270 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 3271 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 3272 3273 <header class="top-container @stickyTop dw-mod" id="Top"> 3274 @RenderBlockList(subBlocks) 3275 </header> 3276 } 3277 3278 @helper RenderMain() { 3279 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 3280 3281 <main class="site dw-mod"> 3282 @RenderBlockList(subBlocks) 3283 </main> 3284 } 3285 3286 @helper RenderPageContent() { 3287 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 3288 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 3289 3290 <div id="Page" class="page @pagePos"> 3291 <section class="center-container content-container dw-mod" id="content"> 3292 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3293 3294 3295 @{ 3296 string columnClass = "12"; 3297 bool isProductPage = HttpContext.Current.Request.QueryString.Get("ProductID") != null ? true : false; 3298 string backgroundColorClass = Model.PropertyItem.GetString("BackgroundColor") != null && !isProductPage ? "u-" + Model.PropertyItem.GetList("BackgroundColor").SelectedValue + "--bg" : ""; 3299 } 3300 3301 @if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 3302 { 3303 <div class="grid__col-12 grid__col--bleed-y"> 3304 @RenderNavigation(new 3305 { 3306 id = "breadcrumb", 3307 template = "Breadcrumb.xslt" 3308 }) 3309 </div> 3310 } 3311 3312 <div class="grid"> 3313 @if (Model.PropertyItem.GetList("LeftMenu") != null && Model.PropertyItem.GetList("LeftMenu").SelectedValue == "True" && (Pageview.Page.NavigationSettings == null || !Pageview.Page.NavigationSettings.UseEcomGroups)) 3314 { 3315 var navigationMarkup = RenderNavigation(new 3316 { 3317 id = "leftnav", 3318 cssclass = "dwnavigation", 3319 startLevel = 2, 3320 expandmode = "all", 3321 endlevel = 5, 3322 template = "LeftNavigation.xslt" 3323 }); 3324 3325 if (!string.IsNullOrEmpty(navigationMarkup)) 3326 { 3327 <nav class="grid__col-md-3"> 3328 <div class="grid__cell"> 3329 @navigationMarkup 3330 </div> 3331 </nav> 3332 columnClass = "9"; 3333 } 3334 } 3335 <div class="grid__col-md-@columnClass grid__col--bleed"> 3336 <div class="grid"> 3337 @Model.Placeholder("dwcontent", "content", "default:true;sort:1") 3338 </div> 3339 </div> 3340 </div> 3341 3342 3343 @* Very small hack to make it cleanly, and easily possible to change the background color on a single page *@ 3344 @if (backgroundColorClass != "") 3345 { 3346 <script> 3347 document.getElementById("Page").classList.add("@backgroundColorClass"); 3348 </script> 3349 } 3350 </section> 3351 </div> 3352 } 3353 3354 </body> 3355 </html> 3356 3357