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_d4a701b549044e6a9cca0dd579c9aa85.b__63_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2731
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4a701b549044e6a9cca0dd579c9aa85.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4a701b549044e6a9cca0dd579c9aa85.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4a701b549044e6a9cca0dd579c9aa85.b__62_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2715
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4a701b549044e6a9cca0dd579c9aa85.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4a701b549044e6a9cca0dd579c9aa85.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4a701b549044e6a9cca0dd579c9aa85.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 166
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4a701b549044e6a9cca0dd579c9aa85.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4a701b549044e6a9cca0dd579c9aa85.Execute() in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2698
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2 3 @* Rapido version 3.0 *@ 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 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 <div class="form__field-group dw-mod"><a class="btn btn--link-clean dw-mod" title="@Translate("Forgot your password?")" href="@forgotPasswordPageLink">@Translate("Forgot your password?")</a> 318 319 </div> 320 321 <div class="form__field-group dw-mod"> 322 <input type="checkbox" id="rememberMe" name="Autologin" checked="checked" value="True" class="form__control"> 323 <label for="rememberMe"> 324 @Translate("Remember me", "Remember me") 325 </label> 326 </div> 327 328 <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button> 329 330 @*<a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a> 331 332 <a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a>*@ 333 </form> 334 </div> 335 </div> 336 </div> 337 } 338 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 339 { 340 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 341 342 @using System 343 @using System.Web 344 @using System.Collections.Generic 345 @using Dynamicweb.Rapido.Blocks.Extensibility 346 @using Dynamicweb.Rapido.Blocks 347 348 349 @functions { 350 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 351 } 352 353 @{ 354 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"; 355 356 Block mobileHeader = new Block() 357 { 358 Id = "MobileTop", 359 SortId = 10, 360 Template = RenderMobileTop(), 361 SkipRenderBlocksList = true 362 }; 363 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 364 365 Block mobileHeaderNavigation = new Block() 366 { 367 Id = "MobileHeaderNavigation", 368 SortId = 10, 369 Template = RenderMobileHeaderNavigation(), 370 SkipRenderBlocksList = true, 371 BlocksList = new List<Block> { 372 new Block { 373 Id = "MobileHeaderNavigationTrigger", 374 SortId = 10, 375 Template = RenderMobileHeaderNavigationTrigger() 376 } 377 } 378 }; 379 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 380 381 382 Block mobileHeaderLogo = new Block() 383 { 384 Id = "MobileHeaderLogo", 385 SortId = 20, 386 Template = RenderMobileHeaderLogo(), 387 SkipRenderBlocksList = true 388 }; 389 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 390 391 Block mobileHeaderActions = new Block() 392 { 393 Id = "MobileHeaderActions", 394 SortId = 30, 395 Template = RenderMobileTopActions(), 396 SkipRenderBlocksList = true 397 }; 398 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 399 400 Block mobileHeaderSearch = new Block 401 { 402 Id = "MobileHeaderSearch", 403 SortId = 10, 404 Template = RenderMobileTopSearch() 405 }; 406 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 407 408 Block mobileHeaderMiniCart = new Block 409 { 410 Id = "MobileHeaderMiniCart", 411 SortId = 20, 412 Template = RenderMobileTopMiniCart() 413 }; 414 415 Block mobileHeaderSearchBar = new Block() 416 { 417 Id = "MobileHeaderSearchBar", 418 SortId = 30, 419 Template = RenderMobileTopSearchBar() 420 }; 421 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 422 423 switch (mobileTopLayout) 424 { 425 case "nav-left": 426 mobileHeaderNavigation.SortId = 10; 427 mobileHeaderLogo.SortId = 20; 428 mobileHeaderActions.SortId = 30; 429 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 430 break; 431 case "nav-right": 432 mobileHeaderLogo.SortId = 10; 433 mobileHeaderActions.SortId = 20; 434 mobileHeaderNavigation.SortId = 30; 435 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 436 break; 437 case "nav-search-left": 438 mobileHeaderNavigation.SortId = 10; 439 mobileHeaderLogo.SortId = 20; 440 mobileHeaderActions.SortId = 30; 441 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 442 break; 443 case "search-left": 444 mobileHeaderActions.SortId = 10; 445 mobileHeaderLogo.SortId = 20; 446 mobileHeaderNavigation.SortId = 30; 447 mobileHeaderMiniCart.SortId = 0; 448 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 449 break; 450 } 451 } 452 453 454 @helper RenderMobileTop() { 455 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 456 457 <nav class="main-navigation-mobile dw-mod"> 458 <div class="center-container top-container__center-container dw-mod"> 459 <div class="grid grid--align-center"> 460 @RenderBlockList(subBlocks) 461 </div> 462 </div> 463 </nav> 464 } 465 466 @helper RenderMobileHeaderNavigation() { 467 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 468 469 <div class="grid__col-auto-width"> 470 <ul class="menu dw-mod"> 471 @RenderBlockList(subBlocks) 472 </ul> 473 </div> 474 } 475 476 @helper RenderMobileHeaderNavigationTrigger() { 477 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 478 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 479 </li> 480 } 481 482 @helper RenderMobileHeaderLogo() { 483 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 484 485 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 486 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 487 488 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 489 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 490 { 491 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 492 } 493 494 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 495 { 496 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 497 } 498 else 499 { 500 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 501 } 502 503 <div class="grid__col-auto"> 504 <div class="logo dw-mod"> 505 <a href="/Default.aspx?ID=@firstPageId"> 506 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 507 </a> 508 </div> 509 510 @RenderBlockList(subBlocks) 511 </div> 512 } 513 514 @helper RenderMobileTopActions() { 515 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 516 517 <div class="grid__col-auto-width"> 518 <ul class="menu dw-mod"> 519 @RenderBlockList(subBlocks) 520 </ul> 521 </div> 522 } 523 524 @helper RenderMobileTopSearch() { 525 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 526 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 527 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 528 </label> 529 </li> 530 } 531 532 @helper RenderMobileTopMiniCart() { 533 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 534 int cartPageId = GetPageIdByNavigationTag("CartPage"); 535 double cartProductsCount = Model.Cart.TotalProductsCount; 536 537 <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')"> 538 <div class="mini-cart dw-mod"> 539 <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"> 540 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 541 <div class="mini-cart__counter mini-cart__counter--inline dw-mod"> 542 <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"> 543 <div class="js-mini-cart-counter-content"> 544 @cartProductsCount 545 </div> 546 </div> 547 </div> 548 </a> 549 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 550 { 551 <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> 552 } 553 </div> 554 </li> 555 } 556 557 @helper RenderMobileTopSearchBar() { 558 string searchFeedId = ""; 559 string searchSecondFeedId = ""; 560 int groupsFeedId; 561 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 562 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 563 string resultPageLink; 564 string searchPlaceholder; 565 string searchType = "product-search"; 566 string searchTemplate; 567 string searchContentTemplate = ""; 568 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 569 bool showGroups = true; 570 571 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 572 { 573 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 574 resultPageLink = contentSearchPageLink; 575 searchPlaceholder = Translate("Search page"); 576 groupsFeedId = 0; 577 searchType = "content-search"; 578 searchTemplate = "SearchPagesTemplate"; 579 showGroups = false; 580 } 581 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 582 { 583 searchFeedId = productsPageId + "&feed=true"; 584 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 585 resultPageLink = Converter.ToString(productsPageId); 586 searchPlaceholder = Translate("Search products or pages"); 587 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 588 searchType = "combined-search"; 589 searchTemplate = "SearchProductsTemplateWrap"; 590 searchContentTemplate = "SearchPagesTemplateWrap"; 591 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 592 } 593 else 594 { 595 resultPageLink = Converter.ToString(productsPageId); 596 searchFeedId = productsPageId + "&feed=true"; 597 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 598 searchPlaceholder = Translate("Search products"); 599 searchTemplate = "SearchProductsTemplate"; 600 searchType = "product-search"; 601 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 602 } 603 604 605 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 606 607 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 608 <div class="center-container top-container__center-container dw-mod"> 609 <div class="grid"> 610 <div class="grid__col-auto"> 611 <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"> 612 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 613 @if (string.IsNullOrEmpty(searchSecondFeedId)) 614 { 615 <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> 616 } 617 else 618 { 619 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 620 <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> 621 <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> 622 </div> 623 } 624 <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> 625 </div> 626 </div> 627 <div class="grid__col-auto-width"> 628 <ul class="menu dw-mod"> 629 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 630 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 631 <i class="fas fa-times fa-1_5x"></i> 632 </label> 633 </li> 634 </ul> 635 </div> 636 </div> 637 </div> 638 </div> 639 } </text> 640 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 641 642 @using System 643 @using System.Web 644 @using System.Collections.Generic 645 @using Dynamicweb.Rapido.Blocks.Extensibility 646 @using Dynamicweb.Rapido.Blocks 647 648 @functions { 649 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 650 } 651 652 @{ 653 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 654 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideAccount"); 655 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 656 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 657 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 658 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 659 660 Block mobileNavigation = new Block() 661 { 662 Id = "MobileNavigation", 663 SortId = 10, 664 Template = MobileNavigation(), 665 SkipRenderBlocksList = true 666 }; 667 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 668 669 if (Model.CurrentUser.ID > 0) 670 { 671 Block mobileNavigationSignIn = new Block 672 { 673 Id = "MobileNavigationSignIn", 674 SortId = 10, 675 Template = RenderMobileNavigationSignIn() 676 }; 677 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 678 } 679 680 Block mobileNavigationMenu = new Block 681 { 682 Id = "MobileNavigationMenu", 683 SortId = 20, 684 Template = RenderMobileNavigationMenu() 685 }; 686 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 687 688 Block mobileNavigationActions = new Block 689 { 690 Id = "MobileNavigationActions", 691 SortId = 30, 692 Template = RenderMobileNavigationActions(), 693 SkipRenderBlocksList = true 694 }; 695 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 696 697 if (!navigationItemsHideSignIn) 698 { 699 if (Model.CurrentUser.ID <= 0) 700 { 701 Block mobileNavigationSignInAction = new Block 702 { 703 Id = "MobileNavigationSignInAction", 704 SortId = 10, 705 Template = RenderMobileNavigationSignInAction() 706 }; 707 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 708 709 if (hideCreateAccountLink) 710 { 711 Block mobileNavigationCreateAccountAction = new Block 712 { 713 Id = "MobileNavigationCreateAccountAction", 714 SortId = 20, 715 Template = RenderMobileNavigationCreateAccountAction() 716 }; 717 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 718 } 719 } 720 else 721 { 722 if (hideMyProfileLink) 723 { 724 Block mobileNavigationProfileAction = new Block 725 { 726 Id = "MobileNavigationProfileAction", 727 SortId = 10, 728 Template = RenderMobileNavigationProfileAction() 729 }; 730 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationProfileAction); 731 } 732 if (hideMyOrdersLink) 733 { 734 Block mobileNavigationOrdersAction = new Block 735 { 736 Id = "MobileNavigationOrdersAction", 737 SortId = 20, 738 Template = RenderMobileNavigationOrdersAction() 739 }; 740 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 741 } 742 if (hideMyFavoritesLink) 743 { 744 Block mobileNavigationFavoritesAction = new Block 745 { 746 Id = "MobileNavigationFavoritesAction", 747 SortId = 30, 748 Template = RenderMobileNavigationFavoritesAction() 749 }; 750 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 751 } 752 753 Block mobileNavigationSignOutAction = new Block 754 { 755 Id = "MobileNavigationSignOutAction", 756 SortId = 40, 757 Template = RenderMobileNavigationSignOutAction() 758 }; 759 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 760 } 761 } 762 763 if ( Model.Languages.Count > 1) 764 { 765 Block mobileNavigationLanguagesAction = new Block 766 { 767 Id = "MobileNavigationLanguagesAction", 768 SortId = 50, 769 Template = RenderMobileNavigationLanguagesAction() 770 }; 771 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 772 } 773 } 774 775 776 @helper MobileNavigation() { 777 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 778 779 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 780 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 781 int cartFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 782 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 783 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 784 785 <!-- Trigger for mobile navigation --> 786 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 787 788 <!-- Mobile navigation --> 789 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 790 @RenderBlockList(subBlocks) 791 </nav> 792 793 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 794 795 if (!onlyPreview) 796 { 797 <div class="u-visually-hidden js-handlebars-root js-mini-cart" id="miniCart" data-template="MiniCartContent" data-cart-id="@cartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 798 } 799 } 800 801 @helper RenderMobileNavigationSignIn() { 802 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 803 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 804 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 805 string myProfilePageLink = linkStart + myProfilePageId; 806 string userName = Model.CurrentUser.FirstName != null ? Model.CurrentUser.FirstName : ""; 807 userName += " " + Model.CurrentUser.LastName != null ? Model.CurrentUser.LastName : ""; 808 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; 809 810 <ul class="menu menu-mobile"> 811 <li class="menu-mobile__item"> 812 <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> 813 </li> 814 </ul> 815 } 816 817 @helper RenderMobileNavigationMenu() { 818 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 819 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 820 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 821 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 822 int startLevel = renderPagesInToolBar ? 1 : 0; 823 824 @RenderNavigation(new 825 { 826 id = "mobilenavigation", 827 cssclass = "menu menu-mobile dwnavigation", 828 startLevel = @startLevel, 829 ecomStartLevel = @startLevel + 1, 830 endlevel = @levels, 831 expandmode = "all", 832 template = @menuTemplate 833 }) 834 835 if (renderPagesInToolBar) 836 { 837 @RenderNavigation(new 838 { 839 id = "topToolsMobileNavigation", 840 cssclass = "menu menu-mobile dwnavigation", 841 template = "ToolsMenuForMobile.xslt" 842 }) 843 } 844 } 845 846 @helper RenderMobileNavigationActions() { 847 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 848 849 <ul class="menu menu-mobile"> 850 @RenderBlockList(subBlocks) 851 </ul> 852 } 853 854 @helper RenderMobileNavigationSignInAction() { 855 <li class="menu-mobile__item"> 856 <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> 857 </li> 858 } 859 860 @helper RenderMobileNavigationCreateAccountAction() { 861 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 862 863 <li class="menu-mobile__item"> 864 <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> 865 </li> 866 } 867 868 @helper RenderMobileNavigationProfileAction() { 869 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 870 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 871 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 872 string myProfilePageLink = linkStart + myProfilePageId; 873 874 <li class="menu-mobile__item"> 875 <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> 876 </li> 877 } 878 879 @helper RenderMobileNavigationOrdersAction() { 880 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 881 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 882 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 883 string myOrdersPageLink = linkStart + myOrdersPageId; 884 885 <li class="menu-mobile__item"> 886 <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> 887 </li> 888 } 889 890 @helper RenderMobileNavigationFavoritesAction() { 891 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 892 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 893 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 894 string myFavoritesPageLink = linkStart + myFavoritesPageId; 895 896 <li class="menu-mobile__item"> 897 <a href="@myFavoritesPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("My Favorites")</a> 898 </li> 899 } 900 901 @helper RenderMobileNavigationSignOutAction() { 902 int pageId = Model.TopPage.ID; 903 int homePageId = GetPageIdByNavigationTag("Frontpage"); 904 <li class="menu-mobile__item"> 905 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@homePageId"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Sign out")</a> 906 </li> 907 } 908 909 @helper RenderMobileNavigationLanguagesAction() { 910 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 911 912 string selectedLanguage = ""; 913 foreach (var lang in Model.Languages) 914 { 915 if (lang.IsCurrent) 916 { 917 selectedLanguage = lang.Name; 918 } 919 } 920 921 <li class="menu-mobile__item dw-mod"> 922 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 923 <div class="menu-mobile__link__wrap"> 924 <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> 925 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 926 </div> 927 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 928 @if (isSlidesDesign) 929 { 930 <li class="menu-mobile__item dw-mod"> 931 <div class="menu-mobile__link__wrap"> 932 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 933 <label for="MobileMenuCheck_Language" class="menu-mobile__link dw-mod ">Back</label> 934 </div> 935 </li> 936 } 937 @foreach (var lang in Model.Languages) 938 { 939 <li class="menu-mobile__item dw-mod"> 940 <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> 941 </li> 942 } 943 </ul> 944 </li> 945 }</text> 946 } 947 else 948 { 949 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 950 951 @using System 952 @using System.Web 953 @using System.Collections.Generic 954 @using Dynamicweb.Rapido.Blocks.Extensibility 955 @using Dynamicweb.Rapido.Blocks 956 957 @functions { 958 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 959 } 960 961 @{ 962 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 963 bool navigationActionHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 964 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 965 bool showSearchIcon = false; 966 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 967 968 if (topLayout == "minimal" || topLayout == "minimal-right" || topLayout == "two-lines" || topLayout == "two-lines-centered") 969 { 970 showSearchIcon = true; 971 } 972 bool headerOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 973 974 if (renderPagesInToolBar && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 975 { 976 Block masterTools = new Block() 977 { 978 Id = "MasterDesktopTools", 979 SortId = 10, 980 Template = RenderDesktopTools(), 981 SkipRenderBlocksList = true, 982 BlocksList = new List<Block> 983 { 984 new Block { 985 Id = "MasterDesktopToolsText", 986 SortId = 10, 987 Template = RenderDesktopToolsText(), 988 Design = new Design 989 { 990 Size = "auto", 991 HidePadding = true, 992 RenderType = RenderType.Column 993 } 994 }, 995 new Block { 996 Id = "MasterDesktopToolsNavigation", 997 SortId = 20, 998 Template = RenderDesktopToolsNavigation(), 999 Design = new Design 1000 { 1001 Size = "auto-width", 1002 HidePadding = true, 1003 RenderType = RenderType.Column 1004 } 1005 } 1006 } 1007 }; 1008 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterTools); 1009 }; 1010 1011 Block masterDesktopExtra = new Block() 1012 { 1013 Id = "MasterDesktopExtra", 1014 SortId = 10, 1015 Template = RenderDesktopExtra(), 1016 SkipRenderBlocksList = true 1017 }; 1018 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterDesktopExtra); 1019 1020 Block masterDesktopNavigation = new Block() 1021 { 1022 Id = "MasterDesktopNavigation", 1023 SortId = 20, 1024 Template = RenderDesktopNavigation(), 1025 SkipRenderBlocksList = true 1026 }; 1027 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterDesktopNavigation); 1028 1029 Block masterDesktopLogo = new Block 1030 { 1031 Id = "MasterDesktopLogo", 1032 SortId = 10, 1033 Template = RenderDesktopLogo(), 1034 Design = new Design 1035 { 1036 Size = "auto-width", 1037 HidePadding = true, 1038 RenderType = RenderType.Column 1039 } 1040 }; 1041 1042 Block masterDesktopMenu = new Block 1043 { 1044 Id = "MasterDesktopMenu", 1045 SortId = 20, 1046 Template = RenderDesktopMenu(), 1047 Design = new Design() 1048 { 1049 Size = "auto", 1050 HidePadding = true, 1051 RenderType = RenderType.Column 1052 } 1053 }; 1054 1055 Block masterDesktopActionsMenuContainer = new Block 1056 { 1057 Id = "MasterDesktopActionsMenuContainer", 1058 SortId = 30, 1059 Design = new Design 1060 { 1061 RenderType = RenderType.Column, 1062 Size = "auto" 1063 } 1064 }; 1065 1066 Block masterDesktopActionsMenu = new Block 1067 { 1068 Id = "MasterDesktopActionsMenu", 1069 SortId = 10, 1070 Template = RenderDesktopActionsMenu(), 1071 SkipRenderBlocksList = true 1072 }; 1073 1074 if (!navigationActionHideSearch && showSearchIcon) 1075 { 1076 Block masterDesktopActionsMenuSearch = new Block 1077 { 1078 Id = "MasterDesktopActionsMenuSearch", 1079 SortId = 10, 1080 Template = RenderMiniSearch() 1081 }; 1082 masterDesktopActionsMenu.Add(masterDesktopActionsMenuSearch); 1083 } 1084 1085 Block masterDesktopActionsMenuSignIn = new Block 1086 { 1087 Id = "MasterDesktopActionsMenuSignIn", 1088 SortId = 20, 1089 Template = RenderSignIn() 1090 }; 1091 masterDesktopActionsMenu.Add(masterDesktopActionsMenuSignIn); 1092 1093 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 1094 { 1095 Block masterDesktopActionsMenuFavorites = new Block 1096 { 1097 Id = "MasterDesktopActionsMenuFavorites", 1098 SortId = 30, 1099 Template = RenderFavorites() 1100 }; 1101 masterDesktopActionsMenu.Add(masterDesktopActionsMenuFavorites); 1102 } 1103 1104 Block masterDesktopActionsMenuLanguageSelector = new Block 1105 { 1106 Id = "MasterDesktopActionsMenuLanguageSelector", 1107 SortId = 40, 1108 Template = RenderLanguageSelector() 1109 }; 1110 masterDesktopActionsMenu.Add(masterDesktopActionsMenuLanguageSelector); 1111 1112 if (!headerOnlyPreview) 1113 { 1114 Block masterDesktopActionsMenuMiniCart = new Block 1115 { 1116 Id = "MasterDesktopActionsMenuMiniCart", 1117 SortId = 50, 1118 Template = RenderMiniCart() 1119 }; 1120 masterDesktopActionsMenu.Add(masterDesktopActionsMenuMiniCart); 1121 } 1122 1123 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 1124 { 1125 Block masterDesktopActionsHeaderButton = new Block 1126 { 1127 Id = "MasterDesktopActionsHeaderButton", 1128 SortId = 60, 1129 Template = RenderHeaderButton() 1130 }; 1131 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 1132 } 1133 1134 Block searchBar = new Block() 1135 { 1136 Id = "SearchBar", 1137 SortId = 40, 1138 Template = RenderSearchBar(), 1139 Design = new Design() 1140 { 1141 Size = "auto", 1142 HidePadding = true, 1143 RenderType = RenderType.Column 1144 } 1145 }; 1146 1147 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 1148 { 1149 Block impersonationBar = new Block() 1150 { 1151 Id = "ImpersonationBar", 1152 SortId = 50, 1153 Template = RenderImpersonationBar(), 1154 Design = new Design() 1155 { 1156 Size = "auto-width", 1157 HidePadding = true, 1158 RenderType = RenderType.Column 1159 } 1160 }; 1161 headerBlocksPage.Add(MasterBlockId.MasterHeader, impersonationBar); 1162 } 1163 1164 switch (topLayout) 1165 { 1166 case "condensed": //2 1167 masterDesktopLogo.SortId = 10; 1168 masterDesktopLogo.Design.Size = "auto-width"; 1169 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1170 masterDesktopMenu.SortId = 20; 1171 masterDesktopMenu.Design.Size = "auto"; 1172 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1173 masterDesktopActionsMenuContainer.SortId = 30; 1174 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1175 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1176 if (!navigationActionHideSearch) 1177 { 1178 searchBar.SortId = 40; 1179 searchBar.Design.Size = "12"; 1180 masterDesktopExtra.SortId = 50; 1181 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1182 } 1183 break; 1184 case "minimal": //4 1185 masterDesktopLogo.SortId = 10; 1186 masterDesktopLogo.Design.Size = "auto-width"; 1187 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1188 masterDesktopMenu.SortId = 10; 1189 masterDesktopMenu.Design.Size = "auto"; 1190 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1191 masterDesktopActionsMenuContainer.SortId = 20; 1192 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1193 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1194 break; 1195 case "minimal-right": //5 1196 masterDesktopLogo.SortId = 10; 1197 masterDesktopLogo.Design.Size = "auto-width"; 1198 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1199 masterDesktopMenu.SortId = 10; 1200 masterDesktopMenu.Design.Size = "auto"; 1201 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1202 masterDesktopActionsMenuContainer.SortId = 20; 1203 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1204 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1205 break; 1206 case "two-lines": //6 1207 masterDesktopLogo.SortId = 10; 1208 masterDesktopLogo.Design.Size = "auto"; 1209 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1210 masterDesktopMenu.SortId = 10; 1211 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1212 masterDesktopActionsMenuContainer.SortId = 20; 1213 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1214 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1215 break; 1216 case "two-lines-centered": //7 1217 masterDesktopLogo.SortId = 10; 1218 masterDesktopLogo.Design.Size = "auto"; 1219 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1220 masterDesktopMenu.SortId = 10; 1221 masterDesktopMenu.Design.Size = "auto"; 1222 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1223 masterDesktopActionsMenuContainer.SortId = 20; 1224 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1225 break; 1226 case "splitted": //3 1227 masterDesktopLogo.SortId = 10; 1228 masterDesktopLogo.Design.Size = "auto"; 1229 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1230 if (!navigationActionHideSearch) 1231 { 1232 searchBar.SortId = 20; 1233 searchBar.Design.Size = "auto"; 1234 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1235 } 1236 masterDesktopMenu.SortId = 10; 1237 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1238 masterDesktopActionsMenuContainer.SortId = 20; 1239 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1240 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1241 break; 1242 case "normal": //1 1243 default: 1244 masterDesktopLogo.SortId = 10; 1245 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1246 if (!navigationActionHideSearch) 1247 { 1248 searchBar.SortId = 20; 1249 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1250 } 1251 masterDesktopActionsMenuContainer.SortId = 30; 1252 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopActionsMenuContainer); 1253 masterDesktopMenu.SortId = 10; 1254 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1255 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1256 break; 1257 } 1258 1259 headerBlocksPage.Add("MasterDesktopActionsMenuContainer", masterDesktopActionsMenu); 1260 } 1261 1262 @helper RenderDesktopTools() 1263 { 1264 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 1265 1266 <div class="tools-navigation dw-mod"> 1267 <div class="center-container grid top-container__center-container dw-mod"> 1268 @RenderBlockList(subBlocks) 1269 </div> 1270 </div> 1271 } 1272 1273 @helper RenderDesktopToolsText() 1274 { 1275 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 1276 1277 <div class="u-margin-top">@toolsText</div> 1278 } 1279 1280 @helper RenderDesktopToolsNavigation() 1281 { 1282 <div> 1283 @RenderNavigation(new 1284 { 1285 id = "topToolsNavigation", 1286 cssclass = "menu menu-tools dw-mod dwnavigation", 1287 template = "TopMenu.xslt" 1288 }) 1289 </div> 1290 } 1291 1292 @helper RenderDesktopNavigation() 1293 { 1294 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 1295 1296 <nav class="main-navigation dw-mod"><input id="show-menu" type="checkbox" /> 1297 <div class="center-container top-container__center-container grid grid--align-center dw-mod"> 1298 @RenderBlockList(subBlocks) 1299 </div> 1300 </nav> 1301 } 1302 1303 @helper RenderDesktopExtra() 1304 { 1305 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 1306 1307 if (subBlocks.Count > 0) 1308 { 1309 <input id="show-menu" type="checkbox" /><div class="header header-top dw-mod"> 1310 <div class="center-container top-container__center-container grid grid--align-center dw-mod"> 1311 @RenderBlockList(subBlocks) 1312 </div> 1313 </div> 1314 } 1315 } 1316 1317 @helper RenderDesktopLogo() 1318 { 1319 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 1320 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1321 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 1322 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 1323 string logoHeight = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetString("LogoHeight")) ? Model.Area.Item.GetItem("Layout").GetString("LogoHeight") : "40"; 1324 logoHeight = logoHeight != "0" ? logoHeight : "40"; 1325 if (Path.GetExtension(logo).ToLower() != ".svg") 1326 { 1327 logo = "/Admin/Public/GetImage.ashx?height=" + logoHeight + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 1328 1329 if (Pageview.Device.ToString() == "Mobile") 1330 { 1331 logoHeight = "40"; 1332 } 1333 } 1334 else 1335 { 1336 logo = HttpUtility.UrlDecode(logo); 1337 } 1338 1339 <div class="logo @alignClass dw-mod"> 1340 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 1341 <img class="grid__cell-img logo__img dw-mod" src="@logo" /> 1342 </a> 1343 </div><div class="menu_gumb" id="menu_hide"><label class="show-menu" for="show-menu"><i class="fa fa-bars" style="margin-left: 10px;"></i></label></div> 1344 } 1345 1346 @helper RenderDesktopMenu() 1347 { 1348 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1349 string menuAlignment = topLayout == "two-lines-centered" || topLayout == "minimal-right" ? "u-pull--right" : ""; 1350 1351 bool megaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue.ToLower() == "true" ? true : false; 1352 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 1353 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 1354 int startLevel = renderPagesInToolBar ? 1 : 0; 1355 1356 <div class="grid__cell"> 1357 <div class="@menuAlignment"> 1358 @if (!megaMenu) 1359 { 1360 @RenderNavigation(new 1361 { 1362 id = "topnavigation", 1363 cssclass = "menu dw-mod dwnavigation u-full-max-width hiddenDS", 1364 startLevel = @startLevel, 1365 ecomStartLevel = @startLevel + 1, 1366 endlevel = 5, 1367 expandmode = "all", 1368 template = "BaseMenuWithDropdown.xslt" 1369 }); 1370 } 1371 else 1372 { 1373 @RenderNavigation(new 1374 { 1375 id = "topnavigation", 1376 cssclass = "menu dw-mod dwnavigation u-full-max-width hiddenDS", 1377 startLevel = @startLevel, 1378 ecomStartLevel = @startLevel + 1, 1379 endlevel = 5, 1380 promotionImage = megamenuPromotionImage, 1381 promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"), 1382 expandmode = "all", 1383 template = "BaseMegaMenu.xslt" 1384 }); 1385 } 1386 </div> 1387 </div> 1388 } 1389 1390 @helper RenderDesktopActionsMenu() 1391 { 1392 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 1393 1394 <ul class="menu dw-mod hiddenDS"> 1395 @RenderBlockList(subBlocks) 1396 </ul> 1397 } 1398 1399 @helper RenderLanguageSelector() 1400 { 1401 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1402 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"; 1403 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1404 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() : ""; 1405 string curLang =""; 1406 var masterAreaId = Pageview.Area.ID; 1407 if ((int)masterAreaId > 0) 1408 { 1409 curLang = Dynamicweb.Services.Areas.GetArea(masterAreaId).EcomCountryCode.ToLower(); 1410 } 1411 if (Model.Languages.Count > 1) 1412 { 1413 <li class="@liClasses is-dropdown is-dropdown--no-icon"> 1414 <div class="@menuLinkClass menu__link--icon dw-mod hiddenDS"> 1415 @if(curLang!=""){ 1416 <i class="flag-icon flag-icon-@curLang fa-1_5x"></i> 1417 } else { 1418 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"> </i> 1419 } 1420 </div> 1421 <div class="menu menu--dropdown dw-mod"> 1422 @foreach (var lang in Model.Languages) 1423 { 1424 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 1425 1426 if (languageViewType == "flag") 1427 { 1428 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + "\"></span>"; 1429 } 1430 1431 if (languageViewType == "name") 1432 { 1433 langInfo = lang.Name; 1434 } 1435 <a onclick="openChangeLanguageForm('/Default.aspx?ID=@lang.Page.ID&LanguageID=@Dynamicweb.Services.Areas.GetArea(lang.ID).EcomLanguageId&currencycode=@Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCurrencyId');" class="menu-dropdown__item menu-dropdown__item--link dw-mod">@langInfo</a> 1436 @*<a onclick="redirectToLanguage('/Default.aspx?ID=@lang.Page.ID&LanguageID=@Dynamicweb.Services.Areas.GetArea(lang.ID).EcomLanguageId&currencycode=@Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCurrencyId');" class="menu-dropdown__item menu-dropdown__item--link dw-mod">@langInfo</a>*@ 1437 @*<a onclick="redirectToLanguage('/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID&LanguageID=@Dynamicweb.Services.Areas.GetArea(lang.ID).EcomLanguageId&currencycode=@Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCurrencyId');" class="menu-dropdown__item menu-dropdown__item--link dw-mod">@langInfo</a>*@ 1438 } 1439 </div> 1440 </li> 1441 } 1442 } 1443 1444 @helper RenderMiniCart() 1445 { 1446 bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 1447 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 1448 int cartPageId = GetPageIdByNavigationTag("CartPage"); 1449 var user = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser(); 1450 if (user != null) 1451 { 1452 var groups = user.Groups; 1453 foreach(var group in groups) 1454 { 1455 if (group.ID == 65) 1456 { 1457 cartPageId = GetPageIdByNavigationTag("QuotesCartPage"); 1458 } 1459 } 1460 } 1461 1462 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 1463 1464 if (!onlyPreview && !navigationItemsHideCart) 1465 { 1466 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1467 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod" : "menu__item menu__item--horizontal menu--clean dw-mod"; 1468 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1469 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 1470 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue; 1471 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 1472 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 1473 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 1474 1475 if (showPrice && counterPosition == "right") 1476 { 1477 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 1478 } 1479 1480 1481 <li class="@liClasses" id="miniCartWrapper" onmouseenter="Cart.UpdateMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 1482 <div class="mini-cart dw-mod"> 1483 <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="@menuLinkClass menu__link--icon dw-mod js-mini-cart-button"> 1484 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 1485 <div class="mini-cart__counter dw-mod"> 1486 <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"> 1487 <div class="js-mini-cart-counter-content"> 1488 @cartProductsCount 1489 @cartProductsTotalPrice 1490 </div> 1491 </div> 1492 </div> 1493 </a> 1494 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 1495 { 1496 <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> 1497 } 1498 </div> 1499 </li> 1500 } 1501 } 1502 1503 @helper RenderSignIn() 1504 { 1505 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 1506 string userInitials = ""; 1507 int pageId = Model.TopPage.ID; 1508 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 1509 int sendInquiryPageId = GetPageIdByNavigationTag("SendInquiry"); 1510 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 1511 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 1512 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 1513 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 1514 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 1515 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 1516 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideAccount"); 1517 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 1518 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 1519 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 1520 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 1521 1522 string linkStart = "/Default.aspx?ID="; 1523 if (Model.CurrentUser.ID <= 0) 1524 { 1525 linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; 1526 } 1527 1528 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 1529 string myProfilePageLink = linkStart + myProfilePageId; 1530 string myOrdersPageLink = linkStart + myOrdersPageId; 1531 string myFavoritesPageLink = linkStart + myFavoritesPageId; 1532 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 1533 string SendInquiryPageLink = linkStart + sendInquiryPageId; 1534 1535 if (Model.CurrentUser.ID != 0) 1536 { 1537 if (!String.IsNullOrEmpty(Model.CurrentUser.Name)) 1538 { 1539 string[] names = Model.CurrentUser.Name.Split(' '); 1540 userInitials += Model.CurrentUser.Name.Substring(0, 1); 1541 1542 if (names.Length > 1) 1543 { 1544 if(names[names.Length - 1]!=null) 1545 { 1546 userInitials += names[names.Length - 1].Substring(0, 1); 1547 } 1548 } 1549 } 1550 else 1551 { 1552 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : ""; 1553 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : ""; 1554 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : ""; 1555 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : ""; 1556 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : ""; 1557 } 1558 } 1559 1560 if (!navigationItemsHideSignIn) 1561 { 1562 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1563 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"; 1564 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1565 1566 <li class="@liClasses is-dropdown is-dropdown--no-icon"> 1567 <div class="@menuLinkClass menu__link--icon dw-mod"> 1568 @if (Model.CurrentUser.ID <= 0) 1569 { 1570 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i> 1571 } 1572 else 1573 { 1574 <a href="/default.aspx?ID=@myProfilePageId" class="u-color-inherit"><div style="font-size: 15px;">@Translate("logged in as") @Pageview.User.UserName</div></a> 1575 } 1576 </div> 1577 <div class="menu menu--dropdown sign-in-dropdown dw-mod"> 1578 <ul class="list list--clean dw-mod"> 1579 @if (Model.CurrentUser.ID <= 0) 1580 { 1581 <li> 1582 <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> 1583 </li> 1584 if (!hideCreateAccountLink) 1585 { 1586 <li> 1587 <a href="/default.aspx?ID=@createAccountPageId" class="list__link dw-mod">@Translate("Create account")</a> 1588 </li> 1589 1590 <li> 1591 <a href="@forgotPasswordPageLink" class="list__link dw-mod">@Translate("Forgot your password?")</a> 1592 </li> 1593 } 1594 } 1595 else 1596 { 1597 1598 @*if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 1599 { 1600 <li class="list__seperator dw-mod"></li> 1601 }*@ 1602 1603 if (!hideMyProfileLink) 1604 { 1605 <li> 1606 <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> 1607 </li> 1608 } 1609 if (!hideMyOrdersLink) 1610 { 1611 <li> 1612 <a href="@myOrdersPageLink" class="list__link dw-mod"><i class="fas fa-list u-margin-right"></i>@Translate("My Orders")</a> 1613 </li> 1614 } 1615 if (!hideMyFavoritesLink) 1616 { 1617 <li> 1618 <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> 1619 </li> 1620 } 1621 if (!hideMySavedCardsLink) 1622 { 1623 <li> 1624 <a href="@mySavedCardsPageLink" class="list__link dw-mod"><i class="fas fa-credit-card u-margin-right"></i>@Translate("My Saved cards")</a> 1625 </li> 1626 } 1627 } 1628 @if (Model.CurrentUser.ID > 0) 1629 { 1630 string UserAccessToken = ""; 1631 Dynamicweb.Security.UserManagement.User usr = Dynamicweb.Security.UserManagement.User.GetUserByID(Model.CurrentUser.ID); 1632 1633 foreach (var customField in usr.CustomFieldValues){ 1634 if (customField.CustomField.SystemName =="AccessUser_QQToken"){ 1635 UserAccessToken = customField.Value.ToString(); 1636 } 1637 1638 } 1639 1640 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 1641 { 1642 <li class="list__seperator dw-mod"></li> 1643 } 1644 1645 1646 if(!string.IsNullOrWhiteSpace(UserAccessToken)){ 1647 string QQLink = "https://webqq-acofunki.aco.com/Account/Login?QQ_access_token="+UserAccessToken; 1648 <li> 1649 <a href="@QQLink" class="list__link dw-mod"><i class="fas fa-box-open u-margin-right"></i>@Translate("Login to QQ")</a> 1650 </li> 1651 } 1652 1653 int homePageId = GetPageIdByNavigationTag("Frontpage"); 1654 <li> 1655 <a href="/Admin/Public/ExtranetLogoff.aspx?ID=@homePageId" class="list__link dw-mod">@Translate("Sign out")</a> 1656 </li> 1657 } 1658 </ul> 1659 </div> 1660 </li> 1661 } 1662 } 1663 1664 @helper RenderFavorites() 1665 { 1666 bool navigationItemsHideFavorites = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 1667 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 1668 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 1669 1670 string linkStart = "/Default.aspx?ID="; 1671 if (Model.CurrentUser.ID <= 0) 1672 { 1673 linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; 1674 } 1675 1676 string myFavoritesPageLink = linkStart + myFavoritesPageId; 1677 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1678 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"; 1679 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1680 1681 <li class="@liClasses"> 1682 <a href="@myFavoritesPageLink" class="@menuLinkClass menu__link--icon dw-mod"> 1683 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 1684 </a> 1685 </li> 1686 } 1687 1688 @helper RenderHeaderButton() 1689 { 1690 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 1691 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 1692 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 1693 1694 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 1695 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 1696 </li> 1697 } 1698 1699 @helper RenderSearchBar(string alignment = "left") 1700 { 1701 string searchFeedId = ""; 1702 string searchSecondFeedId = ""; 1703 int groupsFeedId; 1704 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 1705 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 1706 string resultPageLink; 1707 string searchPlaceholder; 1708 string searchType = "product-search"; 1709 string searchTemplate; 1710 string searchContentTemplate = ""; 1711 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 1712 bool showGroups = true; 1713 1714 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 1715 { 1716 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1717 resultPageLink = contentSearchPageLink; 1718 searchPlaceholder = Translate("Search page"); 1719 groupsFeedId = 0; 1720 searchType = "content-search"; 1721 searchTemplate = "SearchPagesTemplate"; 1722 showGroups = false; 1723 } 1724 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 1725 { 1726 searchFeedId = productsPageId + "&feed=true"; 1727 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1728 resultPageLink = Converter.ToString(productsPageId); 1729 searchPlaceholder = Translate("Search products or pages"); 1730 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1731 searchType = "combined-search"; 1732 searchTemplate = "SearchProductsTemplateWrap"; 1733 searchContentTemplate = "SearchPagesTemplateWrap"; 1734 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1735 } 1736 else 1737 { 1738 resultPageLink = Converter.ToString(productsPageId); 1739 searchFeedId = productsPageId + "&feed=true"; 1740 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1741 searchPlaceholder = Translate("Search products"); 1742 searchTemplate = "SearchProductsTemplate"; 1743 searchType = "product-search"; 1744 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1745 } 1746 1747 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod hiddenDS" 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"> 1748 @if (showGroups) 1749 { 1750 <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> 1751 <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> 1752 } 1753 <div class="typeahead-search-field"> 1754 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@searchPlaceholder" value="@searchValue"> 1755 @if (string.IsNullOrEmpty(searchSecondFeedId)) 1756 { 1757 <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> 1758 } 1759 else 1760 { 1761 <div class="dropdown dropdown--absolute-position dropdown--combined grid @(alignment == "right" ? "dropdown--right-aligned" : "")"> 1762 <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> 1763 <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> 1764 </div> 1765 } 1766 </div> 1767 <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> 1768 </div> 1769 } 1770 1771 @helper RenderMiniSearch() 1772 { 1773 string searchFeedId = ""; 1774 string searchSecondFeedId = ""; 1775 int groupsFeedId; 1776 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 1777 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 1778 string resultPageLink; 1779 string searchPlaceholder; 1780 string searchType = "product-search"; 1781 string searchTemplate; 1782 string searchContentTemplate = ""; 1783 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 1784 bool showGroups = true; 1785 1786 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 1787 { 1788 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1789 resultPageLink = contentSearchPageLink; 1790 searchPlaceholder = Translate("Search page"); 1791 groupsFeedId = 0; 1792 searchType = "content-search"; 1793 searchTemplate = "SearchPagesTemplate"; 1794 showGroups = false; 1795 } 1796 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 1797 { 1798 searchFeedId = productsPageId + "&feed=true"; 1799 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1800 resultPageLink = Converter.ToString(productsPageId); 1801 searchPlaceholder = Translate("Search products or pages"); 1802 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1803 searchType = "combined-search"; 1804 searchTemplate = "SearchProductsTemplateWrap"; 1805 searchContentTemplate = "SearchPagesTemplateWrap"; 1806 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1807 } 1808 else 1809 { 1810 resultPageLink = Converter.ToString(productsPageId); 1811 searchFeedId = productsPageId + "&feed=true"; 1812 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1813 searchPlaceholder = Translate("Search products"); 1814 searchTemplate = "SearchProductsTemplate"; 1815 searchType = "product-search"; 1816 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1817 } 1818 1819 <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()"> 1820 <div class="menu__link menu__link--icon dw-mod"> 1821 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 1822 </div> 1823 <div class="menu menu--dropdown u-w380px top-micro-search dw-mod"> 1824 <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"> 1825 <div class="typeahead-search-field"> 1826 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@searchPlaceholder" value="@searchValue"> 1827 @if (string.IsNullOrEmpty(searchSecondFeedId)) 1828 { 1829 <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> 1830 } 1831 else 1832 { 1833 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 1834 <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> 1835 <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> 1836 </div> 1837 } 1838 </div> 1839 </div> 1840 </div> 1841 </li> 1842 } 1843 1844 @helper RenderImpersonationBar() 1845 { 1846 int impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 1847 1848 <div class="u-color-warning--bg"> 1849 <div class="center-container top-container__center-container dw-mod"> 1850 @*Impersonation*@ 1851 <div class="grid"> 1852 <div class="grid--align-self-center grid__col-x"> 1853 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 1854 { 1855 string stopImpersonateTranslation = Translate("Stop impersonation"); 1856 string username = ""; 1857 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName)) 1858 { 1859 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName; 1860 } 1861 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name)) 1862 { 1863 username = Model.CurrentSecondaryUser.Name; 1864 } 1865 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email)) 1866 { 1867 username = Model.CurrentSecondaryUser.Email; 1868 } 1869 else 1870 { 1871 username = Model.CurrentSecondaryUser.UserName; 1872 } 1873 <div class="grid-cell"> 1874 <div class="u-pull--left u-bold u-margin-top"> 1875 <i class="fas fa-user-secret"></i> 1876 @Pageview.User.UserName<text>&nbsp;</text>@Translate("is impersonated by")<text>&nbsp;</text>@username 1877 </div> 1878 <form method="post" class="u-pull--right u-no-margin"> 1879 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation"> 1880 </form> 1881 </div> 1882 } 1883 else 1884 { 1885 string viewListTranslation = Translate("View the list of users you can impersonate"); 1886 <div class="grid-cell u-bold"> 1887 <i class="fas fa-user-secret"></i> 1888 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a> 1889 </div> 1890 } 1891 </div> 1892 </div> 1893 </div> 1894 </div> 1895 } 1896 1897 </text> 1898 } 1899 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 1900 1901 @using System 1902 @using System.Web 1903 @using System.Collections.Generic 1904 @using Dynamicweb.Rapido.Blocks.Extensibility 1905 @using Dynamicweb.Rapido.Blocks 1906 1907 @functions { 1908 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 1909 } 1910 1911 @{ 1912 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content") : ""; 1913 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content") : ""; 1914 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content") : ""; 1915 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header") : ""; 1916 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header") : ""; 1917 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header") : ""; 1918 1919 Block masterFooterContent = new Block() 1920 { 1921 Id = "MasterFooterContent", 1922 SortId = 10, 1923 Template = RenderFooter(), 1924 SkipRenderBlocksList = true 1925 }; 1926 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 1927 1928 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 1929 { 1930 Block masterFooterColumnOne = new Block 1931 { 1932 Id = "MasterFooterColumnOne", 1933 SortId = 10, 1934 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 1935 Design = new Design { 1936 Size = "auto", 1937 RenderType = RenderType.Column 1938 } 1939 }; 1940 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 1941 } 1942 1943 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 1944 { 1945 Block masterFooterColumnTwo = new Block 1946 { 1947 Id = "MasterFooterColumnTwo", 1948 SortId = 20, 1949 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 1950 Design = new Design 1951 { 1952 Size = "auto", 1953 RenderType = RenderType.Column 1954 } 1955 }; 1956 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 1957 } 1958 1959 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 1960 { 1961 Block masterFooterColumnThree = new Block 1962 { 1963 Id = "MasterFooterColumnThree", 1964 SortId = 30, 1965 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 1966 Design = new Design 1967 { 1968 Size = "auto", 1969 RenderType = RenderType.Column 1970 } 1971 }; 1972 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 1973 } 1974 1975 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 1976 { 1977 Block masterFooterNewsletterSignUp = new Block 1978 { 1979 Id = "MasterFooterNewsletterSignUp", 1980 SortId = 40, 1981 Template = RenderFooterNewsletterSignUp(), 1982 Design = new Design 1983 { 1984 Size = "auto", 1985 RenderType = RenderType.Column 1986 } 1987 }; 1988 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 1989 } 1990 1991 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 1992 { 1993 Block masterFooterSocialLinks = new Block 1994 { 1995 Id = "MasterFooterSocialLinks", 1996 SortId = 50, 1997 Template = RenderFooterSocialLinks(), 1998 Design = new Design 1999 { 2000 Size = "auto", 2001 RenderType = RenderType.Column 2002 } 2003 }; 2004 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 2005 } 2006 2007 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 2008 { 2009 Block masterFooterPayments = new Block 2010 { 2011 Id = "MasterFooterPayments", 2012 SortId = 60, 2013 Template = RenderFooterPayments(), 2014 Design = new Design 2015 { 2016 Size = "12", 2017 RenderType = RenderType.Column 2018 } 2019 }; 2020 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 2021 } 2022 2023 Block masterFooterCopyright = new Block 2024 { 2025 Id = "MasterFooterCopyright", 2026 SortId = 70, 2027 Template = RenderFooterCopyright(), 2028 Design = new Design 2029 { 2030 Size = "12", 2031 RenderType = RenderType.Column 2032 } 2033 }; 2034 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 2035 } 2036 2037 @helper RenderFooter() { 2038 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 2039 2040 <footer class="footer dw-mod"> 2041 <div class="center-container top-container__center-container dw-mod"> 2042 <div class="grid grid--external-bleed-x"> 2043 @RenderBlockList(subBlocks) 2044 </div> 2045 </div> 2046 </footer> 2047 } 2048 2049 @helper RenderFooterColumn(string header, string content) { 2050 <h3 class="footer__heading dw-mod">@header</h3> 2051 <div class="footer__content dw-mod"> 2052 @content 2053 </div> 2054 } 2055 2056 @helper RenderFooterNewsletterSignUp() { 2057 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 2058 2059 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 2060 <div class="footer__content dw-mod"> 2061 <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> 2062 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> 2063 <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> 2064 <div class="form__field-combi"> 2065 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' /> 2066 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' /> 2067 </div> 2068 </form> 2069 </div> 2070 } 2071 2072 @helper RenderFooterSocialLinks() { 2073 <h3 class="footer__heading dw-mod"><br> </h3> 2074 <div class="footer__content dw-mod"> 2075 <div class="collection dw-mod"> 2076 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 2077 { 2078 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 2079 string socialIconClass = socialIcon.SelectedValue; 2080 string socialIconTitle = socialIcon.SelectedName; 2081 string socialLink = socialitem.GetString("Link"); 2082 2083 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px"><i class="@socialIconClass fa-2x" style="color:#CC0000;"></i></a> 2084 } 2085 </div> 2086 </div> 2087 } 2088 2089 @helper RenderFooterPayments() { 2090 <div class="footer__content dw-mod"> 2091 <div class="collection dw-mod"> 2092 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 2093 { 2094 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 2095 string paymentImage = null; 2096 string paymentTitle = paymentItem.SelectedName; 2097 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 2098 if (selected != null) 2099 { 2100 paymentImage = selected.Icon; 2101 } 2102 2103 <div class="footer__card-type"> 2104 <img src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> 2105 </div> 2106 } 2107 </div> 2108 </div> 2109 } 2110 2111 @helper RenderFooterCopyright() { 2112 <div class="grid__col-12 footer__copyright dw-mod"> 2113 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 2114 </div> 2115 } 2116 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2117 2118 @using System 2119 @using System.Web 2120 @using System.Collections.Generic 2121 @using Dynamicweb.Rapido.Blocks.Extensibility 2122 @using Dynamicweb.Rapido.Blocks 2123 2124 @{ 2125 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 2126 bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 2127 2128 if (!navigationItemsHideCart) 2129 { 2130 Block miniCartScriptTemplates = new Block() 2131 { 2132 Id = "MasterMiniCartTemplates", 2133 SortId = 1, 2134 Template = RenderMiniCartScriptTemplates(), 2135 SkipRenderBlocksList = true, 2136 BlocksList = new List<Block> 2137 { 2138 new Block { 2139 Id = "MiniCartHeader", 2140 SortId = 10, 2141 Template = RenderMiniCartHeader() 2142 }, 2143 new Block { 2144 Id = "MiniCartOrderLines", 2145 SortId = 20, 2146 Template = RenderMiniCartOrderLines() 2147 }, 2148 new Block { 2149 Id = "MiniCartFees", 2150 SortId = 30, 2151 Template = RenderMiniCartFees() 2152 }, 2153 new Block { 2154 Id = "MiniCartPoints", 2155 SortId = 40, 2156 Template = RenderMiniCartPoints() 2157 }, 2158 new Block { 2159 Id = "MiniCartTotal", 2160 SortId = 50 , 2161 Template = RenderMiniCartTotal() 2162 } 2163 } 2164 }; 2165 2166 miniCartBlocksPage.Add(MasterBlockId.MasterBottomSnippets, miniCartScriptTemplates); 2167 } 2168 } 2169 2170 @helper RenderMiniCartScriptTemplates() 2171 { 2172 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 2173 2174 int cartPageId = GetPageIdByNavigationTag("CartPage"); 2175 var user = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser(); 2176 if (user != null) 2177 { 2178 var groups = user.Groups; 2179 foreach (var group in groups) 2180 { 2181 if (group.ID == 65) 2182 { 2183 cartPageId = GetPageIdByNavigationTag("QuotesCartPage"); 2184 } 2185 } 2186 } 2187 bool showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 2188 showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue == "right" ? showPriceInMiniCartCounter : false; 2189 showPriceInMiniCartCounter = Pageview.Device.ToString() == "Mobile" ? false : showPriceInMiniCartCounter; 2190 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2191 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2192 string addingToCartNotification = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 2193 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 2194 2195 2196 <script id="MiniCartCounterContent" type="text/x-template"> 2197 {{#.}} 2198 <div class="js-mini-cart-counter-content dw-mod"> 2199 @if (showPriceInMiniCartCounter) { 2200 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 2201 } else { 2202 <text>{{numberofproducts}}</text> 2203 } 2204 </div> 2205 {{/.}} 2206 </script> 2207 2208 <script id="MiniCartContent" type="text/x-template"> 2209 {{#.}} 2210 @if (useGoogleTagManager) 2211 { 2212 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 2213 } 2214 <div class="mini-cart-dropdown__inner {{isempty}} dw-mod"> 2215 <h4 class="u-ta-center u-no-margin u-margin-bottom u-margin-top">@Translate("Shopping cart")</h4> 2216 <div class="mini-cart-dropdown__body dw-mod"> 2217 <table class="table mini-cart-table dw-mod"> 2218 @RenderBlockList(subBlocks) 2219 </table> 2220 </div> 2221 2222 <table class="table mini-cart-table dw-mod"> 2223 <tr class="mini-cart-orderlines__footer dw-mod"> 2224 <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> 2225 <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> 2226 </tr> 2227 </table> 2228 </div> 2229 {{/.}} 2230 </script> 2231 2232 <script id="MiniCartOrderline" type="text/x-template"> 2233 <tr class="{{isempty}}"> 2234 <td style="width:50px;"><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> 2235 <td> 2236 <a href="{{link}}" class="mini-cart-orderlines__name" title="{{name}}">{{name}}</a> 2237 {{#if variantname}} 2238 <a href="{{link}}" class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{variantname}}</a> 2239 {{/if}} 2240 {{#if unitname}} 2241 <div class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{unitname}}</div> 2242 {{/if}} 2243 </td> 2244 <td class="u-ta-right">{{quantity}}</td> 2245 <td class="u-ta-right" style="min-width:150px;"> 2246 {{#if pointsTotal}} 2247 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 2248 {{else}} 2249 {{totalprice}} 2250 {{/if}} 2251 </td> 2252 </tr> 2253 </script> 2254 2255 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 2256 <tr class="table__row--no-border {{isempty}}"> 2257 <td>&nbsp;</td> 2258 <td><div class="mini-cart-orderlines__name dw-mod">{{name}}</div></td> 2259 <td class="u-ta-right">{{discountpercent}}</td> 2260 <td class="u-ta-right">{{totalprice}}</td> 2261 </tr> 2262 </script> 2263 2264 if (!onlyPreview && addingToCartNotification == "modal") 2265 { 2266 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 2267 2268 <script id="LastAddedProductTemplate" type="text/x-template"> 2269 <!-- Trigger for the login modal --> 2270 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> 2271 2272 <!-- Login modal --> 2273 <div class="modal-container"> 2274 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> 2275 <div class="modal modal--md"> 2276 <div class="modal__header"> 2277 <h2>@Translate("Product is added to the cart")</h2> 2278 </div> 2279 <div class="modal__body"> 2280 <div class="grid"> 2281 <div> 2282 <a href="{{productInfo.link}}"><img src="{{productInfo.image}}" alt="{{productInfo.name}}" /></a> 2283 </div> 2284 <div class="u-padding"> 2285 <span>{{quantity}}</span> x 2286 </div> 2287 <div class="grid__col-auto"> 2288 <div>{{productInfo.name}}</div> 2289 {{#if productInfo.variantName}} 2290 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 2291 {{/if}} 2292 {{#if productInfo.unitName}} 2293 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 2294 {{/if}} 2295 </div> 2296 </div> 2297 <div class="modal__footer u-margin-top--lg"> 2298 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> 2299 <a href="/cart" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a> 2300 </div> 2301 </div> 2302 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> 2303 </div> 2304 </div> 2305 </script> 2306 <script> 2307 document.addEventListener('addToCart', function (event) { 2308 Cart.ShowLastAddedProductModal(event.detail); 2309 }); 2310 </script> 2311 } 2312 else if (!onlyPreview && addingToCartNotification == "toggle") 2313 { 2314 <script> 2315 document.addEventListener('addToCart', function () { 2316 Cart.ToggleMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 2317 }); 2318 </script> 2319 } 2320 } 2321 2322 @helper RenderMiniCartHeader() { 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 <text> 2335 {{#OrderLines}} 2336 {{#ifCond template "===" "CartOrderline"}} 2337 {{>MiniCartOrderline}} 2338 {{/ifCond}} 2339 {{#ifCond template "===" "CartOrderlineMobile"}} 2340 {{>MiniCartOrderline}} 2341 {{/ifCond}} 2342 {{#ifCond template "===" "CartOrderlineDiscount"}} 2343 {{>MiniCartOrderlineDiscount}} 2344 {{/ifCond}} 2345 {{/OrderLines}} 2346 </text> 2347 } 2348 2349 @helper RenderMiniCartFees() { 2350 <text> 2351 {{#ifEquals paymentfee "Free"}} 2352 2353 {{else}} 2354 <tr> 2355 2356 <td class="u-ta-center"><i class="fas fa-credit-card"></i></td> 2357 <td>{{paymentmethod}}</td> 2358 <td colspan="2" class="u-ta-right" width="130">{{paymentfee}}</td> 2359 2360 </tr> 2361 {{/ifEquals}} 2362 {{#if OrderShippingMessage}} 2363 <td colspan="4"> 2364 <div class="u-pull--right">{{OrderShippingMessage}}</div> 2365 </td> 2366 {{else}} 2367 {{#ifEquals shippingfee "Free"}} 2368 2369 {{else}} 2370 <tr> 2371 {{#ifEquals shippingmethod "INVALID"}} 2372 <td colspan="4"> 2373 <div class="u-pull--right">@Translate("Your shipping fee cannot be calculated because of country you selected.")</div> 2374 </td> 2375 {{else}} 2376 2377 <td class="u-ta-center"><i class="fas fa-truck"></i></td> 2378 <td>{{shippingmethod}}</td> 2379 <td colspan="2" class="u-ta-right" width="130">{{shippingfee}}</td> 2380 {{/ifEquals}} 2381 2382 </tr> 2383 {{/ifEquals}} 2384 {{/if}} 2385 </text> 2386 } 2387 2388 @helper RenderMiniCartPoints() { 2389 <text> 2390 {{#if earnings}} 2391 <tr> 2392 <td colspan="2">@Translate("Earnings")</td> 2393 <td colspan="2" class="u-ta-right" width="130"><span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")</td> 2394 </tr> 2395 {{/if}} 2396 </text> 2397 } 2398 2399 @helper RenderMiniCartTotal() { 2400 <tr class="mini-cart-totals dw-mod"> 2401 <td colspan="2">@Translate("Total")</td> 2402 <td class="u-ta-right">{{numberofproducts}}</td> 2403 <td class="u-ta-right" width="130">{{totalprice}}</td> 2404 </tr> 2405 } 2406 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2407 2408 @using System 2409 @using System.Web 2410 @using System.Collections.Generic 2411 @using Dynamicweb.Rapido.Blocks.Extensibility 2412 @using Dynamicweb.Rapido.Blocks 2413 @using Dynamicweb.Ecommerce.Common 2414 2415 @{ 2416 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 2417 2418 Block masterScriptReferences = new Block() 2419 { 2420 Id = "MasterScriptReferences", 2421 SortId = 1, 2422 Template = RenderMasterScriptReferences() 2423 }; 2424 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 2425 } 2426 2427 @helper RenderMasterScriptReferences() { 2428 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.11.js"></script> 2429 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 2430 2431 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 2432 <script> 2433 function redirectWitEmptyCart(loc) { 2434 const cartEvent = new Event('deleteCart'); 2435 Cart.EmptyCart(cartEvent); 2436 window.location =loc 2437 2438 } 2439 2440 </script> 2441 } 2442 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2443 2444 @using System 2445 @using System.Web 2446 @using System.Collections.Generic 2447 @using Dynamicweb.Rapido.Blocks.Extensibility 2448 @using Dynamicweb.Rapido.Blocks 2449 2450 @{ 2451 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 2452 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 2453 2454 if (!navigationItemsHideSearch) 2455 { 2456 Block masterSearchScriptTemplates = new Block() 2457 { 2458 Id = "MasterSearchScriptTemplates", 2459 SortId = 1, 2460 Template = RenderSearchScriptTemplates() 2461 }; 2462 2463 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 2464 } 2465 } 2466 2467 @helper RenderSearchScriptTemplates() 2468 { 2469 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 2470 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 2471 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 2472 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2473 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 2474 2475 <script id="SearchGroupsTemplate" type="text/x-template"> 2476 {{#.}} 2477 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 2478 {{/.}} 2479 </script> 2480 2481 <script id="SearchProductsTemplate" type="text/x-template"> 2482 {{#each .}} 2483 {{#Product}} 2484 {{#ifCond template "!==" "SearchMore"}} 2485 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2486 @if (useFacebookPixel) 2487 { 2488 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 2489 } 2490 @if (useGoogleTagManager) 2491 { 2492 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 2493 } 2494 <div> 2495 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 2496 <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> 2497 <div class="u-pull--left"> 2498 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 2499 @if (!onlyPreview) 2500 { 2501 <div>{{price}}</div> 2502 } 2503 </div> 2504 </a> 2505 <div class="u-margin-left u-pull--right u-w80px"> 2506 <button class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 2507 onclick="Cart.AddToCart(event, { 2508 id: '{{productId}}', 2509 quantity: 1, 2510 productInfo: {{productInfo}} 2511 }); {{facebookPixelAction}}"> 2512 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 2513 </button> 2514 <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> 2515 </div> 2516 </div> 2517 </li> 2518 {{/ifCond}} 2519 {{#ifCond template "===" "SearchMore"}} 2520 {{>SearchMoreProducts}} 2521 {{/ifCond}} 2522 {{/Product}} 2523 {{else}} 2524 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2525 @Translate("Your search gave 0 results") 2526 </li> 2527 {{/each}} 2528 </script> 2529 2530 <script id="SearchMoreProducts" type="text/x-template"> 2531 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 2532 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 2533 @Translate("View all") 2534 </a> 2535 </li> 2536 </script> 2537 2538 <script id="SearchMorePages" type="text/x-template"> 2539 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 2540 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 2541 @Translate("View all") 2542 </a> 2543 </li> 2544 </script> 2545 2546 <script id="SearchPagesTemplate" type="text/x-template"> 2547 {{#each .}} 2548 {{#ifCond template "!==" "SearchMore"}} 2549 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2550 <div> 2551 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 2552 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 2553 <div class="u-pull--left"> 2554 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 2555 </div> 2556 </a> 2557 </div> 2558 </li> 2559 {{/ifCond}} 2560 {{#ifCond template "===" "SearchMore"}} 2561 {{>SearchMorePages}} 2562 {{/ifCond}} 2563 {{else}} 2564 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2565 @Translate("Your search gave 0 results") 2566 </li> 2567 {{/each}} 2568 </script> 2569 2570 <script id="SearchPagesTemplateWrap" type="text/x-template"> 2571 <div class="dropdown__column-header">@Translate("Pages")</div> 2572 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 2573 {{>SearchPagesTemplate}} 2574 </ul> 2575 </script> 2576 2577 <script id="SearchProductsTemplateWrap" type="text/x-template"> 2578 <div class="dropdown__column-header">@Translate("Products")</div> 2579 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 2580 {{>SearchProductsTemplate}} 2581 </ul> 2582 </script> 2583 } 2584 2585 2586 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2587 2588 @using System 2589 @using System.Web 2590 @using System.Collections.Generic 2591 @using Dynamicweb.Rapido.Blocks.Extensibility 2592 @using Dynamicweb.Rapido.Blocks 2593 2594 @{ 2595 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 2596 2597 Block primaryBottomSnippets = new Block() 2598 { 2599 Id = "MasterJavascriptInitializers", 2600 SortId = 1, 2601 Template = RenderPrimaryBottomSnippets() 2602 }; 2603 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 2604 } 2605 2606 @helper RenderPrimaryBottomSnippets() { 2607 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode") != null ? Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode") : false; 2608 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2609 2610 <script> 2611 //Wireframe.Init(@Converter.ToString(isWireframeMode).ToLower()); 2612 </script> 2613 2614 <script> 2615 document.addEventListener("shiftSlide", function () { 2616 if (bLazy != null) { 2617 bLazy.revalidate(); 2618 } 2619 }); 2620 2621 </script> 2622 if (useGoogleTagManager) 2623 { 2624 <script> 2625 document.addEventListener('addToCart', function(event) { 2626 var googleImpression = event.detail.cartItem.productInfo.googleImpression; 2627 dataLayer.push({ 2628 'event': 'addToCart', 2629 'ecommerce': { 2630 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency()', 2631 'add': { 2632 'products': [{ 2633 'name': googleImpression.name, 2634 'id': googleImpression.id, 2635 'price': googleImpression.price, 2636 'brand': googleImpression.brand, 2637 'category': googleImpression.category, 2638 'variant': googleImpression.variant, 2639 'quantity': event.detail.cartItem.quantity 2640 }] 2641 } 2642 } 2643 }); 2644 }); 2645 </script> 2646 } 2647 2648 <!--@Javascripts--> 2649 } 2650 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2651 2652 @using System 2653 @using System.Web 2654 @using System.Collections.Generic 2655 @using Dynamicweb.Rapido.Blocks 2656 2657 @{ 2658 BlocksPage masterBlocksBlocksPage = BlocksPage.GetBlockPage("Master"); 2659 2660 } 2661 2662 <!DOCTYPE html> 2663 2664 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 2665 <head> 2666 <meta charset="utf-8" /> 2667 <title>@Model.Title</title> 2668 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> 2669 <meta name="robots" content="index, follow"> 2670 2671 <!-- Favicon --> 2672 <link href="@favicon" rel="icon" type="image/png"> 2673 2674 <!-- Font awesome --> 2675 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css" type="text/css"> 2676 2677 <!-- Flag icon --> 2678 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/css/flag-icon.min.css" type="text/css"> 2679 2680 <!-- Base (Default, wireframe) styles --> 2681 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 2682 2683 <!-- Rapido Css from Website Settings --> 2684 <link id="rapidoCss" rel="stylesheet" href="@autoCssLink" type="text/css"> 2685 2686 <!-- Ignite Css (Custom site specific styles) --> 2687 <link id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css" rel="stylesheet"> 2688 2689 <!-- Google fonts --> 2690 @{ 2691 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))); 2692 } 2693 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 2694 </head> 2695 2696 <body> 2697 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 2698 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 2699 2700 2701 @helper RenderMasterHeader() { 2702 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 2703 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 2704 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 2705 2706 <header class="top-container @stickyTop dw-mod" id="Top"> 2707 @RenderBlockList(subBlocks) 2708 </header> 2709 } 2710 2711 @helper RenderMain() { 2712 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 2713 2714 <main class="site dw-mod"> 2715 @RenderBlockList(subBlocks) 2716 </main> 2717 } 2718 2719 @helper RenderPageContent() { 2720 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 2721 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 2722 2723 <div id="Page" class="page @pagePos"> 2724 <section class="center-container content-container dw-mod" id="content"> 2725 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2726 2727 2728 @{ 2729 string columnClass = "12"; 2730 bool isProductPage = HttpContext.Current.Request.QueryString.Get("ProductID") != null ? true : false; 2731 string backgroundColorClass = Model.PropertyItem.GetString("BackgroundColor") != null && !isProductPage ? "u-" + Model.PropertyItem.GetList("BackgroundColor").SelectedValue + "--bg" : ""; 2732 } 2733 2734 @if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 2735 { 2736 <div class="grid__col-12 grid__col--bleed-y"> 2737 @RenderNavigation(new 2738 { 2739 id = "breadcrumb", 2740 template = "Breadcrumb.xslt" 2741 }) 2742 </div> 2743 } 2744 2745 <div class="grid"> 2746 @if (Model.PropertyItem.GetList("LeftMenu") != null && Model.PropertyItem.GetList("LeftMenu").SelectedValue == "True" && (Pageview.Page.NavigationSettings == null || !Pageview.Page.NavigationSettings.UseEcomGroups)) 2747 { 2748 var navigationMarkup = RenderNavigation(new 2749 { 2750 id = "leftnav", 2751 cssclass = "dwnavigation", 2752 startLevel = 2, 2753 expandmode = "all", 2754 endlevel = 5, 2755 template = "LeftNavigation.xslt" 2756 }); 2757 2758 if (!string.IsNullOrEmpty(navigationMarkup)) 2759 { 2760 <nav class="grid__col-md-3"> 2761 <div class="grid__cell"> 2762 @navigationMarkup 2763 </div> 2764 </nav> 2765 columnClass = "9"; 2766 } 2767 } 2768 <div class="grid__col-md-@columnClass grid__col--bleed"> 2769 <div class="grid"> 2770 @Model.Placeholder("dwcontent", "content", "default:true;sort:1") 2771 </div> 2772 </div> 2773 </div> 2774 2775 2776 @* Very small hack to make it cleanly, and easily possible to change the background color on a single page *@ 2777 @if (backgroundColorClass != "") 2778 { 2779 <script> 2780 document.getElementById("Page").classList.add("@backgroundColorClass"); 2781 </script> 2782 } 2783 </section> 2784 </div> 2785 } 2786 2787 <input type="checkbox" id="SelectToChangeLanguageTrigger" class="modal-trigger"> 2788 <div class="modal-container"> 2789 <label for="SelectToChangeLanguageTrigger" id="SelectToChangeLanguageModalOverlay" class="modal-overlay"></label> 2790 <div class="modal modal--md" id="SelectToChangeLanguageModal"> 2791 <div class="modal__header"> 2792 <h2>@Translate("Changing language")<label for="SelectToChangeLanguageTrigger" class="u-pull--right">X</label></h2> 2793 </div> 2794 <div class="modal__body"> 2795 <p class="u-no-margin" id="SelectToChangeLanguageText2">@Translate("You are changing language. If you continue, basket will be cleared. Do you wish to continue?")</p> 2796 <div class="product-list__grid-item__footer dw-mod" style="border:0;"> 2797 <label for="SelectToChangeLanguageTrigger" class="btn u-margin-left--lg btn--secondary btn--condensed u-no-margin u-pull--right dw-mod">@Translate("No")</label> 2798 <button class="btn btn--primary btn--condensed u-no-margin u-pull--right dw-mod" onclick="" id="ChangeLanguageButton">@Translate("Yes")</button> 2799 2800 </div> 2801 </div> 2802 </div> 2803 </div> 2804 2805 </body> 2806 </html> 2807 2808