Error parsing template "Designs/RizzoDesignFolder/eCom/Product/ProductRedirect.cshtml"
Line 815: Unexpected "if" keyword after "@" character.  Once inside code, you do not need to prefix constructs like "if" with "@".
1 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 2 @using Dynamicweb.Rendering; 3 4 @if(!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["detail"]) && GetInteger("Ecom:Product.PrimaryOrCurrentPageID") != Pageview.Page.ID) 5 { 6 string redirect = "/Default.aspx?ID=" + GetString("Ecom:Product.PrimaryOrCurrentPageID") + "&ProductID=" + GetString("Ecom:Product.ID"); 7 if(!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.QueryString["variantID"])) 8 { 9 redirect += "&variantID=" + System.Web.HttpContext.Current.Request.QueryString["variantID"].ToString(); 10 } 11 System.Web.HttpContext.Current.Response.Redirect(Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(redirect)); 12 } 13 @using System.Collections.Generic 14 @using System.Dynamic 15 @using System.Globalization 16 @using System.Text.RegularExpressions 17 @using System.Web 18 @using Co3.JUC.Website.Models.Frontend 19 @using Dynamicweb.eCommerce.Cart.ShippingProviders.GLSwsPakkeshop 20 @using Dynamicweb.eCommerce.Products 21 @using Dynamicweb.Frontend 22 @inherits Dynamicweb.Rendering.RazorTemplateBase< Dynamicweb.Rendering.RazorTemplateModel< Dynamicweb.Rendering.Template > > 23 @using System; 24 @using Group = Dynamicweb.eCommerce.Products.Group 25 @{ string designName = GetString("Template:DesignBaseUrl").Replace("/Files/Templates/Designs/", "").Replace("/", ""); }@functions{ 26 public static string GetImage(string sourceString, int imageWidth, int imageHeight, int imageWidthTablet = 0, int imageHeightTablet = 0, int imageWidthMobile = 0, int imageHeightMobile = 0, string imageFormat = "jpg", int imageCompression = 0, int imageCrop = 5, string background = "", string designName = "RizzoDesignFolder") 27 { 28 Dynamicweb.Frontend.PageView currentPageview = Dynamicweb.Frontend.PageView.Current(); 29 string currDevice = currentPageview.Device.ToString(), 30 alternativeImage = currentPageview.Area.Item["NoImage"] != null ? currentPageview.Area.Item["NoImage"].ToString() : "/Files/Templates/Designs/"+ designName + "/images/alternativeImage.jpg", 31 widthString = "", 32 heightString = "", 33 getImageFormat = imageFormat != "jpg" ? "&amp;Format=" + imageFormat : "", 34 getImageCompression = imageCompression != 0 ? "&amp;Compression=" + imageCompression : "", 35 bgColor = !string.IsNullOrEmpty(background) ? "&amp;backgroud="+background : ""; 36 int getImageWidth = imageWidth != 0 ? imageWidth : 0, 37 getImageHeight = imageHeight != 0 ? imageHeight : 0; 38 39 if (currDevice == Dynamicweb.Frontend.PageView.DeviceType.Tablet.ToString()) 40 { 41 getImageWidth = imageWidthTablet != 0 ? imageWidthTablet : getImageWidth; 42 getImageHeight = imageHeightTablet != 0 ? imageHeightTablet : getImageHeight; 43 } 44 else if (currDevice == Dynamicweb.Frontend.PageView.DeviceType.Mobile.ToString()) 45 { 46 getImageWidth = imageWidthMobile != 0 ? imageWidthMobile : getImageWidth; 47 getImageHeight = imageHeightMobile != 0 ? imageHeightMobile : getImageHeight; 48 } 49 50 if (getImageWidth != 0) 51 { 52 widthString = "&amp;Width=" + getImageWidth; 53 } 54 if (getImageHeight != 0) 55 { 56 heightString = "&amp;Height=" + getImageHeight; 57 } 58 59 string output = "/Admin/Public/GetImage.ashx?Image=" + sourceString + widthString + heightString + "&amp;altFmImage_path=" + alternativeImage + getImageFormat + getImageCompression + "&amp;Crop=" + imageCrop + bgColor; 60 return output; 61 } 62 } 63 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 64 @using Dynamicweb.Rendering; 65 66 @functions{ 67 private string GetImagePathUrl(string small, string medium, string large, string pattern) 68 { 69 string imagePath; 70 71 if (!string.IsNullOrEmpty(small)) 72 imagePath = small; 73 else if (!string.IsNullOrEmpty(medium)) 74 imagePath = medium; 75 else if (!string.IsNullOrEmpty(large)) 76 imagePath = large; 77 else 78 imagePath = pattern; 79 80 return imagePath; 81 } 82 } 83 @{ 84 var areaItem = Pageview.Area.Item; 85 86 bool isLoggedIn = Pageview.User.LoggedIn, 87 isFrontEnd = Dynamicweb.ExecutingContext.IsFrontEnd(), 88 productIsFavorite = GetBoolean( "Ecom:Product.IsProductInFavoriteList" ); 89 90 string areaid = Pageview.GlobalTags.GetTagByName( "Global:Area.ID" ).Value, 91 currentPageId = Pageview.Page.ID.ToString(), 92 variantDefaultId = GetString( "Ecom:Product.DefaultVariantComboID" ), 93 variantCurrentId = GetString( "Ecom:Product.VariantID" ), 94 variantId = !string.IsNullOrEmpty( variantCurrentId ) ? variantCurrentId : variantDefaultId, 95 titleKey = "title", 96 title = "", 97 imageKey = "image", 98 image = "", 99 stockStatus = GetInteger( "Ecom:Product.Stock" ) > 0 ? "fa-check" : "fa-close", 100 stockStatusID = GetString( "Ecom:Product:Stock.ID" ), 101 productId = GetString( "Ecom:Product.ID" ), 102 productLanguage = GetString( "Ecom:Product.LanguageID" ), 103 productName = GetString( "Ecom:Product.Name" ), 104 productNumber = GetString( "Ecom:Product.Number" ).Trim(), 105 pattern = "", 106 productImage = GetImagePathUrl( GetString( "Ecom:Product.ImageSmall.Clean" ), GetString( "Ecom:Product.ImageMedium.Clean" ), GetString( "Ecom:Product.ImageLarge.Clean" ), pattern ), 107 productGetImage = GetImage( productImage, 0, 600 ), 108 imagesFolder = "/Files/Files/" + designName + "/Products/", 109 imagePattern = "/Files/Images/SocialeMedier/" + productNumber + ".jpg", 110 standardProdImg = "/Files/Templates/Designs/RizzoDesignFolder/images/JUC_logo.png", 111 productIntro = GetString( "Ecom:Product.MetaDescription" ), 112 productDescription = GetString( "Ecom:Product.LongDescription" ), 113 pointPrice = GetString( "Ecom:Product.PointPrice" ), 114 productDetails = GetString( "Ecom:Product:Field.Details.Value.Clean" ), 115 productWarranty = GetString( "Ecom:Product:Field.Warranty.Value.Clean" ), 116 ShowFoaLogo = GetString( "Ecom:Product:Field.ShowFoaLogo.Value.Clean" ), 117 productPrice = GetString( "Ecom:Product.Price.PriceWithoutVAT" ).Replace( ",00", "" ), 118 currency = GetString( "Ecom:Product.Price.Currency.Symbol" ), 119 currencyCode = GetString( "Ecom:Order.Price.CurrencyCode" ), 120 productPriceDB = GetString( "Ecom:Product.DBPrice" ), 121 productRemoveFromList = "/Default.aspx?Id=" + currentPageId + "&amp;ProductID=" + productId + "&amp;CCRemoveFromMyLists=" + productId + "&amp;CCRemoveFromListVariantID=" + variantId + "&amp;CCRemoveFromListLanguageID=" + productLanguage, 122 productAddToList = "/Default.aspx?Id=" + currentPageId + "&amp;ProductID=" + productId + "&amp;CCAddToMyLists=" + productId + "&amp;CCAddToListVariantID=" + variantId + "&amp;CCAddToListLanguageID=" + productLanguage, 123 favoriteUrl = productIsFavorite ? productRemoveFromList : productAddToList, 124 // Filter for downloads item 125 downloadsFilter = "Products contains 'p_" + productId + ",' or Products contains 'p_" + productId + ":' or Products ends with 'p_" + productId + "'", 126 nrLectures = GetString( "Ecom:Product:Field.Lectures.Value.Clean" ), 127 nrLecturesDecimal = GetString( "Ecom:Product:Field.LecturesDecimal.Value.Raw" ), 128 video = GetString( "Ecom:Product:Field.video.FullPath" ), 129 poster = GetString( "Ecom:Product:Field.poster.FullPath" ), 130 groupId = GetString( "Ecom:Product.PrimaryOrFirstGroupID" ), 131 parentGroupId = groupId, 132 pageGroupUrl = String.Format( "/Default.aspx?Id={0}&amp;groupid={1}#open", currentPageId, parentGroupId ), 133 pageGroupPrimaryPageUrl = "", 134 stock = GetString( "Ecom:Product:Stock.Text" ), 135 nrDay = GetString( "Ecom:Product:Field.Day.Value.Clean" ), 136 nrMonth = GetString( "Ecom:Product:Field.Month.Value.Clean" ), 137 nrYear = GetString( "Ecom:Product:Field.Year.Value.Clean" ), 138 nrAdress = GetString( "Ecom:Product:Field.locationEvent.Value.Clean" ), /* HUAH: old one*/ 139 courseEventLocation = GetString( "Ecom:Product:Field.LokationAfBegivenhed.Value.Clean" ), 140 OpenGraphTitle = GetString( "Ecom:Product:Field.OpenGraphTitle.Value.Clean" ), 141 OpenGraphDescription = GetString( "Ecom:Product:Field.OpenGraphDescription.Value.Clean" ), 142 OpenGraphImage = GetString( "Ecom:Product:Field.OpenGraphImage2.Value" ), 143 stockNumber = GetString( "Ecom:Product.Stock" ); 144 145 int stockNumberInt = Int32.Parse( stockNumber ); 146 147 string firstActivityStartDate = ""; 148 string lastActivityEndDate = ""; 149 150 var nrCompleteDate = nrDay + "/" + nrMonth + "/" + nrYear; 151 152 DateTime productFieldDateStart = DateTime.Now; 153 154 var imagesList = new List< Dictionary< string, string > >(); 155 156 var relatedGroupsList = GetLoop( "ProductRelatedGroups" ); 157 158 var currentGroup = Dynamicweb.eCommerce.Products.Group.GetGroupByID( groupId, productLanguage ); 159 string parentGroupName = currentGroup.Name; 160 var parentGroups = currentGroup.ParentGroupsDefaultLanguage; 161 162 if ( parentGroups.Any() ) 163 { 164 var parentGroup = parentGroups.FirstOrDefault(); 165 166 parentGroupId = parentGroup.ID.ToString(); 167 parentGroupName = parentGroup.Name; 168 pageGroupUrl = String.Format( "/Default.aspx?Id={0}&amp;groupid={1}#open", currentPageId, parentGroupId ); 169 pageGroupPrimaryPageUrl = parentGroup.Meta.PrimaryPage.ToString(); 170 } 171 var productCanonical = GetGlobalValue( "Global:Request.Scheme" ) + "://" + GetGlobalValue( "Global:Request.Host" ) + GetGlobalValue( "Global:Pageview.Url" ); 172 var productMetaTitle = GetString( "Ecom:Product.Name" ); 173 var productMetaDescription = GetString( "Ecom:Product.MetaDescription" ); 174 var shareWithEmailBody = Translate( "shareWithEmailBody", "Jeg anbefaler dig at kigge på denne side:" ); 175 var productType = GetString( "Ecom:Product.CategoryField.Product.Type.Value" ); 176 var productDay = 0; 177 var productMonth = 0; 178 var productYear = 0; 179 productDay = GetInteger( "Ecom:Product:Field.Day.Value" ); 180 productMonth = GetInteger( "Ecom:Product:Field.Month.Value" ); 181 productYear = GetInteger( "Ecom:Product:Field.Year.Value" ); 182 var courseIsActive = isActive( productMonth, productYear, productDay ); 183 bool maskClassActive = false; 184 if ( GetString( "Ecom:Product:Field.ShowFoaLogo.Value" ) == "True" ) 185 { 186 maskClassActive = true; 187 } 188 } 189 190 @if ( GetInteger( "Ecom:Product.PrimaryOrCurrentPageID" ) != Pageview.Page.ID ) 191 { 192 var redirect = "/Default.aspx?ID=" + GetString( "Ecom:Product.PrimaryOrCurrentPageID" ) + "&ProductID=" + GetString( "Ecom:Product.ID" ); 193 if ( !string.IsNullOrEmpty( HttpContext.Current.Request.QueryString[ "variantID" ] ) ) 194 { 195 redirect += "&variantID=" + HttpContext.Current.Request.QueryString[ "variantID" ]; 196 } 197 HttpContext.Current.Response.Redirect( SearchEngineFriendlyURLs.GetFriendlyUrl( redirect ) ); 198 } 199 else if ( !String.IsNullOrEmpty( pageGroupPrimaryPageUrl ) ) 200 { 201 var currentPageUrl = "Default.aspx?Id=" + Pageview.Page.ID; 202 if ( currentPageUrl.ToLower() != pageGroupPrimaryPageUrl.ToLower() ) 203 { 204 pageGroupPrimaryPageUrl = pageGroupPrimaryPageUrl + "&ProductID=" + GetString( "Ecom:Product.ID" ); 205 HttpContext.Current.Response.Redirect( SearchEngineFriendlyURLs.GetFriendlyUrl( pageGroupPrimaryPageUrl ) ); 206 } 207 } 208 209 @SnippetStart( "productTracking" ) 210 <script> 211 fbq('track', 212 'ViewContent', 213 { 214 content_name: '@productName', 215 content_ids: ['@productId'], 216 content_type: 'product', 217 value: @productPriceDB, 218 currency: 'DKK' 219 }); 220 221 </script> 222 @SnippetEnd( "productTracking" ) 223 224 <div id="product-container" data-pageId="@currentPageId" data-productId="@productId" data-variantId="@variantId" data-errorCombination1='@Translate( "combinationNotAvailable", "Kombinationen findes ikke" )'> 225 226 <article class="col-xs-12 noPadding" id="product-description"> 227 <div class="col-sm-8 col-xs-12 noPaddingLeft product-column" id="leftSide"> 228 229 <div> 230 <div class="smartbuttons"> 231 <a href="javascript:window.print();" id="smart_print"></a> 232 </div> 233 <h2> 234 @productName 235 </h2> 236 @if ( GetString( "Ecom:Product:Field.ShowFoaLogo.Value" ) == "True" ) 237 { 238 <div class="mask maskLeft"> 239 <a href="/uber-juc/pflichtfortbildung-fur-fachanwalte-nach-§15-fao.aspx"> 240 <img alt="" src="/Files/Templates/Designs/RizzoDesignFolder/images/foalogo_small.png" width="120px" /> 241 </a> 242 </div> 243 } 244 245 @if ( !String.IsNullOrEmpty( productImage ) ) 246 { 247 <div id="product-image"> 248 <figure> 249 <img class="img-responsive" src="@productGetImage" alt="@productName" title="@productName" /> 250 </figure> 251 </div> 252 } 253 254 <div id="product-description"> 255 256 @if ( !String.IsNullOrEmpty( video ) ) 257 { 258 <video id="video" width="100%" preload controls poster="@poster" onclick="this.play();"> 259 <source src="@video" type="video/mp4"> 260 Din browser understøtter ikke video. 261 </video> 262 } 263 <br /> 264 265 @productDescription 266 267 </div> 268 269 <div class="share-wrapper"> 270 <h2> 271 <strong>@Translate( "shareSoMeHeader", "Share" )</strong> 272 </h2> 273 <div class="share-wrapper-inner"> 274 <ul class="social-inner"> 275 <li class="facebook"> 276 <a class="dk-share" href="https://www.facebook.com/sharer/sharer.php?u=@productCanonical" title="Share on Facebook" alt="Share on Facebook" target="_blank"> 277 <img alt="Facebook Icon" src="/Files/Images/Icons/facebook.png"> 278 <p class="share-text">Facebook</p> 279 </a> 280 </li> 281 <li class="linkedin"> 282 <a class="dk-share" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=@productCanonical&amp;title=@productMetaTitle&amp;summary=@productMetaDescription" title="Share on LinkedIn" alt="Share on LinkedIn" target="_blank"> 283 <img alt="LinkedIn Icon" src="/Files/Images/Icons/linkedin.png"> 284 <p class="share-text">LinkedIn</p> 285 </a> 286 </li> 287 <li class="epost"> 288 <a class="share-email" href="mailto:?subject=@productMetaTitle&amp;body=@shareWithEmailBody @productCanonical" title="Share with e-mail"> 289 <img alt="Email Icon" src="/Files/Images/Icons/email.png"> 290 <p class="share-text">E-mail</p> 291 </a> 292 </li> 293 </ul> 294 </div> 295 </div> 296 </div> 297 </div> 298 299 <div id="rightSide" class="col-xs-12 col-sm-4 product-column noPaddingRight @stockStatusID"> 300 301 @if ( stockStatusID != "STOCKSTATUS3" ) 302 { 303 <form name="addToCart" class="add-to-cart form-fields hidden-lg hidden-md hidden-sm" action="@SearchEngineFriendlyURLs.GetFriendlyUrl( currentPageId )" method="post" data-outofstock='@Translate( "outOfStock", "Out of stock" )'> 304 <input name="cartcmd" type="hidden" value="add" /> 305 <input type="hidden" name="productID" value="@productId" /> 306 <input name="EcomOrderLineFieldInput_dateNow" type="hidden" value="" /> 307 <input name="EcomOrderLineFieldInput_customerName" type="hidden" value="" /> 308 <input name="EcomOrderLineFieldInput_email" type="hidden" value="" /> 309 <input name="EcomOrderLineFieldInput_title" type="hidden" value="" /> 310 <input type="hidden" name="EcomOrderLineFieldInput_MaterialIDSystem" value="" class="@productNumber" /> 311 <input name="EcomOrderLineFieldInput_participate" type="hidden" value="" /> 312 <textarea class="js-courseActivities" name="EcomOrderLineFieldInput_courseActivities" style="display:none"></textarea> 313 <textarea class="js-courseLocation" name="EcomOrderLineFieldInput_courseLocation" style="display:none"></textarea> 314 <a class="addToCartSubmit" href="javascript:void(0);" data-add='@Translate( "addToCart", "Læg i kurven" )' data-added='@Translate( "added", "Lagt til" )'> 315 <img class="addToCartIcon" src="/files/templates/designs/rizzodesignfolder/images/svgicons/cart.svg"> 316 @Translate( "addToCart_" + productType, "Læg i kurven" ) 317 </a> 318 319 <input class="hidden" type="submit" value='@Translate( "addToCart" )' /> 320 </form> 321 } 322 323 <div style="float: left; width: 100%; overflow: hidden;"> 324 <div style="@( courseIsActive ? "" : "hide" )"> 325 <h3>@Translate( "keepMedUpdatedHeader", "Hold mig opdateret" )</h3> 326 <p class="keepMeUpdated_text">@Translate( "keepMeUpdatedProductText", "Er du nysgerrig og vil vide mere?" )</p> 327 <p class="keepMeUpdatedIntro" style="display: none">@Translate( "keepMeUpdatedIntro", "" )</p> 328 </div> 329 <div id="keepMeUpdated_course"> 330 <h3 style="@( courseIsActive ? "" : "hide" )" class="expand" id="keepMeUpdated_header">@Translate( "keepMedUpdatedButton", "Hold mig opdateret" )</h3> 331 <div class="expandItem" id="keepMeUpdated_form" style="display: none"> 332 @if ( areaid == "1" ) 333 { 334 @RenderParagraphContent( 761 ) 335 ; 336 } 337 @if ( areaid == "9" ) 338 { 339 @RenderParagraphContent( 764 ) 340 ; 341 } 342 @if ( areaid == "8" ) 343 { 344 @RenderParagraphContent( 763 ) 345 ; 346 } 347 @if ( areaid == "5" ) 348 { 349 @RenderParagraphContent( 762 ) 350 ; 351 } 352 </div> 353 </div> 354 355 @if ( areaid == "1" ) 356 { 357 @*Skriv mig op - Inaktive kurser*@ 358 359 if ( !courseIsActive ) 360 { 361 <script>$('.add-to-cart').remove(); </script> 362 } 363 <h3 class="@( courseIsActive ? "hide" : "" )">@Translate( "Skriv mig op", "Skriv mig op" )</h3> 364 365 366 <div class="@( courseIsActive ? "hide" : "" ) @( GetString( "Ecom:Product:Field.ShowFoaLogo.Value" ) == "True" ? "maskActiveClass" : "" )"> 367 368 <p>@Translate( "Kurset er afholdt", "Kurset er afholdt, men hvis du er interesseret i at det genopsættes, så giv os besked. Klik på ”Skriv mig op” herunder og udfyld felterne." )</p> 369 <p>&nbsp;</p> 370 </div> 371 <div id="signup_course"> 372 <h3 class="@( courseIsActive ? "hide" : "" )" class="expand" id="signup_header">@Translate( "Skriv mig op", "Skriv mig op" )</h3> 373 <div class="expandItem" id="signup_form" style="display: none"> 374 @*Hidden signup form extranet + Forms for editors*@ 375 @RenderParagraphContent( 744 ) 376 @RenderParagraphContent( 748 ) 377 378 <p>&nbsp;</p> 379 </div> 380 381 </div> 382 } 383 384 @*Lagerstatus = antal pladser*@ 385 386 @if ( !String.IsNullOrEmpty( stock ) ) 387 { 388 if ( stockStatusID == "STOCKSTATUS3" ) 389 { 390 if ( areaid == "1" || areaid == "9" ) 391 { 392 @*Tilmeld venteliste - Aktive kurser*@ 393 394 var styleDisplayWaitinglist = "display:block"; 395 if ( courseIsActive ) 396 { 397 styleDisplayWaitinglist = "display:block"; 398 } 399 else 400 { 401 styleDisplayWaitinglist = "display:none"; 402 } 403 404 <h3 style="@styleDisplayWaitinglist" class="@stockStatusID">@Translate( "WaitinglistHeader", "Tilmeld venteliste" )</h3> 405 <div style="@styleDisplayWaitinglist"> 406 <p>@Translate( "WaitinglistIntro", "Aktiviteten er fyldt. Skriv dig hurtigt og nemt på ventelisten og kom foran, hvis der bliver en plads ledig." )</p> 407 <p>&nbsp;</p> 408 </div> 409 <div id="Waitinglist_course"> 410 <h3 style="@styleDisplayWaitinglist" id="Waitinglist_header" class="expand">@Translate( "WaitinglistButton", "Tilmeld venteliste" )</h3> 411 <div class="expandItem" id="Waitinglist_form" style="display: none"> 412 @if ( areaid == "1" ) 413 { 414 @RenderParagraphContent( 774 )<p>&nbsp;</p> 415 } 416 417 @if ( areaid == "9" ) 418 { 419 @RenderParagraphContent( 785 )<p>&nbsp;</p> 420 } 421 </div> 422 423 </div> 424 } 425 } 426 else if ( stockStatusID == "STOCKSTATUS2" && stockNumberInt < 8 ) 427 { 428 <h3>OBS!</h3> 429 <p> @stock</p> 430 <p>&nbsp;</p> 431 } 432 } 433 434 @if ( !String.IsNullOrEmpty( nrLectures ) ) 435 { 436 <h3> 437 @Translate( "lectures" ) 438 </h3> 439 440 if ( !String.IsNullOrEmpty( nrLecturesDecimal ) && nrLecturesDecimal != "0" ) 441 { 442 <p>@nrLecturesDecimal</p> 443 } 444 else 445 { 446 <p>@nrLectures</p> 447 } 448 } 449 <p>&nbsp;</p> 450 @if ( GetString( "Ecom:Product:Field.newDateFIelds.Value" ) == "True" ) 451 { 452 <div class="e-com-product-details e-com-product-field"> 453 454 @{ 455 Product product = Product.GetProductByID( GetString( "Ecom:Product.ID" ), GetString( "Ecom:Product.VariantID" ), GetString( "Ecom:Product.LanguageID" ) ); 456 String CurrentHeadline = GetString( "Ecom:Product:Field.outgoingHeadline.Value" ); 457 String CurrentExtra = GetString( "Ecom:Product:Field.outgoingExtra.Value" ); 458 DateTime CurrentStartDate = GetDate( "Ecom:Product:Field.outgoingStartDate.Value" ); 459 DateTime CurrentEndDate = GetDate( "Ecom:Product:Field.outgoingEndDate.Value" ); 460 461 string activityPrefix = "season01Activity"; 462 IEnumerable< ProductFieldValue > fields = product.ProductFieldValues.Where( pfv => pfv.ProductField.SystemName.StartsWith( activityPrefix ) ); 463 464 List< ActivityDay > activityDays = new List< ActivityDay >(); 465 466 bool done = false; 467 int activityDayNumber = 1; 468 469 while ( !done ) 470 { 471 string activityDayPrefix = string.Format( "{0}{1}", activityPrefix, activityDayNumber.ToString( "00" ) ); 472 if ( fields.Any( f => f.ProductField.SystemName.StartsWith( string.Format( "{0}{1}", activityPrefix, activityDayNumber.ToString( "00" ) ) ) ) ) 473 { 474 ProductFieldValue headLine = fields.FirstOrDefault( f => f.ProductField.SystemName == string.Format( "{0}{1}", activityDayPrefix, "Headline" ) ); 475 ProductFieldValue extra = fields.FirstOrDefault( f => f.ProductField.SystemName == string.Format( "{0}{1}", activityDayPrefix, "Extra" ) ); 476 ProductFieldValue startTime = fields.FirstOrDefault( f => f.ProductField.SystemName == string.Format( "{0}{1}", activityDayPrefix, "DateStart" ) ); 477 ProductFieldValue endTime = fields.FirstOrDefault( f => f.ProductField.SystemName == string.Format( "{0}{1}", activityDayPrefix, "DateEnd" ) ); 478 479 ActivityDay nextActivityDay = new ActivityDay() 480 { 481 HeadLine = headLine != null ? headLine.Value as string : string.Empty, 482 Extra = extra != null ? extra.Value as string : string.Empty, 483 StartTime = startTime != null ? ( DateTime ) startTime.Value : default( DateTime ), 484 EndTime = endTime != null ? ( DateTime ) endTime.Value : default( DateTime ) 485 }; 486 if ( nextActivityDay.Valid() ) 487 { 488 activityDays.Add( nextActivityDay ); 489 } 490 } 491 else 492 { 493 done = true; 494 } 495 496 497 activityDayNumber++; 498 } 499 500 <div class="CustomCouseActivity"> 501 @if ( activityDays.Count > 1 ) 502 { 503 <div class="courseLocation"> 504 <p> 505 @courseEventLocation 506 </p> 507 <br /> 508 </div> 509 } 510 511 @if ( CurrentHeadline != "" && CurrentEndDate >= DateTime.Now ) 512 { 513 <div class="first-letter"> 514 <h3>@CurrentHeadline</h3> 515 @if ( CurrentStartDate.Date == CurrentEndDate.Date ) 516 { 517 <p>@CurrentStartDate.ToString( "dddd" ) d. @CurrentStartDate.ToString( "d. MMMM yyyy" )</p> 518 <p>Kl. @CurrentStartDate.ToString( "HH:mm" ) - @CurrentEndDate.ToString( "HH:mm" )</p> 519 } 520 else 521 { 522 <p>Fra @CurrentStartDate.ToString( "dddd" ) d @CurrentStartDate.ToString( "d. MMMM yyyy" ) 523 <br /> 524 kl. @CurrentStartDate.ToString( "HH:mm" ) 525 <br /> 526 Til @CurrentEndDate.ToString( "dddd" ) d. @CurrentEndDate.ToString( "d. MMMM yyyy" ) 527 kl. @CurrentEndDate.ToString( "HH:mm" ) 528 </p> 529 } 530 <p>@CurrentExtra</p> 531 </div> 532 533 if ( !GetBoolean( "Ecom:Product:Field.showAddToCalendar.Value.Clean" ) ) 534 { 535 <span class="fullStartDate" style="display:none">@CurrentStartDate.ToString( "dd" )-@CurrentStartDate.ToString( "MM" )-@CurrentStartDate.ToString( "yyyy" ) @CurrentStartDate.ToString( "HH" ):@CurrentStartDate.ToString( "mm" )</span> 536 <span class="fullEndDate" style="display:none">@CurrentEndDate.ToString( "HH" ):@CurrentEndDate.ToString( "mm" )</span> 537 <div class="addeventatc" title="Add to Calendar"> 538 <span class="addeventatcText">+ @Translate( "Tilføj til kalender", "Tilføj til kalender" )</span> 539 <span class="start"></span> 540 <span class="end"></span> 541 <span class="timezone">Europe/Danmark</span> 542 <span class="title">JUC - @productName</span> 543 <span class="description"></span> 544 <span class="location">@courseEventLocation.Replace( "<br>", ", " )</span> 545 </div> 546 } 547 <br /> 548 <h3>@Translate( "MeetingNexSeason", "Møder i næste sæson" )</h3> 549 <br /> 550 } 551 552 @foreach ( ActivityDay day in activityDays ) 553 { 554 string exceeded = day.EndTime <= DateTime.Now ? "exceeded" : string.Empty; 555 556 <div class="first-letter @exceeded"> 557 <strong>@day.HeadLine</strong><br /> 558 @if ( day.StartTime.Date == day.EndTime.Date ) 559 { 560 <p>@day.StartTime.ToString( "dddd" ) d. @day.StartTime.ToString( "d. MMMM yyyy" )</p> 561 <p>Kl. @day.StartTime.ToString( "HH:mm" ) - @day.EndTime.ToString( "HH:mm" )</p> 562 } 563 else 564 { 565 <p>Fra @day.StartTime.ToString( "dddd" ) d @day.StartTime.ToString( "d. MMMM yyyy" ) 566 <br /> 567 kl. @day.StartTime.ToString( "HH:mm" ) 568 <br /> 569 Til @day.EndTime.ToString( "dddd" ) d. @day.EndTime.ToString( "d. MMMM yyyy" ) 570 kl. @day.EndTime.ToString( "HH:mm" ) 571 </p> 572 } 573 <p>@day.Extra</p> 574 </div> 575 576 // Here we make the Add To Calender button 577 // DateTime outgoingEndDate = DateTime.ParseExact(GetString("Ecom:Product:Field.outgoingEndDate.Value.Clean"), "dd-MM-yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); 578 579 if ( !GetBoolean( "Ecom:Product:Field.showAddToCalendar.Value.Clean" ) ) 580 { 581 <span class="fullStartDate" style="display:none">@day.StartTime.ToString( "dd" )-@day.StartTime.ToString( "MM" )-@day.StartTime.ToString( "yyyy" ) @day.StartTime.ToString( "HH" ):@day.StartTime.ToString( "mm" )</span> 582 <span class="fullEndDate" style="display:none">@day.EndTime.ToString( "HH" ):@day.EndTime.ToString( "mm" )</span> 583 <div class="addeventatc" title="Add to Calendar"> 584 <span class="addeventatcText @exceeded">+ @Translate( "Tilføj til kalender", "Tilføj til kalender" )</span> 585 <span class="start"></span> 586 <span class="end"></span> 587 <span style="display: none;" class="timezone">Europe/Danmark</span> 588 <span style="display: none;" class="title">JUC - @productName</span> 589 <span style="display: none;" class="description"></span> 590 <span style="display: none;" class="location">@courseEventLocation.Replace( "<br>", ", " )</span> 591 </div> 592 } 593 <br /> 594 } 595 596 @if ( activityDays.Count == 1 ) 597 { 598 <div class="courseLocation"> 599 <br /> 600 <p> 601 @courseEventLocation 602 </p> 603 </div> 604 } 605 606 </div> 607 // START: Current Course 608 // This is where we show the current/present course 609 DateTime currentDateTimeNow = DateTime.Now; 610 DateTime outgoingStartDate = DateTime.ParseExact( GetString( "Ecom:Product:Field.outgoingStartDate.Value.Clean" ), "dd-MM-yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture ); 611 612 613 // some of this is old Schema and some is new. It might need to be replaced 614 615 SnippetStart( "organizationEvent" ); 616 617 string eventName = GetString( "Ecom:Product.Name" ), 618 eventURL = GetGlobalValue( "Global:Request.Scheme" ) + "://" + GetGlobalValue( "Global:Request.Host" ) + GetGlobalValue( "Global:Pageview.Url" ); 619 620 DateTime productFieldDateStartMonth = activityDays.Any() ? activityDays.FirstOrDefault().StartTime : DateTime.MinValue; //DateTime.ParseExact(firstActivityStartDate, "dd-MM-yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); 621 DateTime productFieldDateEndHour = activityDays.Any() ? activityDays.LastOrDefault().EndTime : DateTime.MaxValue; //DateTime.ParseExact(lastActivityEndDate, "dd-MM-yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); 622 623 dynamic organization = new ExpandoObject(); 624 625 organization.Name = eventName; 626 organization.Url = eventURL; 627 organization.Description = productIntro; 628 organization.Email = "juc@juc.dk"; 629 organization.Locality = "Danmark"; 630 organization.ZipCode = "1620"; 631 organization.StreetAddress = courseEventLocation.Replace( "<br>", ", " ); 632 organization.Phone = "+45 70 20 82 60"; 633 organization.OpeningHours = ""; 634 organization.PriceRange = productPrice.Replace( ",00", "" ); 635 organization.PriceCurrency = "DKK"; 636 organization.Image = "http://juc.dk" + productGetImage; 637 organization.firstActivityStartDate = firstActivityStartDate; 638 organization.activityEnd = productFieldDateStart.ToString( "dd-MM-yyyy" ) + " " + productFieldDateEndHour.ToString( "HH:mm" ); 639 640 var organizationEvent = new HtmlString( string.Format( @" 641 {{ 642 ""@context"" : ""http://schema.org"", 643 ""@type"" : ""Event"", 644 ""name"": ""{0}"", 645 ""startDate"": ""{12}"", 646 ""endDate"": ""{13}"", 647 ""location"": {{ 648 ""@type"": ""Place"", 649 ""name"": ""JUC"", 650 ""address"": {{ 651 ""@type"": ""PostalAddress"", 652 ""streetAddress"": ""{6}"", 653 ""addressLocality"": ""{4}"", 654 ""postalCode"": ""{5}"", 655 ""addressRegion"": ""DK"" 656 }} 657 }}, 658 ""image"": [ 659 ""{11}"" 660 ], 661 ""description"": ""{2}"", 662 ""offers"": {{ 663 ""@type"": ""Offer"", 664 ""url"": ""{1}"", 665 ""price"": ""{9}"", 666 ""priceCurrency"": ""DKK"", 667 ""validFrom"": ""{12}"" 668 }}, 669 ""performer"": {{ 670 ""@type"": ""Organization"", 671 ""name"": ""JUC"" 672 }} 673 }} 674 ", 675 organization.Name, // 0 676 organization.Url, // 1 677 organization.Description, // 2 678 organization.Email, // 3 679 organization.Locality, // 4 680 organization.ZipCode, // 5 681 organization.StreetAddress, // 6 682 organization.Phone, // 7 683 organization.OpeningHours, // 8 684 organization.PriceRange, // 9 685 organization.PriceCurrency, // 10 686 organization.Image, // 11 687 organization.firstActivityStartDate, //12 688 organization.activityEnd //13 689 ) ); 690 691 SnippetEnd( "organizationEvent" ); 692 693 SnippetStart( "organizationCourseCourse" ); 694 695 dynamic organizationCourse = new ExpandoObject(); 696 697 organizationCourse.Name = eventName; 698 organizationCourse.Url = eventURL; 699 organizationCourse.Description = productIntro; 700 701 var organizationCourseCourse = new HtmlString( string.Format( @" 702 {{ 703 ""@context"" : ""http://schema.org"", 704 ""@type"" : ""Course"", 705 ""name"": ""{0}"", 706 ""description"": ""{2}"", 707 ""provider"": {{ 708 ""@type"": ""Offer"", 709 ""name"": ""JUC"", 710 ""SameAs"": ""{1}"" 711 }} 712 }} 713 ", 714 organizationCourse.Name, // 0 715 organizationCourse.Url, // 1 716 organizationCourse.Description // 2 717 ) ); 718 } 719 @SnippetEnd( "organizationCourseCourse" ) 720 721 <script type="application/ld+json"> 722 @organizationEvent 723 </script> 724 725 <script type="application/ld+json"> 726 @organizationCourseCourse 727 </script> 728 </div> 729 } 730 731 @if ( GetString( "Ecom:Product:Field.newDateFIelds.Value" ) == "False" ) 732 { 733 <span class="e-com-product-details"> 734 @productDetails 735 </span> 736 } 737 738 <p>&nbsp;</p> 739 740 @if ( areaid == "1" && productType == "Course" ) 741 { 742 string popupTextOneOpt1 = HttpUtility.JavaScriptStringEncode( Translate( "ParticipateSelectOneOpt1", "Du skal vælge afholdelsestypen Klasseundervisning, før du kan lægge kurset i kurven." ) ); 743 string popupTextOneOpt2 = HttpUtility.JavaScriptStringEncode( Translate( "ParticipateSelectOneOpt2", "Du skal vælge afholdelsestypen Fjernundervisning, før du kan lægge kurset i kurven." ) ); 744 string popupTextTwoOrMore = HttpUtility.JavaScriptStringEncode( Translate( "ParticipateSelectTwoOrMore", "Du skal vælge afholdelsestype som enten er Fjernundervisning eller klasseundervisning, før du kan lægge kurset i kurven." ) ); 745 string loopCounter = ""; 746 DateTime productStartTime = GetDate( "Ecom:Product:Field.outgoingStartDate.Value" ); 747 748 if ( productMonth == 3 && productYear == 2020 || productMonth == 4 && productYear == 2020 ) 749 { 750 string optionTranslate = Translate( "optionInfoDistanceLearning", "Information" ); 751 <div class="course-selector"> 752 <div> 753 <input class="radiobutton" id="DistanceLearning" name="participate" type="radio" value="DistanceLearning"> 754 <label class="radiobutton-label" for="DistanceLearning">Fjernundervisning</label> 755 <span class="tooltip" data-placement="left" data-toggle="tooltip" title="@optionTranslate"> 756 </span> 757 </div> 758 </div> 759 } 760 else 761 { 762 if ( productStartTime <= DateTime.Now ) 763 { 764 <div class="course-selector"> 765 @foreach ( LoopItem educationform in GetLoop( "educationform.Options" ) ) 766 { 767 string optionValue = educationform.GetString( "educationform.Option.Value" ); 768 string optionTranslate = Translate( "optionInfo" + optionValue, "Information" ); 769 string courseTranslate = Translate( "optionName" + optionValue, "Course Name" ); 770 bool optionSelected = educationform.GetBoolean( "educationform.Option.IsSelected" ); 771 772 if ( optionSelected ) 773 { 774 <div> 775 <input type="radio" id="@optionValue" class="radiobutton @optionValue" name="participate" value="@optionValue"> 776 <label class="radiobutton-label" for="@optionValue">@courseTranslate</label> 777 <span class="tooltip" data-toggle="tooltip" data-placement="left" title="@optionTranslate"></span> 778 </div> 779 } 780 } 781 } 782 </div> 783 } 784 785 <script> 786 var popupTextOneOpt1 = "@popupTextOneOpt1"; 787 var popupTextOneOpt2 = "@popupTextOneOpt2"; 788 var popupTextTwoOrMore = "@popupTextTwoOrMore"; 789 var loopCounter = jQuery('input[name=\'participate\']').length; 790 791 jQuery(function(){ 792 jQuery('.addToCartSubmit').on('click', function(event) { 793 event.preventDefault(); 794 if (!jQuery('input[name=\'participate\']').is(':checked')) { 795 if( loopCounter == 1 ) { 796 if( jQuery('input[name=\'participate\']').is('.Classroom') ) { 797 alert(popupTextOneOpt1); 798 } else { 799 alert(popupTextOneOpt2); 800 } 801 } else { 802 alert(popupTextTwoOrMore); 803 } 804 return false; 805 } 806 }); 807 }); 808 </script> 809 } 810 811 <h3>@Translate( "priceDetails" )</h3> 812 <p class="price @productPrice"> 813 @currencyCode @productPrice.Replace( ",00", "" ) 814 </p> 815 @if ( stockStatusID != "STOCKSTATUS3" && courseIsActive ) 816 { 817 <form name="addToCart" class="add-to-cart form-fields hidden-xs" action="@SearchEngineFriendlyURLs.GetFriendlyUrl( currentPageId )" method="post" data-outofstock='@Translate( "outOfStock", "Out of stock" )'> 818 <input name="cartcmd" type="hidden" value="add" /> 819 <input type="hidden" name="productID" value="@productId" /> 820 <input name="EcomOrderLineFieldInput_dateNow" type="hidden" value="" /> 821 <input name="EcomOrderLineFieldInput_customerName" type="hidden" value="" /> 822 <input name="EcomOrderLineFieldInput_email" type="hidden" value="" /> 823 <input name="EcomOrderLineFieldInput_title" type="hidden" value="" /> 824 <input type="hidden" name="EcomOrderLineFieldInput_MaterialIDSystem" value="" class="@productNumber" /> 825 <input name="EcomOrderLineFieldInput_participate" type="hidden" value="" /> 826 <textarea class="js-courseActivities" name="EcomOrderLineFieldInput_courseActivities" style="display:none"></textarea> 827 <textarea class="js-courseLocation" name="EcomOrderLineFieldInput_courseLocation" style="display:none"></textarea> 828 <a class="addToCartSubmit addToCartSubmitDesktop" href="javascript:void(0);" data-add='@Translate( "addToCart", "Læg i kurven" )' data-added='@Translate( "added", "Lagt til" )'> 829 <img class="addToCartIcon" src="/files/templates/designs/rizzodesignfolder/images/svgicons/cart.svg"> 830 @Translate( "addToCart_" + productType, "Læg I kurven" ) 831 </a> 832 833 <input class="hidden" type="submit" value='@Translate( "addToCart" )' /> 834 </form> 835 } 836 837 </div> 838 839 @if ( GetString( "Ecom:Product:Field.ShowFoaLogo.Value" ) == "True" ) 840 { 841 <div class="mask maskRight"> 842 <a href="/uber-juc/pflichtfortbildung-fur-fachanwalte-nach-§15-fao.aspx" target="_blank"> 843 <img alt="" src="/Files/Templates/Designs/RizzoDesignFolder/images/foalogo_small.png" width="120px" /> 844 </a> 845 </div> 846 } 847 </div> 848 <div class="col-lg-8 col-xs-12 noPadding product-column"> 849 @foreach ( var group in relatedGroupsList ) 850 { 851 @*teachers*@ 852 853 if ( group.GetString( "Ecom:Product:RelatedGroup.GroupID" ) == "RELGRP2" ) 854 { 855 var relatedProdsList = group.GetLoop( "Products" ); 856 857 if ( relatedProdsList.Any() ) 858 { 859 string teacherName = "", 860 teacherDescription = "", 861 teacherLink = "", 862 teacherImage = "", 863 teacherTeaser = "", 864 teachersTitle = relatedProdsList.Count() > 1 ? Translate( "teachers", "Undervisere" ) : Translate( "teacher", "Underviser" ); 865 866 if ( groupId == "GROUP4" || groupId == "GROUP29" || groupId == "GROUP32" || groupId == "GROUP41" ) 867 { 868 teachersTitle = relatedProdsList.Count() > 1 ? Translate( "Netværksledelse", "Netværksledelse" ) : Translate( "Netværksledelse", "Netværksledelse" ); 869 } 870 871 <div class="teachers" id="leftSideOuter"> 872 <div class='teachers-container'> 873 <h2> 874 @teachersTitle 875 </h2> 876 <div id="listContainer"> 877 <ul class="productsList row teachersOuter" data-list id="productsList"> 878 @foreach ( var prod in relatedProdsList ) 879 { 880 teacherName = prod.GetString( "Ecom:Product.Name" ); 881 teacherDescription = prod.GetString( "Ecom:Product.ShortDescription" ); 882 teacherImage = GetImagePathUrl( prod.GetString( "Ecom:Product.ImageSmall.Clean" ), prod.GetString( "Ecom:Product.ImageMedium.Clean" ), prod.GetString( "Ecom:Product.ImageLarge.Clean" ), "*" ); 883 teacherImage = GetImage( teacherImage, 0, 600 ); 884 teacherLink = "Default.aspx?ID=" + prod.GetString( "Ecom:Product.PrimaryOrCurrentPageID" ) + "&ProductID=" + prod.GetString( "Ecom:Product.ID" ); 885 886 if ( !String.IsNullOrEmpty( teacherDescription ) && !String.IsNullOrEmpty( teacherLink ) && !String.IsNullOrEmpty( teacherImage ) && !String.IsNullOrEmpty( teacherName ) ) 887 { 888 <li> 889 <div class="col-xs-12 noPadding"> 890 <figure class="col-xs-2 noPadding"> 891 <a href="@teacherLink"> 892 <img src="@teacherImage" title="@teacherName" alt="@teacherName" class="img-responsive" /> 893 </a> 894 </figure> 895 <div class="col-xs-10"> 896 <h3> 897 <a itemprop="name" href="@teacherLink"> 898 @teacherName 899 </a> 900 </h3> 901 @if ( !String.IsNullOrEmpty( teacherDescription ) ) 902 { 903 <div class="shortDescription tileHide"> 904 <a itemprop="name" href="@teacherLink"> 905 <p> 906 @Dynamicweb.Base.TeaserString( StripHtml( teacherDescription ), 120, "..." ) 907 </p> 908 </a> 909 </div> 910 } 911 </div> 912 </div> 913 </li> 914 } 915 } 916 917 </ul> 918 </div> 919 </div> 920 </div> 921 } 922 } 923 } 924 925 @foreach ( var group in relatedGroupsList ) 926 { 927 @*ansvarlig*@ 928 929 if ( group.GetString( "Ecom:Product:RelatedGroup.GroupID" ) == "RELGRP10" ) 930 { 931 var responsibleProdsList = group.GetLoop( "Products" ); 932 if ( responsibleProdsList.Any() ) 933 { 934 string responsibleName = "", 935 responsibleDescription = "", 936 responsibleLink = "", 937 responsibleImage = "", 938 responsibleTeaser = "", 939 responsibleTitle = ""; 940 941 responsibleTitle = responsibleProdsList.Count() > 0 ? Translate( "Ansvarlig", "Ansvarlig" ) : Translate( "Ansvarlig", "Ansvarlig" ); 942 943 <div class="responsible" id="leftSideOuter"> 944 <div class='teachers-container @group.GetString( "Ecom:Product:RelatedGroup.GroupID" )'> 945 <h2> 946 @responsibleTitle 947 </h2> 948 <div id="listContainer"> 949 <ul class="productsList row teachersOuter" data-list id="productsList"> 950 @foreach ( var prod in responsibleProdsList ) 951 { 952 responsibleName = prod.GetString( "Ecom:Product.Name" ); 953 responsibleDescription = prod.GetString( "Ecom:Product.ShortDescription" ); 954 responsibleImage = GetImagePathUrl( prod.GetString( "Ecom:Product.ImageSmall.Clean" ), prod.GetString( "Ecom:Product.ImageMedium.Clean" ), prod.GetString( "Ecom:Product.ImageLarge.Clean" ), "*" ); 955 responsibleImage = GetImage( responsibleImage, 0, 600 ); 956 responsibleLink = "Default.aspx?ID=" + prod.GetString( "Ecom:Product.PrimaryOrCurrentPageID" ) + "&ProductID=" + prod.GetString( "Ecom:Product.ID" ); 957 958 <li> 959 <div class="col-xs-12 noPadding"> 960 <figure class="col-xs-2 noPadding"> 961 <a href="@responsibleLink"> 962 <img src="@responsibleImage" title="@responsibleName" alt="@responsibleName" class="img-responsive" /> 963 </a> 964 </figure> 965 <div class="col-xs-10"> 966 <h3> 967 <a itemprop="name" href="@responsibleLink"> 968 @responsibleName 969 </a> 970 </h3> 971 @if ( !String.IsNullOrEmpty( responsibleDescription ) ) 972 { 973 <div class="shortDescription tileHide"> 974 <a itemprop="name" href="@responsibleLink"> 975 <p> 976 @Dynamicweb.Base.TeaserString( StripHtml( responsibleDescription ), 120, "..." ) 977 </p> 978 </a> 979 </div> 980 } 981 </div> 982 </div> 983 </li> 984 } 985 986 </ul> 987 </div> 988 </div> 989 </div> 990 } 991 } 992 } 993 994 </div> 995 996 @*relaterede produkter*@ 997 <div class="col-lg-4 col-xs-12 noPadding product-column product-right-column"> 998 @if ( GetLoop( "ProductRelatedGroups" ).Any() ) 999 { 1000 var miscdebug = ""; 1001 <div> 1002 @foreach ( var group in relatedGroupsList ) 1003 { 1004 if ( group.GetString( "Ecom:Product:RelatedGroup.GroupID" ) == "RELGRP1" ) 1005 { 1006 var prodsList = group.GetLoop( "Products" ); 1007 1008 if ( prodsList.Any() ) 1009 { 1010 string groupName = group.GetString( "Ecom:Product:RelatedGroup.Name" ), 1011 groupID = group.GetString( "Ecom:Product:RelatedGroup.GroupID" ), 1012 relatedProductName = "", 1013 relatedProductLink = "", 1014 relatedProductDesc = "", 1015 relatednrLectures = "", 1016 relatednrLecturesDecimal = "", 1017 relatedProductMonth = "", 1018 moduleNumber = "", 1019 ShowDateOnList = "", 1020 relatedProductGroupID = ""; 1021 1022 var productMonthRel = 0; 1023 var productYearRel = 0; 1024 var productDayRel = 0; 1025 var relatedProductIndex = 0; 1026 1027 var monthNames = DateTimeFormatInfo.CurrentInfo.AbbreviatedMonthNames; 1028 1029 <div class="related-products-legend top">@Translate( "relatedProducts", "Relaterede produkter" )</div> 1030 <ul class="relatedOuter related-products"> 1031 @foreach ( LoopItem relatedProduct in prodsList.OrderBy( x => x.GetInteger( "Ecom:Product:Field.Year.Value" ) ).ThenBy( x => x.GetInteger( "Ecom:Product:Field.Month.Value" ) ).ThenBy( x => x.GetInteger( "Ecom:Product:Field.Day.Value" ) ) ) 1032 { 1033 miscdebug = ""; 1034 try 1035 { 1036 relatedProductIndex++; 1037 1038 relatedProductName = relatedProduct.GetString( "Ecom:Product.Name" ); 1039 1040 relatedProductLink = relatedProduct.GetString( "Ecom:Product.LinkGroup.Clean" ); 1041 relatedProductDesc = Dynamicweb.Base.TeaserString( StripHtml( relatedProduct.GetString( "Ecom:Product.ShortDescription" ) ), 80, "..." ); 1042 relatednrLectures = relatedProduct.GetString( "Ecom:Product:Field.Lectures.Value.Clean" ); 1043 relatednrLecturesDecimal = relatedProduct.GetString( "Ecom:Product:Field.LecturesDecimal.Value.Raw" ); 1044 productMonthRel = relatedProduct.GetInteger( "Ecom:Product:Field.Month.Value" ); 1045 productYearRel = relatedProduct.GetInteger( "Ecom:Product:Field.Year.Value" ); 1046 productDayRel = relatedProduct.GetInteger( "Ecom:Product:Field.Day.Value" ); 1047 moduleNumber = relatedProduct.GetString( "Ecom:Product:Field.moduleNummer" ); 1048 ShowDateOnList = relatedProduct.GetString( "Ecom:Product:Field.ShowDateOnList" ); 1049 relatedProductMonth = monthNames[ productMonthRel - 1 ]; 1050 relatedProductGroupID = relatedProduct.GetString( "Ecom:Product.PrimaryGroupID" ); 1051 var relCourseIsActive = isActive( productMonthRel, productYearRel, productDayRel ); 1052 1053 //string relatedProductMod2Class = "mod" + (relatedProductIndex % 2).ToString(); 1054 1055 int productDateStartInt = 0; 1056 string myDateTime = relatedProduct.GetString( "Ecom:Product:Field.season01Activity01DateStart.Value.Clean" ); 1057 DateTime productDateStart = DateTime.Now; 1058 if ( !String.IsNullOrEmpty( myDateTime ) ) 1059 { 1060 productDateStart = DateTime.ParseExact( myDateTime, "dd-MM-yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture ); 1061 productDateStartInt = ( int ) productDateStart.Day; 1062 } 1063 1064 miscdebug = relatedProduct.GetString( "Ecom:Product.PrimaryGroupID" ) + "-----"; 1065 1066 Dynamicweb.eCommerce.Products.Group relatedGroup = Dynamicweb.eCommerce.Products.Group.GetGroupByID( relatedProductGroupID ); 1067 1068 if ( !relatedGroup.IsTopGroup ) 1069 { 1070 string relatedProductGroupPrimaryParentGroupID = relatedGroup.PrimaryParentGroupID; 1071 1072 if ( relatedGroup.ParentGroups.Any() ) 1073 { 1074 relatedGroup = !String.IsNullOrEmpty( relatedProductGroupPrimaryParentGroupID ) ? relatedGroup.ParentGroups.Where( x => x.ID == relatedProductGroupPrimaryParentGroupID ).First() : relatedGroup.ParentGroups.First(); 1075 } 1076 } 1077 1078 string relatedProductGroupColor = relatedGroup.ProductGroupFieldValues.GetProductGroupFieldValue( "Color" ).Value.ToString(); 1079 1080 <li class="related-product-item @relatedProductGroupColor @relatedProductName @( relCourseIsActive ? "" : "hide" )"> 1081 <div> 1082 <div class="related-info"> 1083 <ul> 1084 <li class="productDate"> 1085 <div> 1086 @if ( relatedProduct.GetString( "Ecom:Product:Field.newDateFIelds.Value" ) != "False" && productDateStart != DateTime.Now ) 1087 { 1088 <strong class="newDateStartInt">@productDateStartInt</strong> 1089 <span>@productDateStart.ToString( "MMMM" ).Substring( 0, 3 )</span> 1090 } 1091 else 1092 { 1093 if ( ShowDateOnList == "False" ) 1094 { 1095 <strong>@relatedProduct.GetString( "Ecom:Product:Field.Day.Value" )</strong> 1096 <span>@relatedProductMonth</span> 1097 } 1098 } 1099 </div> 1100 </li> 1101 <li class="productLessons"> 1102 <div> 1103 @if ( !String.IsNullOrEmpty( relatednrLecturesDecimal ) && relatednrLecturesDecimal != "0" ) 1104 { 1105 <strong>@relatednrLecturesDecimal</strong> 1106 } 1107 else 1108 { 1109 <strong>@relatednrLectures</strong> 1110 } 1111 <span>@Translate( "ShortLectures", "Lekt." )</span> 1112 </div> 1113 </li> 1114 </ul> 1115 </div> 1116 1117 <div class="related-details"> 1118 <h3> 1119 <a href="@relatedProductLink" title="@relatedProductName"> 1120 @relatedProductName 1121 1122 </a> 1123 </h3> 1124 @if ( !String.IsNullOrEmpty( moduleNumber ) && moduleNumber != "0" ) 1125 { 1126 <span class="productModuleNumberText">modul<span class="productModuleNumber">@moduleNumber</span></span> 1127 } 1128 @*<div> 1129 <a href="@relatedProductLink" title="@relatedProductName"> 1130 @relatedProductDesc 1131 </a> 1132 </div>*@ 1133 </div> 1134 </div> 1135 <a href="@relatedProductLink" title="@relatedProductName" class="overlayLink">@relatedProductName</a> 1136 1137 </li> 1138 } 1139 catch ( Exception ee ) 1140 { 1141 <div> 1142 Fejl: @ee.ToString() 1143 <br /><br /> @miscdebug 1144 </div> 1145 } 1146 } 1147 </ul> 1148 } 1149 } 1150 } 1151 </div> 1152 } 1153 1154 </div> 1155 </article> 1156 </div> 1157 1158 @SnippetStart( "breadCrumb" ) <li>&nbsp;|&nbsp;</li> 1159 <li> 1160 <a href="@pageGroupUrl">@parentGroupName</a> 1161 </li> @SnippetEnd( "breadCrumb" ) 1162 @SnippetStart( "OGMeta" ) 1163 1164 @{ 1165 if ( !String.IsNullOrEmpty( OpenGraphTitle ) ) 1166 { 1167 <meta property="og:title" content='@OpenGraphTitle' /> 1168 } 1169 else 1170 { 1171 <meta property="og:title" content='@productName' /> 1172 } 1173 if ( !String.IsNullOrEmpty( OpenGraphDescription ) ) 1174 { 1175 <meta property="og:description" content='@OpenGraphDescription' /> 1176 } 1177 else 1178 { 1179 <meta property="og:description" content='@StripHtml( productIntro )' /> 1180 } 1181 if ( !String.IsNullOrEmpty( OpenGraphImage ) ) 1182 { 1183 <meta property="og:image" content='@Pageview.GlobalTags.GetTagByName( "Global:Request.Scheme" ).Value://@Pageview.GlobalTags.GetTagByName( "Global:Request.Host" ).Value/@OpenGraphImage' /> 1184 } 1185 else 1186 { 1187 <meta property="og:image" content='@Pageview.GlobalTags.GetTagByName( "Global:Request.Scheme" ).Value://@Pageview.GlobalTags.GetTagByName( "Global:Request.Host" ).Value@imagePattern' /> 1188 } 1189 } 1190 <meta property="og:site_name" content='@areaItem[ "CompanyName" ]' /> 1191 <meta property="og:url" content='@Pageview.GlobalTags.GetTagByName( "Global:Request.Scheme" ).Value://@Pageview.GlobalTags.GetTagByName( "Global:Request.Host" ).Value@( Pageview.GlobalTags.GetTagByName( "Global:Pageview.Url" ).Value )' /> 1192 <meta content="article" property="og:type" /> 1193 <meta property="og:locale" content='@Pageview.GlobalTags.GetTagByName( "Global:Area.LongLang" ).Value.Replace( "-", "_" )' /> 1194 @SnippetEnd( "OGMeta" ) 1195 1196 @SnippetStart( "jsOnLoad" ) 1197 onLoadProductDetail(); 1198 @SnippetEnd( "jsOnLoad" ) 1199 1200 @functions { 1201 1202 public static string StripHtml( string source ) 1203 { 1204 return Regex.Replace( source, "<.*?>", string.Empty ); 1205 } 1206 1207 public bool isActive( int productMonth, int productYear, int productDay ) 1208 { 1209 DateTime productDate = new DateTime( productYear, productMonth, productDay ); 1210 DateTime localDate = DateTime.Now; 1211 int result = DateTime.Compare( productDate, localDate ); 1212 if ( result > 0 ) 1213 { 1214 return true; 1215 } 1216 return false; 1217 } 1218 1219 }