Error executing template "Designs/exhibition_site/eCom/Product/MCH365-profile.cshtml"
System.Exception: Product is not of type Co3.MCH.Website.Frontend.Models.Frontend.MCH365.Profile. Check asset type of product id : TSP4a86a94dcf87579c772c9fb3996.
at Co3.MCH.Website.Frontend.Models.Frontend.Ecommerce.ProfileProduct.Populate(ProductSettings settings) in C:\Data\Development\git\mch-master\Co3.MCH.Website.Frontend\Models\Frontend\Ecommerce\ProfileProduct.cs:line 67
at Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService.GetEspressoProduct(ProductSettings settings, String key) in C:\Data\Development\git\mch-master\Co3.MCH.Website.Frontend\Services\Ecommerce\ProductService.cs:line 45
at CompiledRazorTemplates.Dynamic.RazorEngine_045f52be275c4a1c9e705c75ebe93c25.Execute() in E:\dynamicweb.net\Solutions\mch365.espresso5.dk\Files\Templates\Designs\exhibition_site\eCom\Product\MCH365-profile.cshtml:line 12
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 Co3.Espresso.Website.TemplateBases.Paragraphs.Module 2 @using System.Text.RegularExpressions 3 @using Co3.Espresso.Website.Services 4 @using Co3.Espresso.Website.Models.FrontEnd 5 @using Co3.Espresso.Website.Models.FrontEnd.Settings 6 @using Co3.MCH.Website.Frontend.Helpers 7 @using Co3.MCH.Website.Frontend.Models.Frontend 8 @using Co3.MCH.Website.Frontend.Models.Frontend.Ecommerce 9 @using Dynamicweb.Core 10 11 @{ 12 ProfileProduct espressoProduct = Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService.Instance.GetEspressoProduct( 13 new ProductSettings() 14 { 15 Id = GetString("Ecom:Product.ID"), 16 VariantId = GetString("Ecom:Product.VariantID"), 17 PrimaryVariantId = GetString("Ecom:Product.DefaultVariantComboID"), 18 EmbeddedInModelList = false 19 }, nameof(ProfileProduct) 20 ) as ProfileProduct; 21 22 // EXAMPLE 23 bool hasPresentation = espressoProduct.HasPresentation; 24 int presentationContactPersons = 0; 25 if (hasPresentation) 26 { 27 presentationContactPersons = espressoProduct.Presentation.ContactPersons.Products.Count(); 28 } 29 30 // CUSTOM COMPANY FIELDS 31 string companyColor = ""; 32 33 if (espressoProduct.Company.BrandColor.IsNullOrEmpty()) 34 { 35 companyColor = MCH365Context.Current.TradeShowDetails.PrimaryColor; 36 } 37 else 38 { 39 companyColor = espressoProduct.Company.BrandColor; 40 } 41 42 // CUSTOM COMPANY COLOR SCHEME 43 Regex hexcodeRegex = new Regex(@"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"); 44 companyColor = hexcodeRegex.IsMatch( companyColor ) ? companyColor : "#000000"; 45 ColorHelper.HSL brandExhibitor = ColorHelper.Instance.HexToHsl(companyColor); 46 47 // VIDEO 48 string presentationVideo = ""; 49 50 if (espressoProduct.Presentation != null && espressoProduct.Presentation.Video != null && !string.IsNullOrEmpty(espressoProduct.Presentation.Video)) 51 { 52 string presentationVideoRaw = espressoProduct.Presentation.Video; 53 54 if (presentationVideoRaw.Contains("https://vimeo.com/")) 55 { 56 presentationVideo = "https://player.vimeo.com/video/" + (presentationVideoRaw.Replace("https://vimeo.com/", "")); 57 } 58 else if (presentationVideoRaw.Contains("https://youtu")) 59 { 60 presentationVideo = ("https://www.youtube.com/embed/" + presentationVideoRaw.Replace("https://youtu.be/", "").Replace("https://www.youtube.com/embed/", "")); 61 } 62 else if (presentationVideoRaw.Contains("https://www.youtube.com/watch?v=")) 63 { 64 presentationVideo = ("https://www.youtube.com/embed/" + presentationVideoRaw.Replace("https://www.youtube.com/watch?v=", "")); 65 } 66 else 67 { 68 presentationVideo = ("https://www.youtube.com/embed/" + presentationVideoRaw); 69 } 70 } 71 } 72 73 <style> 74 :root { 75 --exhibitor-color: @brandExhibitor.ToString(); 76 --exhibitor-color-darken: @brandExhibitor.Darken(10).ToString(); 77 --exhibition-profile-exhibitor-brand-color: hsl(var(--exhibitor-color)); 78 --exhibition-profile-exhibitor-brand-color-darken: hsl(var(--exhibitor-color-darken)); 79 --exhibition-profile-exhibitor-brand-color-opaque: hsla(var(--exhibitor-color), 0.85); 80 } 81 82 .breadcrumb.nav { 83 background-color: var(--exhibition-profile-exhibitor-brand-color-darken); 84 } 85 86 </style> 87 88 @RenderingService.Instance.SectionEnd() 89 @RenderingService.Instance.PartialView("ecom/product/partials/profile-details/MCH365-topsection.cshtml", espressoProduct) 90 @RenderingService.Instance.SectionStart(new SectionSettings 91 { 92 Classes = new ClassList("e-section mch365-custom-product-details-wrapper") 93 }) 94 95 96 @RenderingService.Instance.PartialView("ecom/product/partials/profile-details/MCH365-sidebar.cshtml", espressoProduct) 97 <div class="col-12 col-md-8 col-lg-9 p-columns mch365-custom-product-details-wrapper-main-content"> 98 <div class="row mt-2 mt-md-4"> 99 <div class="col-12"> 100 <div class="row"> 101 <div class="col-12 col-lg-8 mb-2 pr-lg-2 pr-xl-3" id="presentation"> 102103104 @if( !string.IsNullOrEmpty(espressoProduct.Company.DescriptionFormatted)) { 105 <p>@espressoProduct.Company.DescriptionFormatted</p> 106 } 107 else 108 { 109 <h4>@Translate("MCH365 - Exhibitor details descriptionNoInfoHeader - Heading", "Vi har registreret udstilleren som leverandør eller udstiller på messen.")</h4> 110 <p>@Translate("MCH365 - Exhibitor details descriptionNoInfoText - Text", "Dog har de endnu ikke oplyst yderligere beskrivelse på deres profil.")</p> 111 } 112113114 </div> 115 @if (espressoProduct.ContactPersons.Products.Any()) 116 { 117 @RenderingService.Instance.PartialView("ecom/product/partials/profile-details/MCH365-contactpersons.cshtml", espressoProduct) 118 } 119 </div> 120121 @if (espressoProduct.Products.Products.Any()) 122 { 123 <div class="row"> 124 @RenderingService.Instance.PartialView("ecom/product/partials/profile-details/MCH365-products.cshtml", espressoProduct) 125 </div> 126 } 127 @if (espressoProduct.Articles.Products.Any()) 128 { 129 <div class="row"> 130 @RenderingService.Instance.PartialView("ecom/product/partials/profile-details/MCH365-articles.cshtml", espressoProduct) 131 </div> 132 } 133 @if (espressoProduct.Cases.Products.Any()) 134 { 135 <div class="row"> 136 @RenderingService.Instance.PartialView("ecom/product/partials/profile-details/MCH365-cases.cshtml", espressoProduct) 137 </div> 138 } 139 @if (espressoProduct.Events.Products.Any()) 140 { 141 <div class="row"> 142 @RenderingService.Instance.PartialView("ecom/product/partials/profile-details/MCH365-events.cshtml", espressoProduct) 143 </div> 144 } 145146 </div> 147 </div> 148 </div> 149 @RenderingService.Instance.SectionEnd() 150 @RenderingService.Instance.SectionStart(new SectionSettings()) 151
keyboard_arrow_up