Error executing template "Designs/exhibition_site/eCom/Product/MCH365-product.cshtml"
System.Exception: Product is not of type Co3.MCH.Website.Frontend.Models.Frontend.MCH365.Product. Check asset type of product id : APd97c18aa3c68158695d9d23d836f.
at Co3.MCH.Website.Frontend.Models.Frontend.Ecommerce.ProductProduct.Populate(ProductSettings settings) in C:\Data\Development\git\mch-master\Co3.MCH.Website.Frontend\Models\Frontend\Ecommerce\ProductProduct.cs:line 148
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 46
at CompiledRazorTemplates.Dynamic.RazorEngine_c1425e000e594e91a5bb1bf7c91db1df.Execute() in E:\dynamicweb.net\Solutions\mch365.espresso5.dk\Files\Templates\Designs\exhibition_site\eCom\Product\MCH365-product.cshtml:line 15
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 @using System.Web @using Co3.Espresso.Website.Services @using Co3.Espresso.Website.Models.FrontEnd @using Co3.Espresso.Website.Models.FrontEnd.Settings @using Co3.MCH.Data.Models.MCH365 @using Co3.MCH.Website.Frontend.Models.Frontend @using Co3.MCH.Website.Frontend.Models.Frontend.Ecommerce @using Co3.MCH.Website.Frontend.Models.Frontend.Users @using Dynamicweb.Frontend @using Co3.Espresso.Base.Extensions @{ ProductProduct productProduct = ( ProductProduct ) Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService.Instance.GetEspressoProduct( new ProductSettings() { Id = GetString( "Ecom:Product.ID" ), VariantId = GetString( "Ecom:Product.VariantID" ), PrimaryVariantId = GetString( "Ecom:Product.DefaultVariantComboID" ), EmbeddedInModelList = true }, nameof( ProductProduct ) ); string tradeshowCode = PageView.Current().Area.Item[ "TradeShowCode" ].ToString(); string tradeshowName = MCH365Context.Current.TradeShowDetails.Name; bool presentationCategoriesPresent = productProduct.CategoryFieldValues != null && productProduct.CategoryFieldValues.Any(); bool hasCookiebot = PageView.Current().Area.Item[ "Cookiebot" ].ToString() == "True"; string latestProductlistPage = SearchEngineFriendlyURLs.GetFriendlyUrl( PageView.Current().Page.Parent.GetPageHrefValue() ); if ( UserContext.Current.LatestProductListPageIds.ContainsKey( "product" ) ) { latestProductlistPage = SearchEngineFriendlyURLs.GetFriendlyUrl( string.Format("Default.aspx?ID={0}", UserContext.Current.LatestProductListPageIds["product"]) ); } bool isPresent = productProduct.TradeShowAssetInfo != null && productProduct.TradeShowAssetInfo.ContainsKey( tradeshowCode ) && productProduct.TradeShowAssetInfo[ tradeshowCode ].IsPresent; List< string > images = new List< string > {productProduct.Image, productProduct.Image2, productProduct.Image3, productProduct.Image4, productProduct.Image5}; images = images.Where( i => !string.IsNullOrEmpty( i ) ).ToList(); // VIDEO string presentationVideoRaw = productProduct.Video; string presentationVideo; if ( presentationVideoRaw.Contains( "https://vimeo.com/" ) ) { presentationVideo = "https://player.vimeo.com/video/" + ( presentationVideoRaw.Replace( "https://vimeo.com/", "" ) ); } else if ( presentationVideoRaw.Contains( "https://youtu" ) ) { presentationVideo = ( "https://www.youtube.com/embed/" + presentationVideoRaw.Replace( "https://youtu.be/", "" ).Replace( "https://www.youtube.com/embed/", "" ) ); } else if ( presentationVideoRaw.Contains( "https://www.youtube.com/watch?v=" ) ) { presentationVideo = ( "https://www.youtube.com/embed/" + presentationVideoRaw.Replace( "https://www.youtube.com/watch?v=", "" ) ); } else { presentationVideo = ( "https://www.youtube.com/embed/" + presentationVideoRaw ); } string productName = productProduct.Name.Replace("\"", "'"); string productDescriptionFormatted = productProduct.DescriptionFormatted; string productDescriptionFormattedStrippedHtml = productDescriptionFormatted.StripHtml(); string productDescriptionFormattedMetaDesc = !string.IsNullOrEmpty(productDescriptionFormattedStrippedHtml) ? productDescriptionFormattedStrippedHtml : productName; if ( productDescriptionFormattedStrippedHtml.Length > 160 ) { productDescriptionFormattedMetaDesc = !string.IsNullOrEmpty(productDescriptionFormattedStrippedHtml) ? productDescriptionFormattedStrippedHtml.Substring(0, 160) : productName; } } @RenderingService.Instance.SectionEnd() @RenderingService.Instance.SectionStart( new SectionSettings { Classes = new ClassList( "e-section mch365-custom-product-details-wrapper" ) } ) <div class="col-12 p-columns mch365-custom-product-details-wrapper-main-content"> <div class="row mt-0 mt-md-4"> <div class="col-12"> <div class="row"> <div class="col-12 col-md-7 col-lg-8 mb-5 mb-md-0 p-columns"> @if ( images.Any() ) { <div class="row mb-2 d-md-none"> @RenderingService.Instance.PartialView( "ecom/product/partials/product-details/MCH365-image-carousel-mobile.cshtml", productProduct ) </div> } <h1 class="mega mb-half mt-0">@productProduct.Name</h1> <a class="align-self-center arrow-left d-block mb-2 mt-1 small" href="@latestProductlistPage"><i class="material-icons material-icons-large d-none">arrow_back</i>@Translate("MCH365 - To Overview - Link", "Til oversigten")</a> <span class="d-md-none"> <p class="mt-0"> <a class="text-black" href="@( PageView.Current().SearchFriendlyUrl )#companyInfo">@productProduct.Profile.Company.Name</a> </p> </span> @if ( presentationCategoriesPresent ) { <ul class="mch365-custom-product-product-details-categories-list"> @foreach ( KeyValuePair< string, CategoryFieldValue > subcategory in productProduct.CategoryFieldValues ) { string filterValue = string.Format( "C{0}|{1}", tradeshowCode, subcategory.Key ); <li> <a href="@(latestProductlistPage)?PresentationCategory=@filterValue">@subcategory.Value.FieldLabel</a> </li> } </ul> } <div class="row"> <div class="col-12 col-md-11"> <p> @productProduct.DescriptionFormatted </p> </div> @if ( !string.IsNullOrEmpty( presentationVideoRaw ) ) { <div class="col-12 col-md-11"> <div class="video-container my-1"> @if (hasCookiebot) { <div class="cookieconsent-optout-marketing "> <a href="javascript:Cookiebot.renew()" class="btn"> <small>@Translate("Cookies - Accept to watch", "Accepter marketing-cookies for at se denne video.")</small> <br/> <i class="material-icons">play_arrow</i> </a> </div> <iframe data-cookieconsent="marketing" class="responsive-iframe" data-src="@presentationVideo" width="640" height="360" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe> } else { <iframe class="responsive-iframe" src="@presentationVideo" width="640" height="360" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe> } </div> </div> } </div> @RenderingService.Instance.PartialView( "ecom/product/partials/product-details/MCH365-related-products.cshtml", productProduct ) </div> <div class="col-12 col-md-5 col-lg-4 p-columns"> <div class="row"> <div class="col-12"> @if ( images.Any() ) { <div class="row mb-2 d-none d-md-flex"> @RenderingService.Instance.PartialView( "ecom/product/partials/product-details/MCH365-image-carousel.cshtml", productProduct ) </div> } <div class="row no-gutters"> <div class="col-12"> @if ( productProduct.PrizeWinning ) { <div class="mb-2"> <div class="bg-gradient border-radius-sm align-items-center p-2 h-100 small"> <span> <div class="row"> <div class="col-12 "> @if ( tradeshowName != "" ) { <span class="small">@tradeshowName</span> } <h3 class="m-0">@Translate( "MCH365 - Product details Prizewinner - Heading", "Prisvinder" )</h3> <p class="mb-0 mt-1"> @Translate( "MCH365 - Product details Prizewinner - Text", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vel nibh lectus. Praesent sagittis tempor aliquet." ) </p> </div> </div> </span> </div> </div> } @if ( isPresent ) { <div class="mb-2"> <div class="bg-gradient border-radius-sm align-items-center p-2 h-100 small"> <span> <div class="row"> <div class="col-12 "> @if ( tradeshowName != "" ) { <span class="small">@tradeshowName</span> } <h3 class="m-0">@Translate( "MCH365 - Product details IsPresent - Heading", "Produktet er medbragt på messen." )</h3> <p class="mb-0 mt-1"> @Translate( "MCH365 - Product details IsPresent - Text", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vel nibh lectus. Praesent sagittis tempor aliquet." ) </p> </div> </div> </span> </div> </div> } </div> <div class="col-12 bg-gradient border-radius p-2 mch365-custom-product-details-sidebar mt-4 mb-4" id="companyInfo"> @if ( productProduct?.Profile?.Company?.Logo != null ) { string logoImage = productProduct.Profile.Company.Logo; string companyBackgroundColor = productProduct.Profile.Company.BrandColor; string noCompanyInfo = ""; string textLight = "e-text-light"; if (string.IsNullOrEmpty(logoImage) && string.IsNullOrEmpty(companyBackgroundColor)) { noCompanyInfo = "bg-light"; textLight = "text-muted"; } string noLogoBackground = ""; if (string.IsNullOrEmpty(logoImage) && !string.IsNullOrEmpty(companyBackgroundColor)) { noLogoBackground = "style=\"background:" + companyBackgroundColor + ";\""; } <span class="d-block px-custom-logo mx-auto mb-3"> <div class="e-productlist-item-image-container border-radius-double @noCompanyInfo" @noLogoBackground> <div class="e-productlist-item-image-wrapper justify-content-center align-items-center d-flex @textLight"> @{ if (string.IsNullOrEmpty(logoImage)) { <span class="h1 mb-0">@productProduct.Profile.Company.Name.Substring(0,1).ToLower()</span> } else { <img alt="@productProduct.Profile.Company.Name" class="e-productlist-item-image w-100 p-1" src="@(productProduct.Profile.Company.Logo)"> } } </div> </div> </span> } <p class="small mb-half">@Translate( "MCH365 - Product details CreatedBy - Heading", "Produktet udbydes af:" )</p> <h4 class="mt-0 mb-2">@productProduct.Profile.Company.Name</h4> <p class="small line-clamp-10"> @Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService.Instance.GetTruncatedFormattedString( productProduct.Profile.Company.Description, 600 ) </p> @*DB: Hvordan gør vi dette?*@ <a class="btn btn-transparent mt-2" href="@productProduct.Profile.Link"> @Translate( "MCH365 - Product details ExhibitorProfile - Link", "Se profil" ) </a> </div> </div> </div> </div> </div> </div> </div> </div> </div> @RenderingService.Instance.SectionEnd() @RenderingService.Instance.SectionStart( new SectionSettings() ) @SnippetStart("profileProductCompanyDescription")@productDescriptionFormattedMetaDesc@SnippetEnd("profileProductCompanyDescription") @* Avoid using linebreaks in this snippet, as it will also add linebreaks to the content *@ @SnippetStart("profileProductCompanyName")@productName@SnippetEnd("profileProductCompanyName") @* Avoid using linebreaks in this snippet, as it will also add linebreaks to the content *@
keyboard_arrow_up