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_6c3a6690b4104ba6bbaa1513bffd8bea.<RenderPageContent>b__85_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\topbrands.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 4707
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_6c3a6690b4104ba6bbaa1513bffd8bea.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\topbrands.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_6c3a6690b4104ba6bbaa1513bffd8bea.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\topbrands.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_6c3a6690b4104ba6bbaa1513bffd8bea.<RenderMain>b__84_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\topbrands.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 4691
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_6c3a6690b4104ba6bbaa1513bffd8bea.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\topbrands.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_6c3a6690b4104ba6bbaa1513bffd8bea.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\topbrands.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_6c3a6690b4104ba6bbaa1513bffd8bea.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\topbrands.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 166
   at CompiledRazorTemplates.Dynamic.RazorEngine_6c3a6690b4104ba6bbaa1513bffd8bea.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\topbrands.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_6c3a6690b4104ba6bbaa1513bffd8bea.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\topbrands.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 4674
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2 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 var cartCalculationsFeedPageId = GetPageIdByNavigationTag("CartCalculationsFeed"); 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-cart-calculations-id="@cartCalculationsFeedPageId" 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 1472 if (lang.Name != "French") 1473 { 1474 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 1475 1476 if (languageViewType == "flag") 1477 { 1478 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + "\"></span>"; 1479 } 1480 1481 if (languageViewType == "name") 1482 { 1483 langInfo = lang.Name; 1484 } 1485 1486 <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> 1487 } 1488 } 1489 </div> 1490 </li> 1491 } 1492 } 1493 1494 @helper RenderMiniCart() 1495 { 1496 bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 1497 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 1498 int cartPageId = GetPageIdByNavigationTag("CartPage"); 1499 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 1500 1501 if (!onlyPreview && !navigationItemsHideCart) 1502 { 1503 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1504 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod" : "menu__item menu__item--horizontal menu--clean dw-mod"; 1505 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1506 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 1507 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue; 1508 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 1509 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 1510 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 1511 1512 if (showPrice && counterPosition == "right") 1513 { 1514 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 1515 } 1516 1517 1518 <li class="@liClasses" id="miniCartWrapper" @*onmouseenter="Cart.UpdateMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"*@> 1519 <div class="mini-cart dw-mod"> 1520 <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="@menuLinkClass menu__link--icon dw-mod js-mini-cart-button"> 1521 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 1522 <div class="mini-cart__counter dw-mod"> 1523 <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"> 1524 <div class="js-mini-cart-counter-content"> 1525 @cartProductsCount 1526 @cartProductsTotalPrice 1527 </div> 1528 </div> 1529 </div> 1530 </a> 1531 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 1532 { 1533 <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> 1534 } 1535 </div> 1536 </li> 1537 } 1538 } 1539 1540 @helper RenderSignIn() 1541 { 1542 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 1543 string userInitials = ""; 1544 int pageId = Model.TopPage.ID; 1545 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 1546 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 1547 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 1548 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 1549 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 1550 int mySavedCartsPageId = GetPageIdByNavigationTag("SavedShoppingCarts"); 1551 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 1552 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 1553 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 1554 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 1555 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 1556 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 1557 1558 string linkStart = "/Default.aspx?ID="; 1559 if (Model.CurrentUser.ID <= 0) 1560 { 1561 linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; 1562 } 1563 1564 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 1565 string myProfilePageLink = linkStart + myProfilePageId; 1566 string myOrdersPageLink = linkStart + myOrdersPageId; 1567 string myFavoritesPageLink = linkStart + myFavoritesPageId; 1568 string mySavedCartsPageLink = linkStart + mySavedCartsPageId; 1569 1570 if (Model.CurrentUser.ID != 0) 1571 { 1572 if (!String.IsNullOrEmpty(Model.CurrentUser.Name)) 1573 { 1574 string[] names = Model.CurrentUser.Name.Split(' '); 1575 userInitials += Model.CurrentUser.Name.Substring(0, 1); 1576 1577 if (names.Length > 1) 1578 { 1579 userInitials += names[names.Length - 1].Substring(0, 1); 1580 } 1581 } 1582 else 1583 { 1584 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : ""; 1585 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : ""; 1586 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : ""; 1587 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : ""; 1588 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : ""; 1589 } 1590 } 1591 1592 if (!navigationItemsHideSignIn) 1593 { 1594 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1595 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"; 1596 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1597 1598 <li class="@liClasses is-dropdown is-dropdown--no-icon"> 1599 <div class="@menuLinkClass menu__link--icon dw-mod"> 1600 @if (Model.CurrentUser.ID <= 0) 1601 { 1602 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i> 1603 } 1604 else 1605 { 1606 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 1607 } 1608 </div> 1609 <div class="menu menu--dropdown sign-in-dropdown dw-mod"> 1610 <ul class="list list--clean dw-mod"> 1611 @if (Model.CurrentUser.ID <= 0) 1612 { 1613 <li> 1614 <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> 1615 </li> 1616 if (!hideCreateAccountLink) 1617 { 1618 <li> 1619 <a href="/default.aspx?ID=@createAccountPageId" class="list__link dw-mod">@Translate("Create account")</a> 1620 </li> 1621 } 1622 <li> 1623 <a href="@forgotPasswordPageLink" class="list__link dw-mod">@Translate("Forgot your password?")</a> 1624 </li> 1625 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 1626 { 1627 <li class="list__seperator dw-mod"></li> 1628 } 1629 } 1630 @if (!hideMyProfileLink) 1631 { 1632 <li> 1633 <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> 1634 </li> 1635 } 1636 @if (!hideMyOrdersLink) 1637 { 1638 <li> 1639 <a href="@myOrdersPageLink" class="list__link dw-mod"><i class="fas fa-list u-margin-right"></i>@Translate("My Orders")</a> 1640 </li> 1641 } 1642 @if (!hideMyFavoritesLink) 1643 { 1644 <li> 1645 <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> 1646 </li> 1647 } 1648 @if (!hideMySavedCardsLink) 1649 { 1650 <li> 1651 <a href="@mySavedCartsPageLink" class="list__link dw-mod"><i class="fas fa-shopping-cart u-margin-right"></i>@Translate("My Saved Carts")</a> 1652 </li> 1653 } 1654 @if (Model.CurrentUser.ID > 0) 1655 { 1656 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 1657 { 1658 <li class="list__seperator dw-mod"></li> 1659 } 1660 <li> 1661 <a href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId" class="list__link dw-mod">@Translate("Sign out")</a> 1662 </li> 1663 } 1664 </ul> 1665 </div> 1666 </li> 1667 } 1668 } 1669 1670 @helper RenderFavorites() 1671 { 1672 bool navigationItemsHideFavorites = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 1673 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 1674 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 1675 1676 string linkStart = "/Default.aspx?ID="; 1677 if (Model.CurrentUser.ID <= 0) 1678 { 1679 linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; 1680 } 1681 1682 string myFavoritesPageLink = linkStart + myFavoritesPageId; 1683 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1684 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"; 1685 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1686 1687 <li class="@liClasses"> 1688 <a href="@myFavoritesPageLink" class="@menuLinkClass menu__link--icon dw-mod"> 1689 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 1690 </a> 1691 </li> 1692 } 1693 1694 @helper RenderHeaderButton() 1695 { 1696 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 1697 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 1698 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 1699 1700 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 1701 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 1702 </li> 1703 } 1704 1705 @helper RenderSearchBar(string alignment = "left") 1706 { 1707 string searchFeedId = ""; 1708 string searchSecondFeedId = ""; 1709 int groupsFeedId; 1710 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 1711 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 1712 string resultPageLink; 1713 string searchPlaceholder; 1714 string searchType = "product-search"; 1715 string searchTemplate; 1716 string searchContentTemplate = ""; 1717 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 1718 bool showGroups = true; 1719 1720 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 1721 { 1722 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1723 resultPageLink = contentSearchPageLink; 1724 searchPlaceholder = Translate("Search page"); 1725 groupsFeedId = 0; 1726 searchType = "content-search"; 1727 searchTemplate = "SearchPagesTemplate"; 1728 showGroups = false; 1729 } 1730 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 1731 { 1732 searchFeedId = productsPageId + "&feed=true"; 1733 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1734 resultPageLink = Converter.ToString(productsPageId); 1735 searchPlaceholder = Translate("Search products or pages"); 1736 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1737 searchType = "combined-search"; 1738 searchTemplate = "SearchProductsTemplateWrap"; 1739 searchContentTemplate = "SearchPagesTemplateWrap"; 1740 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1741 } 1742 else 1743 { 1744 resultPageLink = Converter.ToString(productsPageId); 1745 searchFeedId = productsPageId + "&feed=true"; 1746 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1747 searchPlaceholder = Translate("Search products"); 1748 searchTemplate = "SearchProductsTemplate"; 1749 searchType = "product-search"; 1750 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1751 } 1752 1753 <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"> 1754 @if (showGroups) 1755 { 1756 <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> 1757 <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> 1758 } 1759 <div class="typeahead-search-field"> 1760 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@searchPlaceholder" value="@searchValue"> 1761 @if (string.IsNullOrEmpty(searchSecondFeedId)) 1762 { 1763 <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> 1764 } 1765 else 1766 { 1767 <div class="dropdown dropdown--absolute-position dropdown--combined grid @(alignment == "right" ? "dropdown--right-aligned" : "")"> 1768 <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> 1769 <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> 1770 </div> 1771 } 1772 </div> 1773 <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> 1774 </div> 1775 } 1776 1777 @helper RenderMiniSearch() 1778 { 1779 string searchFeedId = ""; 1780 string searchSecondFeedId = ""; 1781 int groupsFeedId; 1782 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 1783 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 1784 string resultPageLink; 1785 string searchPlaceholder; 1786 string searchType = "product-search"; 1787 string searchTemplate; 1788 string searchContentTemplate = ""; 1789 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 1790 bool showGroups = true; 1791 1792 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 1793 { 1794 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1795 resultPageLink = contentSearchPageLink; 1796 searchPlaceholder = Translate("Search page"); 1797 groupsFeedId = 0; 1798 searchType = "content-search"; 1799 searchTemplate = "SearchPagesTemplate"; 1800 showGroups = false; 1801 } 1802 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 1803 { 1804 searchFeedId = productsPageId + "&feed=true"; 1805 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1806 resultPageLink = Converter.ToString(productsPageId); 1807 searchPlaceholder = Translate("Search products or pages"); 1808 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1809 searchType = "combined-search"; 1810 searchTemplate = "SearchProductsTemplateWrap"; 1811 searchContentTemplate = "SearchPagesTemplateWrap"; 1812 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1813 } 1814 else 1815 { 1816 resultPageLink = Converter.ToString(productsPageId); 1817 searchFeedId = productsPageId + "&feed=true"; 1818 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1819 searchPlaceholder = Translate("Search products"); 1820 searchTemplate = "SearchProductsTemplate"; 1821 searchType = "product-search"; 1822 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1823 } 1824 1825 <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()"> 1826 <div class="menu__link menu__link--icon dw-mod"> 1827 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 1828 </div> 1829 <div class="menu menu--dropdown u-w380px top-micro-search dw-mod"> 1830 <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"> 1831 <div class="typeahead-search-field"> 1832 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@searchPlaceholder" value="@searchValue"> 1833 @if (string.IsNullOrEmpty(searchSecondFeedId)) 1834 { 1835 <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> 1836 } 1837 else 1838 { 1839 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 1840 <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> 1841 <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> 1842 </div> 1843 } 1844 </div> 1845 </div> 1846 </div> 1847 </li> 1848 } 1849 1850 @helper RenderImpersonationBar() 1851 { 1852 int impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 1853 1854 <div class="u-color-warning--bg"> 1855 <div class="center-container top-container__center-container dw-mod"> 1856 @*Impersonation*@ 1857 <div class="grid"> 1858 <div class="grid--align-self-center grid__col-x"> 1859 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 1860 { 1861 string stopImpersonateTranslation = Translate("Stop impersonation"); 1862 string username = ""; 1863 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName)) 1864 { 1865 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName; 1866 } 1867 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name)) 1868 { 1869 username = Model.CurrentSecondaryUser.Name; 1870 } 1871 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email)) 1872 { 1873 username = Model.CurrentSecondaryUser.Email; 1874 } 1875 else 1876 { 1877 username = Model.CurrentSecondaryUser.UserName; 1878 } 1879 <div class="grid-cell"> 1880 <div class="u-pull--left u-bold u-margin-top"> 1881 <i class="fas fa-user-secret"></i> 1882 @Pageview.User.UserName<text>&nbsp;</text>@Translate("is impersonating")<text>&nbsp;</text>@username 1883 </div> 1884 <form method="post" class="u-pull--right u-no-margin"> 1885 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation"> 1886 </form> 1887 </div> 1888 } 1889 else 1890 { 1891 string viewListTranslation = Translate("View the list of users you can impersonate"); 1892 <div class="grid-cell u-bold"> 1893 <i class="fas fa-user-secret"></i> 1894 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a> 1895 </div> 1896 } 1897 </div> 1898 </div> 1899 </div> 1900 </div> 1901 } 1902 1903 </text> 1904 } 1905 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 1906 1907 @using System 1908 @using System.Web 1909 @using System.Collections.Generic 1910 @using Dynamicweb.Rapido.Blocks.Extensibility 1911 @using Dynamicweb.Rapido.Blocks 1912 1913 @functions { 1914 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 1915 } 1916 1917 @{ 1918 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content") : ""; 1919 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content") : ""; 1920 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content") : ""; 1921 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header") : ""; 1922 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header") : ""; 1923 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header") : ""; 1924 1925 Block masterFooterContent = new Block() 1926 { 1927 Id = "MasterFooterContent", 1928 SortId = 10, 1929 Template = RenderFooter(), 1930 SkipRenderBlocksList = true 1931 }; 1932 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 1933 1934 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 1935 { 1936 Block masterFooterColumnOne = new Block 1937 { 1938 Id = "MasterFooterColumnOne", 1939 SortId = 10, 1940 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 1941 Design = new Design { 1942 Size = "auto", 1943 RenderType = RenderType.Column 1944 } 1945 }; 1946 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 1947 } 1948 1949 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 1950 { 1951 Block masterFooterColumnTwo = new Block 1952 { 1953 Id = "MasterFooterColumnTwo", 1954 SortId = 20, 1955 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 1956 Design = new Design 1957 { 1958 Size = "auto", 1959 RenderType = RenderType.Column 1960 } 1961 }; 1962 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 1963 } 1964 1965 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 1966 { 1967 Block masterFooterColumnThree = new Block 1968 { 1969 Id = "MasterFooterColumnThree", 1970 SortId = 30, 1971 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 1972 Design = new Design 1973 { 1974 Size = "auto", 1975 RenderType = RenderType.Column 1976 } 1977 }; 1978 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 1979 } 1980 1981 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 1982 { 1983 Block masterFooterNewsletterSignUp = new Block 1984 { 1985 Id = "MasterFooterNewsletterSignUp", 1986 SortId = 40, 1987 Template = RenderFooterNewsletterSignUp(), 1988 Design = new Design 1989 { 1990 Size = "auto", 1991 RenderType = RenderType.Column 1992 } 1993 }; 1994 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 1995 } 1996 1997 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 1998 { 1999 Block masterFooterSocialLinks = new Block 2000 { 2001 Id = "MasterFooterSocialLinks", 2002 SortId = 50, 2003 Template = RenderFooterSocialLinks(), 2004 Design = new Design 2005 { 2006 Size = "auto", 2007 RenderType = RenderType.Column 2008 } 2009 }; 2010 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 2011 } 2012 2013 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 2014 { 2015 Block masterFooterPayments = new Block 2016 { 2017 Id = "MasterFooterPayments", 2018 SortId = 60, 2019 Template = RenderFooterPayments(), 2020 Design = new Design 2021 { 2022 Size = "12", 2023 RenderType = RenderType.Column 2024 } 2025 }; 2026 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 2027 } 2028 2029 Block masterFooterCopyright = new Block 2030 { 2031 Id = "MasterFooterCopyright", 2032 SortId = 70, 2033 Template = RenderFooterCopyright(), 2034 Design = new Design 2035 { 2036 Size = "12", 2037 RenderType = RenderType.Column 2038 } 2039 }; 2040 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 2041 } 2042 2043 @helper RenderFooter() { 2044 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 2045 2046 <footer class="footer dw-mod"> 2047 <div class="center-container top-container__center-container dw-mod"> 2048 <div class="grid grid--external-bleed-x"> 2049 @RenderBlockList(subBlocks) 2050 </div> 2051 </div> 2052 </footer> 2053 } 2054 2055 @helper RenderFooterColumn(string header, string content) { 2056 <h3 class="footer__heading dw-mod">@header</h3> 2057 <div class="footer__content dw-mod"> 2058 @content 2059 </div> 2060 } 2061 2062 @helper RenderFooterNewsletterSignUp() { 2063 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 2064 2065 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 2066 <div class="footer__content dw-mod"> 2067 <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> 2068 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> 2069 <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> 2070 <div class="form__field-combi"> 2071 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' /> 2072 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' /> 2073 </div> 2074 </form> 2075 </div> 2076 } 2077 2078 @helper RenderFooterSocialLinks() { 2079 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 2080 <div class="footer__content dw-mod"> 2081 <div class="collection dw-mod"> 2082 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 2083 { 2084 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 2085 string socialIconClass = socialIcon.SelectedValue; 2086 string socialIconTitle = socialIcon.SelectedName; 2087 string socialLink = socialitem.GetString("Link"); 2088 2089 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px"><i class="@socialIconClass fa-2x"></i></a> 2090 } 2091 </div> 2092 </div> 2093 } 2094 2095 @helper RenderFooterPayments() { 2096 <div class="footer__content dw-mod"> 2097 <div class="collection dw-mod"> 2098 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 2099 { 2100 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 2101 string paymentImage = null; 2102 string paymentTitle = paymentItem.SelectedName; 2103 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 2104 if (selected != null) 2105 { 2106 paymentImage = selected.Icon; 2107 } 2108 2109 <div class="footer__card-type"> 2110 <img src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> 2111 </div> 2112 } 2113 </div> 2114 </div> 2115 } 2116 2117 @helper RenderFooterCopyright() { 2118 <div class="grid__col-12 footer__copyright dw-mod"> 2119 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 2120 </div> 2121 } 2122 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2123 2124 @using System 2125 @using System.Web 2126 @using System.Collections.Generic 2127 @using Dynamicweb.Rapido.Blocks.Extensibility 2128 @using Dynamicweb.Rapido.Blocks 2129 2130 @{ 2131 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 2132 bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 2133 2134 if (!navigationItemsHideCart) 2135 { 2136 Block miniCartScriptTemplates = new Block() 2137 { 2138 Id = "MasterMiniCartTemplates", 2139 SortId = 1, 2140 Template = RenderMiniCartScriptTemplates(), 2141 SkipRenderBlocksList = true, 2142 BlocksList = new List<Block> 2143 { 2144 new Block { 2145 Id = "MiniCartHeader", 2146 SortId = 10, 2147 Template = RenderMiniCartHeader() 2148 }, 2149 new Block { 2150 Id = "MiniCartOrderLines", 2151 SortId = 20, 2152 Template = RenderMiniCartOrderLines() 2153 }, 2154 new Block { 2155 Id = "MiniCartFees", 2156 SortId = 30, 2157 Template = RenderMiniCartFees() 2158 }, 2159 new Block { 2160 Id = "MiniCartPoints", 2161 SortId = 40, 2162 Template = RenderMiniCartPoints() 2163 }, 2164 new Block { 2165 Id = "MiniCartTotal", 2166 SortId = 50 , 2167 Template = RenderMiniCartTotal() 2168 } 2169 } 2170 }; 2171 2172 miniCartBlocksPage.Add(MasterBlockId.MasterBottomSnippets, miniCartScriptTemplates); 2173 } 2174 } 2175 2176 @helper RenderMiniCartScriptTemplates() 2177 { 2178 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 2179 2180 int cartPageId = GetPageIdByNavigationTag("CartPage"); 2181 bool showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 2182 showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue == "right" ? showPriceInMiniCartCounter : false; 2183 showPriceInMiniCartCounter = Pageview.Device.ToString() == "Mobile" ? false : showPriceInMiniCartCounter; 2184 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2185 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2186 string addingToCartNotification = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 2187 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 2188 2189 2190 <script id="MiniCartCounterContent" type="text/x-template"> 2191 {{#.}} 2192 <div class="js-mini-cart-counter-content dw-mod"> 2193 @if (showPriceInMiniCartCounter) 2194 { 2195 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 2196 } 2197 else 2198 { 2199 <text>{{numberofproducts}}</text> 2200 } 2201 </div> 2202 {{/.}} 2203 </script> 2204 2205 <script id="MiniCartContent" type="text/x-template"> 2206 {{#.}} 2207 @if (useGoogleTagManager) 2208 { 2209 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 2210 } 2211 <div class="mini-cart-dropdown__inner {{isempty}} dw-mod"> 2212 <h4 class="u-ta-center u-no-margin u-margin-bottom u-margin-top">@Translate("Shopping cart")</h4> 2213 <div class="mini-cart-dropdown__body dw-mod"> 2214 <table class="table mini-cart-table dw-mod"> 2215 @RenderBlockList(subBlocks) 2216 </table> 2217 </div> 2218 2219 <table class="table mini-cart-table dw-mod"> 2220 <tr class="mini-cart-orderlines__footer dw-mod"> 2221 <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> 2222 <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> 2223 </tr> 2224 </table> 2225 </div> 2226 {{/.}} 2227 </script> 2228 2229 <script id="MiniCartOrderline" type="text/x-template"> 2230 <tr class="{{isempty}}"> 2231 <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> 2232 <td> 2233 <a href="{{link}}" class="mini-cart-orderlines__name" title="{{name}}">{{name}}</a> 2234 {{#if variantname}} 2235 <a href="{{link}}" class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{variantname}}</a> 2236 {{/if}} 2237 {{#if unitname}} 2238 <div class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{unitname}}</div> 2239 {{/if}} 2240 </td> 2241 <td class="u-ta-right">{{quantity}}</td> 2242 <td class="u-ta-right"> 2243 {{#if pointsTotal}} 2244 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 2245 {{else}} 2246 {{totalprice}} 2247 {{/if}} 2248 </td> 2249 </tr> 2250 </script> 2251 2252 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 2253 <tr class="table__row--no-border {{isempty}}"> 2254 <td>&nbsp;</td> 2255 <td><div class="mini-cart-orderlines__name dw-mod">{{name}}</div></td> 2256 <td class="u-ta-right">&nbsp;</td> 2257 <td class="u-ta-right">{{totalprice}}</td> 2258 </tr> 2259 </script> 2260 2261 if (!onlyPreview && addingToCartNotification == "modal") 2262 { 2263 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 2264 2265 <script id="LastAddedProductTemplate" type="text/x-template"> 2266 <!-- Trigger for the login modal --> 2267 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> 2268 2269 <!-- Login modal --> 2270 <div class="modal-container"> 2271 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> 2272 <div class="modal modal--md"> 2273 <div class="modal__header"> 2274 <h2>@Translate("Product is added to the cart")</h2> 2275 </div> 2276 <div class="modal__body"> 2277 <div class="grid"> 2278 <div class="grid__col-2"> 2279 <a href="{{productInfo.link}}"> 2280 <img src="{{productInfo.image}}" alt="{{productInfo.name}}" class="dw-mod" /> 2281 </a> 2282 </div> 2283 <div class="u-padding grid--align-self-center"> 2284 <span>{{quantity}}</span> x 2285 </div> 2286 <div class="grid__col-auto grid--align-self-center"> 2287 <div>{{productInfo.name}}</div> 2288 {{#if productInfo.variantName}} 2289 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 2290 {{/if}} 2291 {{#if productInfo.unitName}} 2292 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 2293 {{/if}} 2294 </div> 2295 </div> 2296 <div class="modal__footer u-margin-top--lg"> 2297 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> 2298 <a href="/cart" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a> 2299 </div> 2300 </div> 2301 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> 2302 </div> 2303 </div> 2304 </script> 2305 <script> 2306 document.addEventListener('addToCart', function (event) { 2307 Cart.ShowLastAddedProductModal(event.detail); 2308 }); 2309 </script> 2310 } 2311 else if (!onlyPreview && addingToCartNotification == "toggle") 2312 { 2313 <script> 2314 document.addEventListener('addToCart', function () { 2315 Cart.ToggleMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 2316 }); 2317 </script> 2318 } 2319 } 2320 2321 @helper RenderMiniCartHeader() 2322 { 2323 <thead> 2324 <tr> 2325 <td>&nbsp;</td> 2326 <td>@Translate("Product")</td> 2327 <td class="u-ta-right">@Translate("Qty")</td> 2328 <td class="u-ta-right" width="120">@Translate("Price")</td> 2329 </tr> 2330 </thead> 2331 } 2332 2333 @helper RenderMiniCartOrderLines() 2334 { 2335 <text> 2336 {{#OrderLines}} 2337 {{#ifCond template "===" "CartOrderline"}} 2338 {{>MiniCartOrderline}} 2339 {{/ifCond}} 2340 {{#ifCond template "===" "CartOrderlineMobile"}} 2341 {{>MiniCartOrderline}} 2342 {{/ifCond}} 2343 {{#ifCond template "===" "CartOrderlineDiscount"}} 2344 {{>MiniCartOrderlineDiscount}} 2345 {{/ifCond}} 2346 {{/OrderLines}} 2347 </text> 2348 } 2349 2350 @helper RenderMiniCartFees() 2351 { 2352 <tr> 2353 <td><i class="fas fa-credit-card"></i></td> 2354 <td>{{paymentmethod}}</td> 2355 <td colspan="2" class="u-ta-right" width="130">{{paymentfee}}</td> 2356 </tr> 2357 <tr> 2358 <td><i class="fas fa-truck"></i></td> 2359 <td>{{shippingmethod}}</td> 2360 <td colspan="2" class="u-ta-right" width="130">{{shippingfee}}</td> 2361 </tr> 2362 } 2363 2364 @helper RenderMiniCartPoints() 2365 { 2366 <text> 2367 {{#if earnings}} 2368 <tr> 2369 <td colspan="2">@Translate("Earnings")</td> 2370 <td colspan="2" class="u-ta-right" width="130"><span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")</td> 2371 </tr> 2372 {{/if}} 2373 </text> 2374 } 2375 2376 @helper RenderMiniCartTotal() 2377 { 2378 <tr class="mini-cart-totals dw-mod"> 2379 <td colspan="2">@Translate("Total")</td> 2380 <td class="u-ta-right">{{numberofproducts}}</td> 2381 <td class="u-ta-right" width="130">{{totalprice}}</td> 2382 </tr> 2383 } 2384 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2385 2386 @using System 2387 @using System.Web 2388 @using System.Collections.Generic 2389 @using Dynamicweb.Rapido.Blocks.Extensibility 2390 @using Dynamicweb.Rapido.Blocks 2391 @using Dynamicweb.Ecommerce.Common 2392 2393 @{ 2394 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 2395 2396 Block masterScriptReferences = new Block() 2397 { 2398 Id = "MasterScriptReferences", 2399 SortId = 1, 2400 Template = RenderMasterScriptReferences() 2401 }; 2402 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 2403 } 2404 2405 @helper RenderMasterScriptReferences() { 2406 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.11.js"></script> 2407 <script src="/Files/Templates/Designs/Rapido/js/master-v2.min.js"></script> 2408 2409 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 2410 { 2411 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 2412 } 2413 } 2414 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2415 2416 @using System 2417 @using System.Web 2418 @using System.Collections.Generic 2419 @using Dynamicweb.Rapido.Blocks.Extensibility 2420 @using Dynamicweb.Rapido.Blocks 2421 2422 @{ 2423 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 2424 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 2425 2426 if (!navigationItemsHideSearch) 2427 { 2428 Block masterSearchScriptTemplates = new Block() 2429 { 2430 Id = "MasterSearchScriptTemplates", 2431 SortId = 1, 2432 Template = RenderSearchScriptTemplates() 2433 }; 2434 2435 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 2436 } 2437 } 2438 2439 @helper RenderSearchScriptTemplates() 2440 { 2441 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 2442 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 2443 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 2444 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2445 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 2446 bool isDigitalWarehouse = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("EnableDigitalWarehouse"); 2447 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 2448 2449 <script id="SearchGroupsTemplate" type="text/x-template"> 2450 {{#.}} 2451 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 2452 {{/.}} 2453 </script> 2454 2455 <script id="SearchProductsTemplate" type="text/x-template"> 2456 {{#each .}} 2457 {{#Product}} 2458 {{#ifCond template "!==" "SearchMore"}} 2459 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2460 @if (useFacebookPixel) 2461 { 2462 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 2463 } 2464 @if (useGoogleTagManager) 2465 { 2466 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 2467 } 2468 <div> 2469 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 2470 <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> 2471 <div class="u-pull--left"> 2472 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 2473 @if (!onlyPreview) 2474 { 2475 if (pointShopOnly) 2476 { 2477 <text> 2478 {{#if havePointPrice}} 2479 <div> 2480 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 2481 </div> 2482 {{else}} 2483 <small class="help-text u-no-margin">@Translate("Not available")</small> 2484 {{/if}} 2485 {{#unless canBePurchasedWithPoints}} 2486 {{#if havePointPrice}} 2487 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 2488 {{/if}} 2489 {{/unless}} 2490 </text> 2491 } 2492 else 2493 { 2494 <div>{{price}}</div> 2495 } 2496 } 2497 </div> 2498 </a> 2499 <div class="u-margin-left u-pull--right"> 2500 @if (!onlyPreview) 2501 { 2502 if (pointShopOnly) 2503 { 2504 <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" 2505 onclick="Cart.AddToCart(event, { 2506 id: '{{productId}}', 2507 quantity: 1, 2508 buyForPoints: true, 2509 productInfo: {{productInfo}} 2510 }); {{facebookPixelAction}}" {{disabledBuyButton}}> 2511 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 2512 </button> 2513 } 2514 else 2515 { 2516 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 2517 onclick="Cart.AddToCart(event, { 2518 id: '{{productId}}', 2519 quantity: 1, 2520 productInfo: {{productInfo}} 2521 }); {{facebookPixelAction}}"> 2522 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 2523 </button> 2524 } 2525 <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> 2526 } 2527 else if (isDigitalWarehouse) 2528 { 2529 <a class="btn btn--primary u-no-margin btn--condensed dw-mod" href="{{listLink}}"><i class="fas {{listIcon}}"></i></a> 2530 } 2531 else 2532 { 2533 <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> 2534 } 2535 </div> 2536 </div> 2537 </li> 2538 {{/ifCond}} 2539 {{#ifCond template "===" "SearchMore"}} 2540 {{>SearchMoreProducts}} 2541 {{/ifCond}} 2542 {{/Product}} 2543 {{else}} 2544 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2545 @Translate("Your search gave 0 results") 2546 </li> 2547 {{/each}} 2548 </script> 2549 2550 <script id="SearchMoreProducts" type="text/x-template"> 2551 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 2552 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 2553 @Translate("View all") 2554 </a> 2555 </li> 2556 </script> 2557 2558 <script id="SearchMorePages" type="text/x-template"> 2559 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 2560 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 2561 @Translate("View all") 2562 </a> 2563 </li> 2564 </script> 2565 2566 <script id="SearchPagesTemplate" type="text/x-template"> 2567 {{#each .}} 2568 {{#ifCond template "!==" "SearchMore"}} 2569 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2570 <div> 2571 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 2572 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 2573 <div class="u-pull--left"> 2574 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 2575 </div> 2576 </a> 2577 </div> 2578 </li> 2579 {{/ifCond}} 2580 {{#ifCond template "===" "SearchMore"}} 2581 {{>SearchMorePages}} 2582 {{/ifCond}} 2583 {{else}} 2584 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2585 @Translate("Your search gave 0 results") 2586 </li> 2587 {{/each}} 2588 </script> 2589 2590 <script id="SearchPagesTemplateWrap" type="text/x-template"> 2591 <div class="dropdown__column-header">@Translate("Pages")</div> 2592 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 2593 {{>SearchPagesTemplate}} 2594 </ul> 2595 </script> 2596 2597 <script id="SearchProductsTemplateWrap" type="text/x-template"> 2598 <div class="dropdown__column-header">@Translate("Products")</div> 2599 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 2600 {{>SearchProductsTemplate}} 2601 </ul> 2602 </script> 2603 } 2604 2605 2606 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2607 2608 @using System 2609 @using System.Web 2610 @using System.Collections.Generic 2611 @using Dynamicweb.Rapido.Blocks.Extensibility 2612 @using Dynamicweb.Rapido.Blocks 2613 2614 @{ 2615 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 2616 2617 Block primaryBottomSnippets = new Block() 2618 { 2619 Id = "MasterJavascriptInitializers", 2620 SortId = 100, 2621 Template = RenderPrimaryBottomSnippets() 2622 }; 2623 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 2624 } 2625 2626 @helper RenderPrimaryBottomSnippets() 2627 { 2628 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 2629 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2630 2631 if (isWireframeMode) 2632 { 2633 <script> 2634 Wireframe.Init(true); 2635 </script> 2636 } 2637 2638 2639 if (useGoogleTagManager) 2640 { 2641 <p>fsdfsdfsdfdsf</p> 2642 <script> 2643 document.addEventListener('addToCart', function(event) { 2644 var googleImpression = event.detail.productInfo.googleImpression; 2645 dataLayer.push({ 2646 'event': 'addToCart', 2647 'ecommerce': { 2648 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code', 2649 'add': { 2650 'products': [{ 2651 'name': googleImpression.name, 2652 'id': googleImpression.id, 2653 'price': googleImpression.price, 2654 'brand': googleImpression.brand, 2655 'category': googleImpression.category, 2656 'variant': googleImpression.variant, 2657 'quantity': event.detail.quantity 2658 }] 2659 } 2660 } 2661 }); 2662 }); 2663 </script> 2664 } 2665 2666 <!--$$Javascripts--> 2667 } 2668 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2669 2670 @using System 2671 @using System.Web 2672 @using System.Collections.Generic 2673 @using Dynamicweb.Rapido.Blocks 2674 @using Dynamicweb.Rapido.Blocks.Extensibility 2675 @using Dynamicweb.Ecommerce.Orders; 2676 2677 @{ 2678 /**/ 2679 2680 BlocksPage masterBlocksBlocksPage = BlocksPage.GetBlockPage("Master"); 2681 bool showHeader = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2682 2683 Block cartSelectorPopup = new Block() 2684 { 2685 Id = "CartSelectorPopupTemplate", 2686 SortId = 41, 2687 Template = RenderCartSelectorPopup() 2688 }; 2689 2690 Block customSearchBar = new Block() 2691 { 2692 Id = "SearchBar", 2693 SortId = 10, 2694 Template = CustomRenderSearchBar(), 2695 Design = new Design() 2696 { 2697 Size = "auto", 2698 HidePadding = true, 2699 RenderType = RenderType.Column 2700 } 2701 }; 2702 2703 bool navnActionHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 2704 bool showSearchBarIcon = false; 2705 string topLayoutDesign = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 2706 2707 if (topLayoutDesign == "minimal" || topLayoutDesign == "minimal-right" || topLayoutDesign == "two-lines" || topLayoutDesign == "two-lines-centered") 2708 { 2709 showSearchBarIcon = true; 2710 } 2711 if (!navnActionHideSearch && showSearchBarIcon) 2712 { 2713 Block customMasterDesktopActionsMenuSearch = new Block 2714 { 2715 Id = "MasterDesktopActionsMenuSearch", 2716 SortId = 10, 2717 Template = CustomRenderMiniSearch() 2718 }; 2719 2720 masterBlocksBlocksPage.ReplaceBlock(customMasterDesktopActionsMenuSearch); 2721 } 2722 2723 if (navnActionHideSearch == false) 2724 { 2725 Block customMobileHeaderSearchBar = new Block() 2726 { 2727 Id = "MobileHeaderSearchBar", 2728 SortId = 30, 2729 Template = CustomRenderMobileTopSearchBar() 2730 }; 2731 masterBlocksBlocksPage.ReplaceBlock(customMobileHeaderSearchBar); 2732 } 2733 2734 masterBlocksBlocksPage.ReplaceBlock(customSearchBar); 2735 2736 Block customMiniCartScriptTemplates = new Block 2737 { 2738 Id = "MasterMiniCartTemplates", 2739 SortId = 1, 2740 SkipRenderBlocksList = true, 2741 Template = CustomRenderMiniCartScriptTemplates(), 2742 BlocksList = new List<Block> 2743 { 2744 new Block { 2745 Id = "MiniCartHeader", 2746 SortId = 10, 2747 Template = CustomRenderMiniCartHeader() 2748 }, 2749 new Block { 2750 Id = "MiniCartOrderLines", 2751 SortId = 20, 2752 Template = RenderMiniCartOrderLines() 2753 }, 2754 new Block { 2755 Id = "MiniCartFees", 2756 SortId = 30, 2757 Template = CustomRenderMiniCartFees() 2758 }, 2759 new Block { 2760 Id = "MiniCartPoints", 2761 SortId = 40, 2762 Template = RenderMiniCartPoints() 2763 }, 2764 new Block { 2765 Id = "MiniCartTotal", 2766 SortId = 50 , 2767 Template = CustomRenderMiniCartTotal() 2768 } 2769 } 2770 }; 2771 2772 Block customMasterDesktopActionsMenuMiniCart = new Block 2773 { 2774 Id = "MasterDesktopActionsMenuMiniCart", 2775 SortId = 50, 2776 Template = CustomRenderMiniCart() 2777 }; 2778 2779 masterBlocksBlocksPage.ReplaceBlock(customMiniCartScriptTemplates); 2780 2781 if (!showHeader) 2782 { 2783 masterBlocksBlocksPage.ReplaceBlock(customMasterDesktopActionsMenuMiniCart); 2784 } 2785 2786 //masterBlocksBlocksPage.ReplaceBlock(customRenderMiniCartTotal); 2787 2788 if (Dynamicweb.Frontend.PageView.Current().ID != GetPageIdByNavigationTag("SavedShoppingCarts")) 2789 { 2790 2791 masterBlocksBlocksPage.Add(MasterBlockId.MasterTopSnippets, cartSelectorPopup); 2792 } 2793 2794 bool navigationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 2795 2796 if (!navigationHideSearch) 2797 { 2798 Block customMasterSearchScriptTemplates = new Block() 2799 { 2800 Id = "MasterSearchScriptTemplates", 2801 SortId = 1, 2802 Template = CustomRenderSearchScriptTemplates() 2803 }; 2804 2805 masterBlocksBlocksPage.ReplaceBlock(customMasterSearchScriptTemplates); 2806 } 2807 2808 Block customMobileNavigationMenu = new Block 2809 { 2810 Id = "MobileNavigationMenu", 2811 SortId = 20, 2812 Template = CustomRenderMobileNavigationMenu() 2813 }; 2814 2815 masterBlocksBlocksPage.ReplaceBlock(customMobileNavigationMenu); 2816 2817 if (Model.Languages.Count > 1) 2818 { 2819 Block mobileNavigationLanguagesActionCustom = new Block 2820 { 2821 Id = "MobileNavigationLanguagesAction", 2822 SortId = 50, 2823 Template = RenderMobileNavigationLanguagesActionCustom() 2824 }; 2825 masterBlocksBlocksPage.ReplaceBlock(mobileNavigationLanguagesActionCustom); 2826 } 2827 2828 Block customSnippetJavascript = new Block 2829 { 2830 Id = "MasterJavascriptInitializers", 2831 SortId = 110, 2832 Template = RenderPrimaryBottomSnippetsCustom() 2833 }; 2834 2835 masterBlocksBlocksPage.ReplaceBlock(customSnippetJavascript); 2836 2837 Block masterDesktopActionsMenuLanguageSelectorCustom = new Block 2838 { 2839 Id = "MasterDesktopActionsMenuLanguageSelector", 2840 SortId = 40, 2841 Template = RenderLanguageSelectorCustom() 2842 }; 2843 masterBlocksBlocksPage.ReplaceBlock(masterDesktopActionsMenuLanguageSelectorCustom); 2844 2845 2846 2847 Block impersonationBarCustom = new Block() 2848 { 2849 Id = "ImpersonationBar", 2850 SortId = 50, 2851 Template = RenderImpersonationBarCustom(), 2852 Design = new Design() 2853 { 2854 Size = "auto-width", 2855 HidePadding = true, 2856 RenderType = RenderType.Column 2857 } 2858 }; 2859 masterBlocksBlocksPage.ReplaceBlock(impersonationBarCustom); 2860 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2861 { 2862 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 2863 { 2864 Block mobileNavigationMenuImpersonate = new Block 2865 { 2866 Id = "MobileNavigationMenuImpersonate", 2867 SortId = 60, 2868 Template = RenderMobileNavigationImpersonation() 2869 }; 2870 masterBlocksBlocksPage.Add("MobileNavigationActions", mobileNavigationMenuImpersonate); 2871 2872 } 2873 } 2874 2875 2876 2877 Block mobileHeaderMiniCartCustom = new Block() 2878 { 2879 Id = "MobileHeaderMiniCart", 2880 SortId = 20, 2881 Template = RenderMobileTopMiniCartCustom() 2882 }; 2883 masterBlocksBlocksPage.ReplaceBlock(mobileHeaderMiniCartCustom); 2884 Block mobileNavigationSavedCardsActionCustom = new Block 2885 { 2886 Id = "MobileNavigationSavedCardsAction", 2887 SortId = 30, 2888 Template = RenderMobileNavigationSavedCardsActionCustom() 2889 }; 2890 bottomSnippetsBlocksPage.ReplaceBlock(mobileNavigationSavedCardsActionCustom); 2891 2892 Block masterDesktopActionsMenuSignInCustom = new Block 2893 { 2894 Id = "MasterDesktopActionsMenuSignIn", 2895 SortId = 20, 2896 Template = RenderSignInCustom() 2897 }; 2898 masterBlocksBlocksPage.ReplaceBlock(masterDesktopActionsMenuSignInCustom); 2899 var headerNavigation = masterBlocksBlocksPage.GetBlockById("MasterDesktopMenu"); 2900 if (headerNavigation != null) 2901 { 2902 headerNavigation.Template = RenderDesktopMenuCustom(); 2903 } 2904 2905 } 2906 2907 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2908 2909 @using System 2910 @using System.Web 2911 @using System.Collections.Generic 2912 @using Dynamicweb.Rapido.Blocks.Extensibility 2913 @using Dynamicweb.Rapido.Blocks 2914 @using Dynamicweb.Frontend 2915 @using Dynamicweb.Data 2916 2917 @helper CustomRenderMiniCartHeader() 2918 { 2919 2920 bool hidePrice = false; 2921 2922 if (Pageview.User != null) 2923 { 2924 hidePrice = Convert.ToBoolean(Pageview.User.CustomFieldValues.Where(x => x.CustomField.SystemName == "AccessUser_HidePriceInICC").FirstOrDefault().Value); 2925 } 2926 <thead> 2927 <tr> 2928 <td>&nbsp;</td> 2929 <td>@Translate("Product")</td> 2930 <td class="u-ta-right">@Translate("Qty")</td> 2931 2932 @if (!hidePrice) 2933 { 2934 <td class="u-ta-right" width="120">@Translate("Price")</td> 2935 } 2936 </tr> 2937 </thead> 2938 } 2939 2940 @helper CustomRenderMiniCart() 2941 { 2942 bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 2943 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 2944 int cartPageId = GetPageIdByNavigationTag("CartPage"); 2945 var cartCalculationsFeedPageId = GetPageIdByNavigationTag("CartCalculationsFeed"); 2946 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2947 bool hidePrice = false; 2948 2949 if (Pageview.User != null) 2950 { 2951 hidePrice = Convert.ToBoolean(Pageview.User.CustomFieldValues.Where(x => x.CustomField.SystemName == "AccessUser_HidePriceInICC").FirstOrDefault().Value); 2952 } 2953 if (!onlyPreview && !navigationItemsHideCart) 2954 { 2955 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 2956 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod" : "menu__item menu__item--horizontal menu--clean dw-mod"; 2957 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 2958 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 2959 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue; 2960 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 2961 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 2962 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 2963 2964 int unitsCount = 0; 2965 var isCartEmpty = Model.Cart.IsEmpty; 2966 2967 2968 if (!isCartEmpty && hidePrice) 2969 { 2970 var orderlines = Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines; 2971 2972 if (orderlines.Count > 0) 2973 { 2974 foreach (var orderline in orderlines) 2975 { 2976 if (!string.IsNullOrEmpty(orderline.UnitId)) 2977 { 2978 2979 var productQuantity = orderline.Quantity; 2980 var productNumber = orderline.ProductNumber; 2981 var unitId = orderline.UnitId; 2982 var unit = 0; 2983 2984 try 2985 { 2986 if (unitId == "VO84") 2987 { 2988 var palletLoad = Database.ExecuteScalar(string.Format("SELECT PalletLoad FROM EcomProducts WHERE ProductNumber = '{0}' AND ProductLanguageId = 'LANG1'", productNumber)); 2989 var palletData = palletLoad.ToString(); 2990 var palletQuantityPerBox = Database.ExecuteScalar(string.Format("SELECT QuantityPerBox FROM EcomProducts WHERE ProductNumber = '{0}' AND ProductLanguageId = 'LANG1'", productNumber)); ; 2991 2992 unit = int.Parse(palletLoad.ToString()) * int.Parse(palletQuantityPerBox.ToString()); 2993 2994 } 2995 else if (unitId == "VO85") 2996 { 2997 var quantityPerBox = Database.ExecuteScalar(string.Format("SELECT QuantityPerBox FROM EcomProducts WHERE ProductNumber = '{0}'", productNumber)); 2998 2999 unit = int.Parse(quantityPerBox == null ? "1" : quantityPerBox.ToString()); 3000 } 3001 else if (unitId == "VO86") 3002 { 3003 var colliPerLayer = Database.ExecuteScalar(string.Format("SELECT ColliPerLayer FROM EcomProducts WHERE ProductNumber = '{0}'", productNumber)); 3004 var quantityPerBox = Database.ExecuteScalar(string.Format("SELECT QuantityPerBox FROM EcomProducts WHERE ProductNumber = '{0}'", productNumber)); 3005 unit = int.Parse(colliPerLayer.ToString()) * int.Parse(quantityPerBox.ToString()); 3006 } 3007 else 3008 { 3009 unit = 1; 3010 } 3011 } 3012 catch (Exception) 3013 { 3014 unit = 1; 3015 } 3016 //var colliPerLayer = orderline.UnitId != "VO53" ? Database.ExecuteScalar(string.Format("SELECT ColliPerLayer FROM EcomProducts WHERE ProductNumber = '{0}'", productNumber)) : "1"; 3017 //var quantityPerBox = Database.ExecuteScalar(string.Format("SELECT QuantityPerBox FROM EcomProducts WHERE ProductNumber = '{0}'", productNumber)); 3018 //var unit = int.Parse(colliPerLayer.ToString()) * int.Parse(quantityPerBox.ToString()); 3019 3020 int temp = 0; 3021 int.TryParse(productQuantity.ToString(), out temp); 3022 3023 unitsCount += temp / unit; 3024 } 3025 else 3026 { 3027 int temp = 0; 3028 int.TryParse(orderline.Quantity.ToString(), out temp); 3029 3030 unitsCount += temp; 3031 } 3032 3033 } 3034 } 3035 cartProductsCount = unitsCount.ToString(); 3036 if (showPrice && counterPosition == "right") 3037 { 3038 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 3039 } 3040 } 3041 3042 <li class="@liClasses" id="miniCartWrapper" @*onmouseenter="TopBrandsApi.UpdateMiniCartCustom('miniCartWrapper', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"*@> 3043 <div class="mini-cart dw-mod"> 3044 <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="@menuLinkClass menu__link--icon dw-mod js-mini-cart-button"> 3045 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 3046 <div class="mini-cart__counter dw-mod"> 3047 <div class="js-handlebars-root js-mini-cart-counter js-mini-cart" id="cartCounter" data-template="MiniCartCounterContent" data-cart-id="@miniCartFeedPageId" data-cart-calculations-id="@cartCalculationsFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=Counter" data-init-onload="false" data-preloader="false"> 3048 <div class="js-mini-cart-counter-content u-ta-right"> 3049 @if (hidePrice) 3050 { 3051 <div class="mini-cart-total">@cartProductsCount</div> 3052 } 3053 else 3054 { 3055 if (Model.Cart.TotalPrice != null) 3056 { 3057 <div class="mini-cart-total" style="font-size:11px; width:120px;">@Model.Cart.TotalPrice.PriceWithoutVat.Formatted</div> 3058 } 3059 } 3060 3061 </div> 3062 </div> 3063 </div> 3064 </a> 3065 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3066 { 3067 <div class="mini-cart-dropdown js-handlebars-root js-mini-cart dw-mod" id="miniCart" data-template="MiniCartContent" data-cart-calculations-id="@cartCalculationsFeedPageId" data-cart-id="@miniCartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 3068 } 3069 </div> 3070 </li> 3071 } 3072 } 3073 3074 @helper CustomRenderMiniCartScriptTemplates() 3075 { 3076 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 3077 3078 int cartPageId = GetPageIdByNavigationTag("CartPage"); 3079 bool showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 3080 showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue == "right" ? showPriceInMiniCartCounter : false; 3081 showPriceInMiniCartCounter = Pageview.Device.ToString() == "Mobile" ? false : showPriceInMiniCartCounter; 3082 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 3083 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 3084 string addingToCartNotification = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 3085 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3086 3087 3088 bool hidePrice = false; 3089 3090 if (Pageview.User != null) 3091 { 3092 hidePrice = Convert.ToBoolean(Pageview.User.CustomFieldValues.Where(x => x.CustomField.SystemName == "AccessUser_HidePriceInICC").FirstOrDefault().Value); 3093 } 3094 3095 3096 <script id="MiniCartCounterContent" type="text/x-template"> 3097 {{#.}} 3098 <div class="js-mini-cart-counter-content dw-mod u-ta-right"> 3099 @if (showPriceInMiniCartCounter) 3100 { 3101 @Translate("Cart")<text>({{totalUnits}}) {{totalprice}}</text> 3102 } 3103 else 3104 { 3105 if (hidePrice) 3106 { 3107 <text>{{totalUnits}}</text> 3108 } 3109 else 3110 { 3111 <text><div class="mini-cart-total" style="font-size:11px; width:120px;">{{totalprice}} </div></text> 3112 } 3113 3114 3115 } 3116 </div> 3117 {{/.}} 3118 </script> 3119 3120 <script id="MiniCartContent" type="text/x-template"> 3121 {{#.}} 3122 @if (useGoogleTagManager) 3123 { 3124 <text>{{{useGoogleTagManager OrderLines}}}</text> 3125 } 3126 <div class="mini-cart-dropdown__inner {{isempty}} dw-mod"> 3127 <h4 class="u-ta-center u-no-margin u-margin-bottom u-margin-top">@Translate("Shopping cart")</h4> 3128 <div class="mini-cart-dropdown__body dw-mod"> 3129 <table class="table mini-cart-table dw-mod"> 3130 @RenderBlockList(subBlocks) 3131 </table> 3132 </div> 3133 3134 <table class="table mini-cart-table dw-mod"> 3135 <tr class="mini-cart-orderlines__footer dw-mod"> 3136 <td colspan="2"><button type="button" class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" onclick="document.getElementById('ConfirmationEmpty').checked = true">@Translate("Empty cart")</button></td> 3137 @if (!hidePrice) 3138 { 3139 <text> 3140 {{#if isBelow}} 3141 <td colspan="2" id="minAmount" class="minAmountText">@Translate("The minimum order is not reached")</td> 3142 {{else}} 3143 <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> 3144 {{/if}} 3145 </text> 3146 } 3147 </tr> 3148 </table> 3149 </div> 3150 {{/.}} 3151 </script> 3152 3153 <script id="MiniCartOrderline" type="text/x-template"> 3154 <tr class="{{isempty}}"> 3155 <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> 3156 <td> 3157 <a href="{{link}}" class="mini-cart-orderlines__name" title="{{name}}">{{name}}</a> 3158 {{#if variantname}} 3159 <a href="{{link}}" class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{variantname}}</a> 3160 {{/if}} 3161 {{#if unitname}} 3162 <div class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{unitname}}</div> 3163 {{/if}} 3164 </td> 3165 <td class="u-ta-right">{{unitsCount}}</td> 3166 @if (!hidePrice) 3167 { 3168 <td class="u-ta-right"> 3169 {{#if pointsTotal}} 3170 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 3171 {{else}} 3172 {{totalprice}} 3173 {{/if}} 3174 </td> 3175 } 3176 </tr> 3177 </script> 3178 3179 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 3180 <tr class="table__row--no-border {{isempty}}"> 3181 <td>&nbsp;</td> 3182 <td><div class="mini-cart-orderlines__name dw-mod">{{name}}</div></td> 3183 <td class="u-ta-right">&nbsp;</td> 3184 <td class="u-ta-right">{{totalprice}}</td> 3185 </tr> 3186 </script> 3187 3188 if (!onlyPreview && addingToCartNotification == "modal") 3189 { 3190 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 3191 3192 <script id="LastAddedProductTemplate" type="text/x-template"> 3193 <!-- Trigger for the login modal --> 3194 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> 3195 3196 <!-- Login modal --> 3197 <div class="modal-container"> 3198 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> 3199 <div class="modal modal--md"> 3200 <div class="modal__header"> 3201 <h2>@Translate("Product is added to the cart")</h2> 3202 </div> 3203 <div class="modal__body"> 3204 <div class="grid"> 3205 <div class="grid__col-2"> 3206 <a href="{{productInfo.link}}"> 3207 <img src="{{productInfo.image}}" alt="{{productInfo.name}}" class="dw-mod" /> 3208 </a> 3209 </div> 3210 <div class="u-padding grid--align-self-center"> 3211 <span>{{addedQuantity}}</span> x 3212 </div> 3213 <div class="grid__col-auto grid--align-self-center"> 3214 <div>{{productInfo.name}}</div> 3215 {{#if productInfo.variantName}} 3216 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 3217 {{/if}} 3218 {{#if productInfo.unitName}} 3219 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 3220 {{/if}} 3221 </div> 3222 </div> 3223 <div class="modal__footer u-margin-top--lg"> 3224 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> 3225 <a href="/Default.aspx?ID=@GetPageIdByNavigationTag("CartPage")" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a> 3226 </div> 3227 </div> 3228 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> 3229 </div> 3230 </div> 3231 </script> 3232 <script> 3233 document.addEventListener('addToCart', function (event) { 3234 Cart.ShowLastAddedProductModal(event.detail); 3235 }); 3236 </script> 3237 } 3238 else if (!onlyPreview && addingToCartNotification == "toggle") 3239 { 3240 <script> 3241 document.addEventListener('addToCart', function () { 3242 Cart.ToggleMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 3243 }); 3244 </script> 3245 } 3246 <input type="checkbox" id="ConfirmationEmpty" class="modal-trigger" /> 3247 <!-- Cart selector modal --> 3248 <div class="modal-container"> 3249 <label for="ConfirmationEmpty" id="ConfirmationOverlay" class="modal-overlay" onclick="event.preventDefault();"></label> 3250 <div class="modal modal--sm" id="EmptyCartModal"> 3251 <div class="modal__header"> 3252 <h2>@Translate("Confirmation")</h2> 3253 </div> 3254 <div class="modal__body"> 3255 <div class="grid__col-12 grid--align-self-center"> 3256 @Translate("Do you want to empty your cart?") 3257 </div> 3258 <div class="modal__footer"> 3259 <input type='button' class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" value='@Translate("Yes")' id='btnYes' onclick="googleEnchantImpressionEmptyCart();document.getElementById('ConfirmationEmpty').checked = false;window.location.href='/Default.aspx?ID=@GetPageIdByNavigationTag("CartPage")&cartcmd=emptycart'" /> 3260 <input type='button' class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm" value='@Translate("No")' id='btnNo' onclick="document.getElementById('ConfirmationEmpty').checked = false" /> 3261 </div> 3262 </div> 3263 <label class="modal__close-btn" for="ConfirmationEmpty"></label> 3264 </div> 3265 </div> 3266 3267 <input type="checkbox" id="ConfirmationRemove" class="modal-trigger" /> 3268 <!-- Cart selector modal --> 3269 <div class="modal-container"> 3270 <label for="ConfirmationRemove" id="RemoveOverlay" class="modal-overlay" onclick="event.preventDefault();"></label> 3271 <div class="modal modal--sm" id="RemoveCartModal"> 3272 <div class="modal__header"> 3273 <h2>@Translate("Confirmation")</h2> 3274 </div> 3275 <div class="modal__body"> 3276 <div class="grid__col-12 grid--align-self-center"> 3277 @Translate("Do you want to remove the cart?") 3278 </div> 3279 <div class="modal__footer"> 3280 <input type='button' class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" value='@Translate("Yes")' id='btnRemoveYes' /> 3281 <input type='button' class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm" value='@Translate("No")' id='btnRemoveNo' onclick="document.getElementById('ConfirmationRemove').checked = false" /> 3282 </div> 3283 </div> 3284 <label class="modal__close-btn" for="ConfirmationRemove"></label> 3285 </div> 3286 </div> 3287 } 3288 3289 @helper CustomRenderMiniCartTotal() 3290 { 3291 3292 3293 bool hidePrice = false; 3294 3295 if (Pageview.User != null) 3296 { 3297 hidePrice = Convert.ToBoolean(Pageview.User.CustomFieldValues.Where(x => x.CustomField.SystemName == "AccessUser_HidePriceInICC").FirstOrDefault().Value); 3298 } 3299 3300 if (!hidePrice) 3301 { 3302 <tr class="mini-cart-totals dw-mod"> 3303 <td colspan="2">@Translate("Total")</td> 3304 <td class="u-ta-right">{{totalUnits}}</td> 3305 <td class="u-ta-right" width="130">{{totalprice}}</td> 3306 </tr> 3307 <text> 3308 {{#if isBelow}} 3309 <tr class="mini-cart-totals dw-mod min-amount"> 3310 <td colspan="2">@Translate("Minimum amount")</td> 3311 <td class="u-ta-right"></td> 3312 <td class="u-ta-right" width="130">- {{minimumOrderValue}}</td> 3313 </tr> 3314 {{/if}} 3315 </text> 3316 } 3317 } 3318 3319 @helper CustomRenderMiniCartFees() 3320 { 3321 if (Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideFreeServices") != true) 3322 { 3323 <tr> 3324 <td><i class="fas fa-credit-card"></i></td> 3325 <td>{{paymentmethod}}</td> 3326 <td colspan="2" class="u-ta-right" width="130">{{paymentfee}}</td> 3327 </tr> 3328 <tr> 3329 <td><i class="fas fa-truck"></i></td> 3330 <td>{{shippingmethod}}</td> 3331 <td colspan="2" class="u-ta-right" width="130">{{shippingfee}}</td> 3332 </tr> 3333 } 3334 } 3335 @helper CustomRenderSearchBar(string alignment = "left") 3336 { 3337 string searchFeedId = ""; 3338 string searchSecondFeedId = ""; 3339 int groupsFeedId; 3340 3341 string productPageNavigationTag = "ProductsPage"; 3342 if (Model.CurrentUser.ID > 0) 3343 { 3344 productPageNavigationTag = (Pageview.User.Groups.Any(x => x.Name.ToLower() == "topbrands scandinavia")) ? "ProductsPageSC" : "ProductsPage"; 3345 } 3346 3347 int productsPageId = GetPageIdByNavigationTag(productPageNavigationTag); 3348 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 3349 string resultPageLink; 3350 string searchPlaceholder; 3351 string searchType = "product-search"; 3352 string searchTemplate; 3353 string searchContentTemplate = ""; 3354 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 3355 bool showGroups = true; 3356 3357 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 3358 { 3359 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3360 resultPageLink = contentSearchPageLink; 3361 searchPlaceholder = Translate("Search page"); 3362 groupsFeedId = 0; 3363 searchType = "content-search"; 3364 searchTemplate = "SearchPagesTemplate"; 3365 showGroups = false; 3366 } 3367 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 3368 { 3369 searchFeedId = productsPageId + "&feed=true"; 3370 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3371 resultPageLink = Converter.ToString(productsPageId); 3372 searchPlaceholder = Translate("Search products or pages"); 3373 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3374 searchType = "combined-search"; 3375 searchTemplate = "SearchProductsTemplateWrap"; 3376 searchContentTemplate = "SearchPagesTemplateWrap"; 3377 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3378 } 3379 else 3380 { 3381 resultPageLink = Converter.ToString(productsPageId); 3382 searchFeedId = productsPageId + "&feed=true"; 3383 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3384 searchPlaceholder = Translate("Search products"); 3385 searchTemplate = "SearchProductsTemplate"; 3386 searchType = "product-search"; 3387 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3388 } 3389 3390 <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"> 3391 @if (showGroups) 3392 { 3393 <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> 3394 <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> 3395 } 3396 <div class="typeahead-search-field"> 3397 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@searchPlaceholder" value="@searchValue"> 3398 @if (string.IsNullOrEmpty(searchSecondFeedId)) 3399 { 3400 <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> 3401 } 3402 else 3403 { 3404 <div class="dropdown dropdown--absolute-position dropdown--combined grid @(alignment == "right" ? "dropdown--right-aligned" : "")"> 3405 <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> 3406 <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> 3407 </div> 3408 } 3409 </div> 3410 <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> 3411 </div> 3412 } 3413 3414 @helper CustomRenderMiniSearch() 3415 { 3416 string searchFeedId = ""; 3417 string searchSecondFeedId = ""; 3418 int groupsFeedId; 3419 3420 string productPageNavigationTag = "ProductsPage"; 3421 if (Model.CurrentUser.ID > 0) 3422 { 3423 productPageNavigationTag = (Pageview.User.Groups.Any(x => x.Name.ToLower() == "topbrands scandinavia")) ? "ProductsPageSC" : "ProductsPage"; 3424 } 3425 int productsPageId = GetPageIdByNavigationTag(productPageNavigationTag); 3426 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 3427 string resultPageLink; 3428 string searchPlaceholder; 3429 string searchType = "product-search"; 3430 string searchTemplate; 3431 string searchContentTemplate = ""; 3432 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 3433 bool showGroups = true; 3434 3435 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 3436 { 3437 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3438 resultPageLink = contentSearchPageLink; 3439 searchPlaceholder = Translate("Search page"); 3440 groupsFeedId = 0; 3441 searchType = "content-search"; 3442 searchTemplate = "SearchPagesTemplate"; 3443 showGroups = false; 3444 } 3445 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 3446 { 3447 searchFeedId = productsPageId + "&feed=true"; 3448 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3449 resultPageLink = Converter.ToString(productsPageId); 3450 searchPlaceholder = Translate("Search products or pages"); 3451 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3452 searchType = "combined-search"; 3453 searchTemplate = "SearchProductsTemplateWrap"; 3454 searchContentTemplate = "SearchPagesTemplateWrap"; 3455 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3456 } 3457 else 3458 { 3459 resultPageLink = Converter.ToString(productsPageId); 3460 searchFeedId = productsPageId + "&feed=true"; 3461 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3462 searchPlaceholder = Translate("Search products"); 3463 searchTemplate = "SearchProductsTemplate"; 3464 searchType = "product-search"; 3465 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3466 } 3467 3468 <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()"> 3469 <div class="menu__link menu__link--icon dw-mod"> 3470 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 3471 </div> 3472 <div class="menu menu--dropdown u-w380px top-micro-search dw-mod"> 3473 <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"> 3474 <div class="typeahead-search-field"> 3475 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@searchPlaceholder" value="@searchValue"> 3476 @if (string.IsNullOrEmpty(searchSecondFeedId)) 3477 { 3478 <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> 3479 } 3480 else 3481 { 3482 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 3483 <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> 3484 <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> 3485 </div> 3486 } 3487 </div> 3488 </div> 3489 </div> 3490 </li> 3491 } 3492 @helper RenderImpersonationBarCustom() 3493 { 3494 int impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 3495 3496 <div class="u-color-warning--bg"> 3497 <div class="center-container top-container__center-container dw-mod"> 3498 @*Impersonation*@ 3499 <div class="grid"> 3500 <div class="grid--align-self-center grid__col-x"> 3501 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 3502 { 3503 string stopImpersonateTranslation = Translate("Stop impersonation"); 3504 string username = ""; 3505 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName)) 3506 { 3507 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName; 3508 } 3509 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name)) 3510 { 3511 username = Model.CurrentSecondaryUser.Name; 3512 } 3513 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email)) 3514 { 3515 username = Model.CurrentSecondaryUser.Email; 3516 } 3517 else 3518 { 3519 username = Model.CurrentSecondaryUser.UserName; 3520 } 3521 <div class="grid-cell"> 3522 <div class="u-pull--left u-bold u-margin-top"> 3523 <i class="fas fa-user-secret"></i> 3524 @username<text>&nbsp;</text>@Translate("is impersonating")<text>&nbsp;</text>@Pageview.User.UserName 3525 </div> 3526 <form method="post" class="u-pull--right u-no-margin"> 3527 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation"> 3528 </form> 3529 </div> 3530 } 3531 else 3532 { 3533 string viewListTranslation = Translate("View the list of users you can impersonate"); 3534 <div class="grid-cell u-bold"> 3535 <i class="fas fa-user-secret"></i> 3536 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a> 3537 </div> 3538 } 3539 </div> 3540 </div> 3541 </div> 3542 </div> 3543 } 3544 @helper RenderLanguageSelectorCustom() 3545 { 3546 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3547 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"; 3548 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 3549 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() : ""; 3550 var user = Dynamicweb.Security.UserManagement.User.get_Current(Dynamicweb.Security.UserManagement.PagePermissionLevels.Frontend); 3551 var userLang = ""; 3552 var userGroup = ""; 3553 if (user != null && user.Groups != null) 3554 { 3555 userGroup = user.Groups.Any(x => x.Name.ToLower() == "topbrands europe") ? "EU" : "SC"; 3556 userLang = user.Country; 3557 } 3558 if (Model.Languages.Count > 1) 3559 { 3560 <li class="@liClasses is-dropdown is-dropdown--no-icon"> 3561 <div class="@menuLinkClass menu__link--icon dw-mod"> 3562 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 3563 </div> 3564 <div class="menu menu--dropdown dw-mod"> 3565 @{ 3566 string[] notAllowedLangs = null; 3567 if (userGroup.Equals("SC", StringComparison.OrdinalIgnoreCase)) 3568 { 3569 notAllowedLangs = new[] { "Dutch", "German", "French", "Polish", "Italy","Spanish"}; 3570 } 3571 else 3572 { 3573 notAllowedLangs = new[] { "Swedish", "Danish", "Italy"}; 3574 } 3575 foreach (var lang in Model.Languages) 3576 { 3577 if (notAllowedLangs != null && notAllowedLangs.Contains(lang.Name)) 3578 { 3579 continue; 3580 } 3581 3582 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 3583 3584 if (languageViewType == "flag") 3585 { 3586 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + "\"></span>"; 3587 } 3588 3589 if (languageViewType == "name") 3590 { 3591 langInfo = lang.Name; 3592 } 3593 3594 <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> 3595 3596 } 3597 } 3598 3599 </div> 3600 </li> 3601 } 3602 } 3603 @helper RenderSignInCustom() 3604 { 3605 /**/ 3606 3607 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 3608 string userInitials = ""; 3609 int pageId = Model.TopPage.ID; 3610 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 3611 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 3612 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 3613 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 3614 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 3615 int mySavedCartsPageId = GetPageIdByNavigationTag("SavedShoppingCarts"); 3616 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3617 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 3618 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 3619 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 3620 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 3621 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 3622 var user = Dynamicweb.Security.UserManagement.User.get_Current(Dynamicweb.Security.UserManagement.PagePermissionLevels.Frontend); 3623 3624 string linkStart = "/Default.aspx?ID="; 3625 if (Model.CurrentUser.ID <= 0) 3626 { 3627 linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; 3628 } 3629 3630 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 3631 string myProfilePageLink = linkStart + myProfilePageId; 3632 string myOrdersPageLink = linkStart + myOrdersPageId; 3633 string myFavoritesPageLink = linkStart + myFavoritesPageId; 3634 string mySavedCartsPageLink = linkStart + mySavedCartsPageId; 3635 bool isNeedValidation = false; 3636 if (user != null) 3637 { 3638 if (user.CustomFieldValues.FirstOrDefault(fv => fv.CustomField.SystemName == "AccessUser_CartValidationNeeded").Value != null && !String.IsNullOrEmpty(user.CustomFieldValues.FirstOrDefault(fv => fv.CustomField.SystemName == "AccessUser_CartValidationNeeded").Value.ToString())) 3639 { 3640 isNeedValidation = Convert.ToBoolean(user.CustomFieldValues.FirstOrDefault(fv => fv.CustomField.SystemName == "AccessUser_CartValidationNeeded").Value); 3641 3642 } 3643 } 3644 if (Model.CurrentUser.ID != 0) 3645 { 3646 if (!String.IsNullOrEmpty(Model.CurrentUser.Name)) 3647 { 3648 //Fix for tailing whitespace bug 3649 string currentUserName = Model.CurrentUser.Name.Trim(); 3650 string[] names = currentUserName.Split(' '); 3651 userInitials += currentUserName.Substring(0, 1); 3652 3653 if (names.Length > 1) 3654 { 3655 userInitials += names[names.Length - 1].Substring(0, 1); 3656 } 3657 } 3658 else 3659 { 3660 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : ""; 3661 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : ""; 3662 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : ""; 3663 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : ""; 3664 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : ""; 3665 } 3666 } 3667 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3668 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 3669 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"; 3670 var savedShoppingCartsPageId = GetPageIdByNavigationTag("SavedShoppingCarts"); 3671 if (isNeedValidation) 3672 { 3673 <li class="@liClasses"> 3674 <div class="header-menu__link menu__link--icon dw-mod"> 3675 <a href="/default.aspx?ID=@savedShoppingCartsPageId"> 3676 <i class="fas fa-exclamation-triangle" aria-hidden="true" style="color:#f50;font-size:20px;" title="@Translate("Need validation on the carts")"></i> 3677 <a /> 3678 </div> 3679 </li> 3680 } 3681 if (!navigationItemsHideSignIn) 3682 { 3683 3684 <li class="@liClasses is-dropdown is-dropdown--no-icon"> 3685 <div class="@menuLinkClass menu__link--icon dw-mod"> 3686 @if (Model.CurrentUser.ID <= 0) 3687 { 3688 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i> 3689 } 3690 else 3691 { 3692 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 3693 } 3694 </div> 3695 <div class="menu menu--dropdown sign-in-dropdown dw-mod"> 3696 <ul class="list list--clean dw-mod"> 3697 @if (Model.CurrentUser.ID <= 0) 3698 { 3699 <li> 3700 <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> 3701 </li> 3702 if (!hideCreateAccountLink) 3703 { 3704 <li> 3705 <a href="/default.aspx?ID=@createAccountPageId" class="list__link dw-mod">@Translate("Create account")</a> 3706 </li> 3707 } 3708 <li> 3709 <a href="@forgotPasswordPageLink" class="list__link dw-mod">@Translate("Forgot your password?")</a> 3710 </li> 3711 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 3712 { 3713 <li class="list__seperator dw-mod"></li> 3714 } 3715 } 3716 @if (!hideMyProfileLink) 3717 { 3718 <li> 3719 <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> 3720 </li> 3721 } 3722 @if (!hideMyOrdersLink) 3723 { 3724 <li> 3725 <a href="@myOrdersPageLink" class="list__link dw-mod"><i class="fas fa-list u-margin-right"></i>@Translate("My Orders")</a> 3726 </li> 3727 } 3728 @if (!hideMyFavoritesLink) 3729 { 3730 <li> 3731 <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> 3732 </li> 3733 } 3734 @if (!hideMySavedCardsLink) 3735 { 3736 <li> 3737 <a href="@mySavedCartsPageLink" class="list__link dw-mod"><i class="fas fa-shopping-cart u-margin-right"></i>@Translate("My Saved Carts") @if (isNeedValidation) 3738 {<i class="fas fa-exclamation-triangle" aria-hidden="true" style="color:#f50;font-size:16px;" title="@Translate("Need validation on the carts")"></i>}</a> 3739 </li> 3740 } 3741 @if (Model.CurrentUser.ID > 0) 3742 { 3743 var areaService = new Dynamicweb.Content.AreaService(); 3744 3745 int globalAreaId = Dynamicweb.Frontend.PageView.Current().Area.ID; 3746 var masterArea = areaService.GetArea(globalAreaId).MasterArea; 3747 var masterAreaId = masterArea != null ? masterArea.ID : globalAreaId; 3748 var areas = areaService.GetArea(masterAreaId).Languages; 3749 var userLang = Pageview.User != null ? Dynamicweb.Security.UserManagement.User.GetCurrentUser().Country.ToString().ToUpper() : ""; 3750 3751 if (string.IsNullOrEmpty(Dynamicweb.Security.UserManagement.User.GetCurrentUser().Country.ToString())) 3752 { 3753 userLang = "en"; 3754 } 3755 3756 bool haveLang = areas.Any(x => x.Culture.Contains(userLang)); 3757 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 3758 { 3759 <li class="list__seperator dw-mod"></li> 3760 } 3761 if (!haveLang) 3762 { 3763 <li> 3764 <a href="/logout-page" class="list__link dw-mod">@Translate("Sign out")</a> 3765 </li> 3766 } 3767 else 3768 { 3769 <li> 3770 <a href="/@userLang/logout-page" class="list__link dw-mod">@Translate("Sign out")</a> 3771 </li> 3772 } 3773 3774 3775 } 3776 </ul> 3777 </div> 3778 </li> 3779 } 3780 } 3781 3782 3783 @helper CustomRenderSearchScriptTemplates() 3784 { 3785 3786 string productPageNavigationTag = "ProductsPage"; 3787 var hidePrice = false; 3788 if (Model.CurrentUser.ID > 0) 3789 { 3790 productPageNavigationTag = (Pageview.User.Groups.Any(x => x.Name.ToLower() == "topbrands scandinavia")) ? "ProductsPageSC" : "ProductsPage"; 3791 3792 hidePrice = Convert.ToBoolean(Pageview.User.CustomFieldValues.Where(x => x.CustomField.SystemName == "AccessUser_HidePriceInICC").FirstOrDefault().Value); 3793 } 3794 3795 int productsPageId = GetPageIdByNavigationTag(productPageNavigationTag); 3796 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 3797 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 3798 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 3799 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 3800 bool isDigitalWarehouse = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("EnableDigitalWarehouse"); 3801 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 3802 var strStockHeader = Translate("Stock Validation"); 3803 var strStockErrorMsg = Translate("Less units in stock than what you request") + "<br/><br/>" + Translate("There is") + ": [[amount]] " + Translate("of your selected units available"); 3804 3805 var minimumOrderlineValueTitle = Translate("Minimum value"); 3806 var minimumOrderlineValueError = Translate("The minimum order value of") + " [[amount]] " + Translate("for this product has not been reached, please increase quantity"); 3807 <script id="SearchGroupsTemplate" type="text/x-template"> 3808 {{#.}} 3809 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 3810 {{/.}} 3811 </script> 3812 3813 <script id="SearchProductsTemplate" type="text/x-template"> 3814 {{#each .}} 3815 {{#Product}} 3816 {{#ifCond template "!==" "SearchMore"}} 3817 <li class="dropdown__item dropdown__item--seperator dw-mod"> 3818 @if (useFacebookPixel) 3819 { 3820 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 3821 } 3822 @if (useGoogleTagManager) 3823 { 3824 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 3825 } 3826 <div> 3827 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 3828 <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> 3829 <div class="u-pull--left"> 3830 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 3831 @if (!onlyPreview && !hidePrice) 3832 { 3833 if (pointShopOnly) 3834 { 3835 <text> 3836 {{#if havePointPrice}} 3837 <div> 3838 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 3839 </div> 3840 {{else}} 3841 <small class="help-text u-no-margin">@Translate("Not available")</small> 3842 {{/if}} 3843 {{#unless canBePurchasedWithPoints}} 3844 {{#if havePointPrice}} 3845 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 3846 {{/if}} 3847 {{/unless}} 3848 </text> 3849 } 3850 else 3851 { 3852 <div class="grid--direction-row"> 3853 <div class="u-inline">{{price}}</div> 3854 <div class="item-number u-inline dw-mod">{{unitPriceFormatted}} / {{selectedUnitName}}</div> 3855 </div> 3856 } 3857 } 3858 </div> 3859 </a> 3860 <div class="u-margin-left u-pull--right"> 3861 @if (!onlyPreview) 3862 { 3863 if (pointShopOnly) 3864 { 3865 <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" 3866 onclick="TopBrandsApi.addProductsToCart(event, { 3867 userMinimumOrderlineValue: '{{userMinimumOrderlineValue}}', 3868 orderlineValueErrorMsg: '@minimumOrderlineValueError', 3869 minimumOrderlineValueTitle: '@minimumOrderlineValueTitle', 3870 price: '{{unitPrice}}', 3871 currency: '{{currency}}', 3872 id: '{{productId}}', 3873 variantId: '{{variantid}}', 3874 unitId: '{{unitId}}', 3875 quantity: document.getElementById('Quantity_{{id}}').value, 3876 productInfo: {{productInfo}}, 3877 unitQuantity: '{{unitQuantity}}', 3878 stock: '{{stock}}', 3879 stockInUnits: '{{stockInUnits}}', 3880 userMaximumStockAmount: '{{userMaximumStockAmount}}', 3881 stockHeader: '@strStockHeader', 3882 stockErrorMsg: '@strStockErrorMsg' 3883 }, '@(hidePrice ? "true" : "false")'); {{facebookPixelAction}}" {{disabledBuyButton}}> 3884 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 3885 </button> 3886 } 3887 else 3888 { 3889 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 3890 onclick="TopBrandsApi.addProductsToCart(event, { 3891 userMinimumOrderlineValue: '{{userMinimumOrderlineValue}}', 3892 orderlineValueErrorMsg: '@minimumOrderlineValueError', 3893 minimumOrderlineValueTitle: '@minimumOrderlineValueTitle', 3894 price: '{{unitPrice}}', 3895 currency: '{{currency}}', 3896 id: '{{productId}}', 3897 variantId: '{{variantid}}', 3898 unitId: '{{unitId}}', 3899 quantity: document.getElementById('Quantity_{{id}}').value, 3900 productInfo: {{productInfo}}, 3901 unitQuantity: '{{unitQuantity}}', 3902 stock: '{{stock}}', 3903 stockInUnits: '{{stockInUnits}}', 3904 userMaximumStockAmount: '{{userMaximumStockAmount}}', 3905 stockHeader: '@strStockHeader', 3906 stockErrorMsg: '@strStockErrorMsg' 3907 }, '@(hidePrice ? "true" : "false")'); {{facebookPixelAction}}" {{disabledBuyButton}}> 3908 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 3909 </button> 3910 } 3911 <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> 3912 } 3913 else if (isDigitalWarehouse) 3914 { 3915 <a class="btn btn--primary u-no-margin btn--condensed dw-mod" href="{{listLink}}"><i class="fas {{listIcon}}"></i></a> 3916 } 3917 else 3918 { 3919 <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> 3920 } 3921 </div> 3922 </div> 3923 </li> 3924 {{/ifCond}} 3925 {{#ifCond template "===" "SearchMore"}} 3926 {{>SearchMoreProducts}} 3927 {{/ifCond}} 3928 {{/Product}} 3929 {{else}} 3930 <li class="dropdown__item dropdown__item--seperator dw-mod"> 3931 @Translate("Your search gave 0 results") 3932 </li> 3933 {{/each}} 3934 </script> 3935 3936 <script id="SearchMoreProducts" type="text/x-template"> 3937 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 3938 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 3939 @Translate("View all") 3940 </a> 3941 </li> 3942 </script> 3943 3944 <script id="SearchMorePages" type="text/x-template"> 3945 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 3946 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 3947 @Translate("View all") 3948 </a> 3949 </li> 3950 </script> 3951 3952 <script id="SearchPagesTemplate" type="text/x-template"> 3953 {{#each .}} 3954 {{#ifCond template "!==" "SearchMore"}} 3955 <li class="dropdown__item dropdown__item--seperator dw-mod"> 3956 <div> 3957 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 3958 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 3959 <div class="u-pull--left"> 3960 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 3961 </div> 3962 </a> 3963 </div> 3964 </li> 3965 {{/ifCond}} 3966 {{#ifCond template "===" "SearchMore"}} 3967 {{>SearchMorePages}} 3968 {{/ifCond}} 3969 {{else}} 3970 <li class="dropdown__item dropdown__item--seperator dw-mod"> 3971 @Translate("Your search gave 0 results") 3972 </li> 3973 {{/each}} 3974 </script> 3975 3976 <script id="SearchPagesTemplateWrap" type="text/x-template"> 3977 <div class="dropdown__column-header">@Translate("Pages")</div> 3978 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 3979 {{>SearchPagesTemplate}} 3980 </ul> 3981 </script> 3982 3983 <script id="SearchProductsTemplateWrap" type="text/x-template"> 3984 <div class="dropdown__column-header">@Translate("Products")</div> 3985 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 3986 {{>SearchProductsTemplate}} 3987 </ul> 3988 </script> 3989 } 3990 @helper CustomRenderMobileTopSearchBar() 3991 { 3992 string searchFeedId = ""; 3993 string searchSecondFeedId = ""; 3994 int groupsFeedId; 3995 3996 string prodNavigationTag = "ProductsPage"; 3997 if (Model.CurrentUser.ID > 0) 3998 { 3999 prodNavigationTag = (Pageview.User.Groups.Any(x => x.Name.ToLower() == "topbrands scandinavia")) ? "ProductsPageSC" : "ProductsPage"; 4000 } 4001 int productsPageId = GetPageIdByNavigationTag(prodNavigationTag); 4002 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 4003 string resultPageLink; 4004 string searchPlaceholder; 4005 string searchType = "product-search"; 4006 string searchTemplate; 4007 string searchContentTemplate = ""; 4008 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 4009 bool showGroups = true; 4010 4011 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 4012 { 4013 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 4014 resultPageLink = contentSearchPageLink; 4015 searchPlaceholder = Translate("Search page"); 4016 groupsFeedId = 0; 4017 searchType = "content-search"; 4018 searchTemplate = "SearchPagesTemplate"; 4019 showGroups = false; 4020 } 4021 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 4022 { 4023 searchFeedId = productsPageId + "&feed=true"; 4024 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 4025 resultPageLink = Converter.ToString(productsPageId); 4026 searchPlaceholder = Translate("Search products or pages"); 4027 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 4028 searchType = "combined-search"; 4029 searchTemplate = "SearchProductsTemplateWrap"; 4030 searchContentTemplate = "SearchPagesTemplateWrap"; 4031 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 4032 } 4033 else 4034 { 4035 resultPageLink = Converter.ToString(productsPageId); 4036 searchFeedId = productsPageId + "&feed=true"; 4037 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 4038 searchPlaceholder = Translate("Search products"); 4039 searchTemplate = "SearchProductsTemplate"; 4040 searchType = "product-search"; 4041 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 4042 } 4043 4044 4045 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 4046 4047 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 4048 <div class="center-container top-container__center-container dw-mod"> 4049 <div class="grid"> 4050 <div class="grid__col-auto"> 4051 <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"> 4052 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 4053 @if (string.IsNullOrEmpty(searchSecondFeedId)) 4054 { 4055 <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> 4056 } 4057 else 4058 { 4059 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 4060 <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> 4061 <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> 4062 </div> 4063 } 4064 <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> 4065 </div> 4066 </div> 4067 <div class="grid__col-auto-width"> 4068 <ul class="menu dw-mod"> 4069 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 4070 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 4071 <i class="fas fa-times fa-1_5x"></i> 4072 </label> 4073 </li> 4074 </ul> 4075 </div> 4076 </div> 4077 </div> 4078 </div> 4079 } 4080 4081 @helper RenderMobileTopMiniCartCustom() 4082 { 4083 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4084 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4085 var cartCalculationsFeedPageId = GetPageIdByNavigationTag("CartCalculationsFeed"); 4086 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 4087 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue; 4088 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4089 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 4090 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 4091 bool showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4092 showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue == "right" ? showPriceInMiniCartCounter : false; 4093 showPriceInMiniCartCounter = Pageview.Device.ToString() == "Mobile" ? false : showPriceInMiniCartCounter; 4094 int unitsCount = 0; 4095 var isCartEmpty = Model.Cart.IsEmpty; 4096 bool hidePrice = false; 4097 4098 if (Pageview.User != null) 4099 { 4100 hidePrice = Convert.ToBoolean(Pageview.User.CustomFieldValues.Where(x => x.CustomField.SystemName == "AccessUser_HidePriceInICC").FirstOrDefault().Value); 4101 } 4102 4103 if (!isCartEmpty && hidePrice) 4104 { 4105 var orderlines = Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines; 4106 4107 if (orderlines.Count > 0) 4108 { 4109 foreach (var orderline in orderlines) 4110 { 4111 if (!string.IsNullOrEmpty(orderline.UnitId)) 4112 { 4113 try 4114 { 4115 var productQuantity = orderline.Quantity; 4116 var productNumber = orderline.ProductNumber; 4117 var unitId = orderline.UnitId; 4118 var unit = 0; 4119 4120 if (unitId == "VO84") 4121 { 4122 var palletLoad = Database.ExecuteScalar(string.Format("SELECT PalletLoad FROM EcomProducts WHERE ProductNumber = '{0}' AND ProductLanguageId = 'LANG1'", productNumber)); 4123 var palletData = palletLoad.ToString(); 4124 var palletQuantityPerBox = Database.ExecuteScalar(string.Format("SELECT QuantityPerBox FROM EcomProducts WHERE ProductNumber = '{0}' AND ProductLanguageId = 'LANG1'", productNumber)); ; 4125 4126 unit = int.Parse(palletLoad.ToString()) * int.Parse(palletQuantityPerBox.ToString()); 4127 } 4128 else if (unitId == "VO85") 4129 { 4130 var quantityPerBox = Database.ExecuteScalar(string.Format("SELECT QuantityPerBox FROM EcomProducts WHERE ProductNumber = '{0}' AND ProductLanguageId = 'LANG1'", productNumber)); 4131 4132 unit = int.Parse(quantityPerBox.ToString()); 4133 } 4134 else if (unitId == "VO86") 4135 { 4136 var colliPerLayer = Database.ExecuteScalar(string.Format("SELECT ColliPerLayer FROM EcomProducts WHERE ProductNumber = '{0}' AND ProductLanguageId = 'LANG1'", productNumber)); 4137 var quantityPerBox = Database.ExecuteScalar(string.Format("SELECT QuantityPerBox FROM EcomProducts WHERE ProductNumber = '{0}' AND ProductLanguageId = 'LANG1'", productNumber)); 4138 unit = int.Parse(colliPerLayer.ToString()) * int.Parse(quantityPerBox.ToString()); 4139 } 4140 else 4141 { 4142 unit = 1; 4143 } 4144 4145 //var colliPerLayer = orderline.UnitId != "VO53" ? Database.ExecuteScalar(string.Format("SELECT ColliPerLayer FROM EcomProducts WHERE ProductNumber = '{0}'", productNumber)) : "1"; 4146 //var quantityPerBox = Database.ExecuteScalar(string.Format("SELECT QuantityPerBox FROM EcomProducts WHERE ProductNumber = '{0}'", productNumber)); 4147 //var unit = int.Parse(colliPerLayer.ToString()) * int.Parse(quantityPerBox.ToString()); 4148 4149 int temp = 0; 4150 int.TryParse(productQuantity.ToString(), out temp); 4151 4152 unitsCount += temp / unit; 4153 } 4154 catch (Exception ex) 4155 { 4156 throw new Exception(orderline.ProductNumber + " error with units", ex); 4157 } 4158 } 4159 else 4160 { 4161 int temp = 0; 4162 int.TryParse(orderline.Quantity.ToString(), out temp); 4163 4164 unitsCount += temp; 4165 } 4166 4167 } 4168 } 4169 cartProductsCount = unitsCount.ToString(); 4170 if (showPrice && counterPosition == "right") 4171 { 4172 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 4173 } 4174 } 4175 4176 <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')"*@> 4177 <div class="mini-cart dw-mod"> 4178 <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"> 4179 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 4180 <div class="mini-cart__counter mini-cart__counter--inline dw-mod"> 4181 <div class="js-handlebars-root js-mini-cart-counter js-mini-cart" id="cartCounter" data-template="MiniCartCounterContent" data-cart-calculations-id="@cartCalculationsFeedPageId" data-cart-id="@miniCartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=Counter" data-init-onload="false" data-preloader="false"> 4182 <div class="js-mini-cart-counter-content" style="position:relative;text-align:right"> 4183 @if (hidePrice) 4184 { 4185 <div class="mini-cart-total">@cartProductsCount</div> 4186 } 4187 else 4188 { 4189 if (Model.Cart.TotalPrice != null) 4190 { 4191 <div class="mini-cart-total" style="font-size: 11px; width: 120px; top: 12px; position: absolute;right:0">@Model.Cart.TotalPrice.PriceWithoutVat.Formatted</div> 4192 4193 } 4194 } 4195 </div> 4196 </div> 4197 </div> 4198 </a> 4199 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 4200 { 4201 <div class="mini-cart-dropdown js-handlebars-root js-mini-cart dw-mod" id="miniCart" data-template="MiniCartContent" data-cart-calculations-id="@cartCalculationsFeedPageId" data-cart-id="@miniCartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 4202 } 4203 </div> 4204 </li> 4205 <script id="MiniCartCounterContent" type="text/x-template"> 4206 {{#.}} 4207 <div class="js-mini-cart-counter-content" style="position:relative;text-align:right"> 4208 @if (showPriceInMiniCartCounter) 4209 { 4210 @Translate("Cart")<text>({{totalUnits}}) {{totalprice}}</text> 4211 } 4212 else 4213 { 4214 if (hidePrice) 4215 { 4216 <text>{{totalUnits}}</text> 4217 } 4218 else 4219 { 4220 <text><div class="mini-cart-total" style="font-size:11px; width:120px; top:12px;position:absolute;right:0">{{totalprice}} </div></text> 4221 4222 } 4223 } 4224 </div> 4225 {{/.}} 4226 </script> 4227 } 4228 @helper CustomRenderMobileNavigationMenu() 4229 { 4230 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 4231 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlidesCustom.xslt" : "BaseMenuForMobileExpandable.xslt"; 4232 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 4233 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4234 int startLevel = renderPagesInToolBar ? 1 : 0; 4235 4236 @RenderNavigation(new 4237 { 4238 id = "mobilenavigation", 4239 cssclass = "menu menu-mobile dwnavigation", 4240 startLevel = @startLevel, 4241 ecomStartLevel = @startLevel + 1, 4242 endlevel = @levels, 4243 expandmode = "all", 4244 template = @menuTemplate 4245 }) 4246 4247 if (renderPagesInToolBar) 4248 { 4249 @RenderNavigation(new 4250 { 4251 id = "topToolsMobileNavigation", 4252 cssclass = "menu menu-mobile dwnavigation", 4253 template = "ToolsMenuForMobile.xslt" 4254 }) 4255 } 4256 4257 } 4258 @helper MobileNavigationCustom() 4259 { 4260 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 4261 4262 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 4263 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4264 int cartFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 4265 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 4266 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 4267 var cartCalculationsFeedPageId = GetPageIdByNavigationTag("CartCalculationsFeed"); 4268 <!-- Trigger for mobile navigation --> 4269 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 4270 4271 <!-- Mobile navigation --> 4272 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 4273 @RenderBlockList(subBlocks) 4274 </nav> 4275 4276 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 4277 4278 if (!onlyPreview) 4279 { 4280 <div class="u-visually-hidden js-handlebars-root js-mini-cart" id="miniCart" data-cart-calculations-id="@cartCalculationsFeedPageId" data-template="MiniCartContent" data-cart-id="@cartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 4281 } 4282 } 4283 @helper RenderMobileNavigationImpersonation() 4284 { 4285 int impersonatePageID = GetPageIdByNavigationTag("Impersonation"); 4286 4287 <li class="menu-mobile__item"> 4288 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Default.aspx?ID=@impersonatePageID"><i class="fas fa-users menu-mobile__link-icon"></i> @Translate("Impersonate") </a> 4289 </li> 4290 } 4291 @helper RenderMobileNavigationSavedCardsActionCustom() 4292 { 4293 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4294 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4295 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedShoppingCarts"); 4296 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4297 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"; 4298 4299 <li class="menu-mobile__item"> 4300 <a href="@mySavedCardsPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="fas fa-shopping-cart u-margin-right"></i>@Translate("My shopping carts")</a> 4301 </li> 4302 } 4303 @helper RenderMobileNavigationLanguagesActionCustom() 4304 { 4305 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 4306 var user = Dynamicweb.Security.UserManagement.User.get_Current(Dynamicweb.Security.UserManagement.PagePermissionLevels.Frontend); 4307 var userLang = ""; 4308 if (user != null) 4309 { 4310 userLang = user.Country; 4311 4312 4313 } 4314 string selectedLanguage = ""; 4315 foreach (var lang in Model.Languages) 4316 { 4317 if (lang.IsCurrent) 4318 { 4319 selectedLanguage = lang.Name; 4320 } 4321 } 4322 4323 <li class="menu-mobile__item dw-mod"> 4324 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 4325 <div class="menu-mobile__link__wrap"> 4326 <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> 4327 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 4328 </div> 4329 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 4330 @if (isSlidesDesign) 4331 { 4332 <li class="menu-mobile__item dw-mod"> 4333 <div class="menu-mobile__link__wrap"> 4334 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 4335 <label for="MobileMenuCheck_Language" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 4336 </div> 4337 </li> 4338 } 4339 @{ 4340 string[] notAllowedLangs = null; 4341 if (userLang.Equals("SE", StringComparison.OrdinalIgnoreCase) || userLang.Equals("DK", StringComparison.OrdinalIgnoreCase)) 4342 { 4343 notAllowedLangs = new[] { "Dutch", "German", "French", "Polish", "Italy", "Spanish" }; 4344 } 4345 else 4346 { 4347 notAllowedLangs = new[] { "Swedish", "Danish", "Italy" }; 4348 } 4349 foreach (var lang in Model.Languages) 4350 { 4351 if (notAllowedLangs != null && notAllowedLangs.Contains(lang.Name)) 4352 { 4353 continue; 4354 } 4355 4356 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 4357 4358 <li class="menu-mobile__item dw-mod"> 4359 <a href="/Default.aspx?ID=@lang.Page.ID" class="menu-mobile__link menu-mobile__link--highlighted dw-mod menu-mobile__link--level-1">@lang.Name</a> 4360 </li> 4361 4362 } 4363 } 4364 4365 4366 </ul> 4367 </li> 4368 } 4369 @helper RenderPrimaryBottomSnippetsCustom() 4370 { 4371 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 4372 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 4373 4374 if (isWireframeMode) 4375 { 4376 <script> 4377 Wireframe.Init(true); 4378 </script> 4379 } 4380 4381 <script> 4382 document.addEventListener("DOMContentLoaded", function (event) { 4383 var ua = window.navigator.userAgent; 4384 var isIE = /MSIE|Trident/.test(ua); 4385 if (isIE) { 4386 alert("@Translate("The browser you are currently using is not supported, please use/install a more secure browser")") 4387 } 4388 }) 4389 </script> 4390 4391 4392 if (useGoogleTagManager) 4393 { 4394 4395 <script> 4396 document.addEventListener('addToCart', function(event) { 4397 var googleImpression = event.detail.productInfo.googleImpression; 4398 dataLayer.push({ 4399 'event': 'addToCart', 4400 'ecommerce': { 4401 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code', 4402 'add': { 4403 'products': [{ 4404 'name': googleImpression.name, 4405 'id': googleImpression.id, 4406 'price': googleImpression.price, 4407 'brand': googleImpression.brand, 4408 'category': googleImpression.category, 4409 'variant': googleImpression.variant, 4410 'quantity': event.detail.quantity 4411 }] 4412 } 4413 } 4414 }); 4415 }); 4416 </script> 4417 } 4418 4419 @RenderSnippet("SnippetJavaScript") 4420 } 4421 @helper RenderCartSelectorPopup() 4422 { 4423 /**/ 4424 4425 4426 var os = new Dynamicweb.Ecommerce.Orders.OrderService(); 4427 4428 var user = Dynamicweb.Security.UserManagement.User.get_Current(Dynamicweb.Security.UserManagement.PagePermissionLevels.Frontend); 4429 var ttlDate = DateTime.Now.AddDays(-7); 4430 var hasOrders = 0; 4431 var showModal = ""; 4432 if (user == null) 4433 { 4434 return; 4435 } 4436 else 4437 { 4438 hasOrders = (int)Dynamicweb.Data.Database.ExecuteScalar(String.Format("SELECT COUNT(*) FROM EcomOrders WHERE OrderCart = '1' AND OrderCustomerAccessUserId = '{0}' AND OrderDate >= '{1}'", user.ID.ToString(), ttlDate.ToString("MM/dd/yyyy HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture))); 4439 4440 if (hasOrders <= 0) 4441 { 4442 // Create and select new cart 4443 Dynamicweb.Ecommerce.Orders.Order newCart = new Dynamicweb.Ecommerce.Orders.Order(); 4444 newCart.LanguageId = Pageview.Area.EcomLanguageId.ToString(); 4445 newCart.ShopId = Pageview.Area.EcomShopId.ToString(); 4446 newCart.CustomerAccessUserId = user.ID; 4447 newCart.IsCart = true; 4448 newCart.Date = DateTime.Now; 4449 4450 os.DowngradeToCart(newCart); 4451 os.Save(newCart); 4452 Dynamicweb.Ecommerce.Common.Context.SetCart(newCart); 4453 4454 HttpContext.Current.Session["Value"] = newCart.Id; 4455 return; 4456 } 4457 4458 } 4459 4460 /* 4461 if (HttpContext.Current.Session["Value"] != null && HttpContext.Current.Session["Value"] != "") 4462 { 4463 HttpCookie cartCookie = new HttpCookie("chosenContext"); 4464 cartCookie.Value = HttpContext.Current.Session["Value"].ToString(); 4465 cartCookie.Expires = DateTime.Now.AddMinutes(20); 4466 HttpContext.Current.Response.Cookies.Add(cartCookie); 4467 } 4468 */ 4469 //var savedCartsJsonPageId = GetPageIdByNavigationTag("SavedCartsJson"); 4470 //var savedShoppingCartsPageId = GetPageIdByNavigationTag("SavedShoppingCarts"); 4471 4472 if (string.IsNullOrWhiteSpace(HttpContext.Current.Request["CompletedOrderSecret"])) 4473 { 4474 if (HttpContext.Current.Session["Value"] == null || HttpContext.Current.Session["Value"].ToString() == "") 4475 { 4476 showModal = "checked"; 4477 } 4478 } 4479 4480 if (!string.IsNullOrWhiteSpace(HttpContext.Current.Session["Value"] as string)) 4481 { 4482 var chosenContext = HttpContext.Current.Session["Value"].ToString(); 4483 var order = os.GetOrder(chosenContext); 4484 4485 if (order != null && order.Date >= ttlDate) 4486 { 4487 return; 4488 } 4489 else 4490 { 4491 HttpContext.Current.Session["Value"] = ""; 4492 if (string.IsNullOrWhiteSpace(HttpContext.Current.Request["CompletedOrderSecret"])) 4493 { 4494 showModal = "checked"; 4495 } 4496 } 4497 4498 } 4499 4500 <input type="checkbox" id="CartSelectorModalTrigger" class="modal-trigger" @showModal /> 4501 <!-- Cart selector modal --> 4502 <div class="modal-container"> 4503 <label for="CartSelectorModalTrigger" id="CartSelectorModalOverlay" class="modal-overlay" onclick="event.preventDefault();"></label> 4504 <div class="modal modal--lg modal--sm" id="CartSelectorModal" data-keyboard="false" data-backdrop="static"> 4505 <div class="modal__header"> 4506 <h2>@Translate("Choose one of your existing carts")</h2> 4507 </div> 4508 <div class="modal__body"> 4509 @{ 4510 var savedCartsJsonPageId = GetPageIdByNavigationTag("SavedCartsJson"); 4511 var savedShoppingCartsPageId = GetPageIdByNavigationTag("SavedShoppingCarts"); 4512 } 4513 <div class="js-handlebars-root" id="SavedCarts" data-template="SavedCartsTemplate" data-cart-id="@savedCartsJsonPageId" data-json-feed="/Default.aspx?ID=@savedCartsJsonPageId&limit=3" data-preloader="overlay"></div> 4514 4515 4516 4517 <script id="SavedCartsTemplate" type="text/x-template"> 4518 {{#.}} 4519 <p> 4520 @Translate("This is last") {{numberOfSavedCarts}} @Translate("carts you have created") 4521 </p> 4522 4523 {{#if hasSavedCarts}} 4524 <p>@Translate("Choose with which of them to continue shopping or use the button below the list to create new one.")</p> 4525 {{/if}} 4526 4527 <div class="grid "> 4528 {{#savedCarts}} 4529 <div class="grid__col-lg-4 grid__col-md-3 grid__col-sm-3 grid__col-xs-6 saved_cart_box dw-mod"> 4530 <div class="cart-container"> 4531 <div class="grid__cell"> 4532 <h3>{{name}}</h3> 4533 </div> 4534 4535 <div class="grid__cell price cart-total-price dw-mod"> 4536 @Translate("Total price"): {{totalPrice}} 4537 </div> 4538 <div class="grid__cell item-number"> 4539 @Translate("Created on"): {{createdOn}} 4540 </div> 4541 <div class="grid__cell item-number"> 4542 @Translate("Last modified on"): {{lastModified}} 4543 </div> 4544 <div class="grid__cell item-number"> 4545 @Translate("Expires on"): {{expiretime}} 4546 </div> 4547 <div class="grid__cell u-ta-center"> 4548 {{#if selected}} 4549 <span class="btn context-btn {{selected}}" data-contextId="{{id}}" onclick="TopBrandsApi.chooseContext(this, '@savedCartsJsonPageId');">@Translate("Selected")</span> 4550 {{else}} 4551 <span class="btn context-btn {{selected}}" data-contextId="{{id}}" onclick="TopBrandsApi.chooseContext(this, '@savedCartsJsonPageId');">@Translate("Select")</span> 4552 {{/if}} 4553 <span class="btn remove-cart-btn" data-contextId="{{id}}" onclick="TopBrandsApi.removeCart(event, '{{id}}', '@savedCartsJsonPageId');">@Translate("Remove")</span> 4554 </div> 4555 </div> 4556 </div> 4557 {{/savedCarts}} 4558 </div> 4559 4560 {{/.}} 4561 </script> 4562 4563 <div class="u-ta-center"> 4564 <span onclick="TopBrandsApi.createNewCart('@savedCartsJsonPageId');" class="btn btn--primary dw-mod disabled" id="CreateNewCartBtn">@Translate("Create new cart")</span> 4565 </div> 4566 </div> 4567 </div> 4568 </div> 4569 <script> 4570 document.addEventListener("DOMContentLoaded", function (event) { 4571 var savedcart = document.getElementById("SavedCarts"); 4572 if (document.getElementById("SavedCarts")!=null) { 4573 savedcart.addEventListener("contentLoaded", function (e) { 4574 document.getElementById("CreateNewCartBtn").classList.remove("disabled"); 4575 4576 }) 4577 } 4578 4579 }) 4580 </script> 4581 } 4582 @helper RenderDesktopMenuCustom() 4583 { 4584 4585 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4586 string menuAlignment = topLayout == "two-lines-centered" || topLayout == "minimal-right" ? "u-pull--right" : ""; 4587 4588 bool megaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue.ToLower() == "true" ? true : false; 4589 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 4590 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4591 int startLevel = renderPagesInToolBar ? 1 : 0; 4592 4593 <div class="grid__cell"> 4594 <div class="@menuAlignment"> 4595 @if (!megaMenu) 4596 { 4597 @RenderNavigation(new 4598 { 4599 id = "topnavigation", 4600 cssclass = "menu dw-mod dwnavigation u-full-max-width", 4601 startLevel = @startLevel, 4602 ecomStartLevel = @startLevel + 1, 4603 endlevel = 1, 4604 expandmode = "all", 4605 template = "BaseMenuWithDropdown.xslt" 4606 }); 4607 } 4608 else 4609 { 4610 @RenderNavigation(new 4611 { 4612 id = "topnavigation", 4613 cssclass = "menu dw-mod dwnavigation u-full-max-width", 4614 startLevel = @startLevel, 4615 ecomStartLevel = @startLevel + 1, 4616 endlevel = 1, 4617 promotionImage = megamenuPromotionImage, 4618 promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"), 4619 expandmode = "all", 4620 template = "BaseMegaMenu.xslt" 4621 }); 4622 } 4623 </div> 4624 </div> 4625 4626 } 4627 4628 4629 <!DOCTYPE html> 4630 4631 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 4632 <head> 4633 <meta charset="utf-8" /> 4634 <title>@Model.Title</title> 4635 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> 4636 <meta name="robots" content="index, follow"> 4637 4638 @Model.MetaTags 4639 4640 <!-- Favicon --> 4641 <link href="@favicon" rel="icon" type="image/png"> 4642 4643 <!-- Font awesome --> 4644 @if (useFontAwesomePro) 4645 { 4646 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css" type="text/css"> 4647 } 4648 else 4649 { 4650 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css" type="text/css"> 4651 } 4652 <!-- Flag icon --> 4653 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/css/flag-icon.min.css" type="text/css"> 4654 4655 <!-- Base (Default, wireframe) styles --> 4656 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 4657 4658 <!-- Rapido Css from Website Settings --> 4659 <link id="rapidoCss" rel="stylesheet" href="@autoCssLink" type="text/css"> 4660 4661 <!-- Ignite Css (Custom site specific styles) --> 4662 <link id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css" rel="stylesheet"> 4663 4664 <!-- Google fonts --> 4665 @{ 4666 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))); 4667 } 4668 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 4669 </head> 4670 4671 <body> 4672 4673 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 4674 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 4675 4676 4677 @helper RenderMasterHeader() { 4678 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 4679 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 4680 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 4681 4682 <header class="top-container @stickyTop dw-mod" id="Top"> 4683 @RenderBlockList(subBlocks) 4684 </header> 4685 } 4686 4687 @helper RenderMain() { 4688 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 4689 4690 <main class="site dw-mod"> 4691 @RenderBlockList(subBlocks) 4692 </main> 4693 } 4694 4695 @helper RenderPageContent() { 4696 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 4697 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 4698 4699 <div id="Page" class="page @pagePos"> 4700 <section class="center-container content-container dw-mod" id="content"> 4701 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4702 4703 4704 @{ 4705 string columnClass = "12"; 4706 bool isProductPage = HttpContext.Current.Request.QueryString.Get("ProductID") != null ? true : false; 4707 string backgroundColorClass = Model.PropertyItem.GetString("BackgroundColor") != null && !isProductPage ? "u-" + Model.PropertyItem.GetList("BackgroundColor").SelectedValue + "--bg" : ""; 4708 } 4709 4710 @if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 4711 { 4712 <div class="grid__col-12 grid__col--bleed-y"> 4713 @RenderNavigation(new 4714 { 4715 id = "breadcrumb", 4716 template = "Breadcrumb.xslt" 4717 }) 4718 </div> 4719 } 4720 4721 <div class="grid"> 4722 @if (Model.PropertyItem.GetList("LeftMenu") != null && Model.PropertyItem.GetList("LeftMenu").SelectedValue == "True" ) 4723 { 4724 var navigationMarkup = RenderNavigation(new 4725 { 4726 id = "leftnav", 4727 cssclass = "dwnavigation", 4728 startLevel = 3, 4729 expandmode = "all", 4730 endlevel = 5, 4731 template = "LeftNavigation.xslt" 4732 }); 4733 4734 if (!string.IsNullOrEmpty(navigationMarkup)) 4735 { 4736 <nav class="grid__col-md-3"> 4737 <div class="grid__cell"> 4738 @navigationMarkup 4739 </div> 4740 </nav> 4741 columnClass = "9"; 4742 } 4743 } 4744 <div class="grid__col-md-@columnClass grid__col--bleed"> 4745 <div class="grid"> 4746 @Model.Placeholder("dwcontent", "content", "default:true;sort:1") 4747 </div> 4748 </div> 4749 </div> 4750 4751 4752 @* Very small hack to make it cleanly, and easily possible to change the background color on a single page *@ 4753 @if (backgroundColorClass != "") 4754 { 4755 <script> 4756 document.getElementById("Page").classList.add("@backgroundColorClass"); 4757 </script> 4758 } 4759 </section> 4760 </div> 4761 } 4762 4763 </body> 4764 </html> 4765 4766