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_423240d3214a4038842add8f439d712b.<RenderPageContent>b__64_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\ScangribStaging\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2790
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_423240d3214a4038842add8f439d712b.<>c__DisplayClass4_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\ScangribStaging\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 274
   at CompiledRazorTemplates.Dynamic.RazorEngine_423240d3214a4038842add8f439d712b.<>c__DisplayClass3_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\ScangribStaging\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 240
   at CompiledRazorTemplates.Dynamic.RazorEngine_423240d3214a4038842add8f439d712b.<RenderMain>b__63_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\ScangribStaging\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2773
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_423240d3214a4038842add8f439d712b.<>c__DisplayClass4_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\ScangribStaging\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 274
   at CompiledRazorTemplates.Dynamic.RazorEngine_423240d3214a4038842add8f439d712b.<>c__DisplayClass3_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\ScangribStaging\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 240
   at CompiledRazorTemplates.Dynamic.RazorEngine_423240d3214a4038842add8f439d712b.<>c__DisplayClass4_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\ScangribStaging\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 281
   at CompiledRazorTemplates.Dynamic.RazorEngine_423240d3214a4038842add8f439d712b.<>c__DisplayClass3_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\ScangribStaging\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 240
   at CompiledRazorTemplates.Dynamic.RazorEngine_423240d3214a4038842add8f439d712b.Execute() in D:\dynamicweb.net\Solutions\ScangribStaging\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2753
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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