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