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 : P4d0d3d6eff7278584c9256200010a.
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_a166f1a12ad94bcdb5f47bdcfd631a7f.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 2 @using System.Web 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.Data.Models.MCH365 7 @using Co3.MCH.Website.Frontend.Models.Frontend 8 @using Co3.MCH.Website.Frontend.Models.Frontend.Ecommerce 9 @using Co3.MCH.Website.Frontend.Models.Frontend.Users 10 @using Dynamicweb.Frontend 11 @using Co3.Espresso.Base.Extensions 12 13 14 @{ 15 ProductProduct productProduct = ( ProductProduct ) Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService.Instance.GetEspressoProduct( 16 new ProductSettings() 17 { 18 Id = GetString( "Ecom:Product.ID" ), 19 VariantId = GetString( "Ecom:Product.VariantID" ), 20 PrimaryVariantId = GetString( "Ecom:Product.DefaultVariantComboID" ), 21 EmbeddedInModelList = true 22 }, nameof( ProductProduct ) 23 ); 24 25 26 string tradeshowCode = PageView.Current().Area.Item[ "TradeShowCode" ].ToString(); 27 string tradeshowName = MCH365Context.Current.TradeShowDetails.Name; 28 bool presentationCategoriesPresent = productProduct.CategoryFieldValues != null && productProduct.CategoryFieldValues.Any(); 29 30 bool hasCookiebot = PageView.Current().Area.Item[ "Cookiebot" ].ToString() == "True"; 31 32 string latestProductlistPage = SearchEngineFriendlyURLs.GetFriendlyUrl( PageView.Current().Page.Parent.GetPageHrefValue() ); 33 if ( UserContext.Current.LatestProductListPageIds.ContainsKey( "product" ) ) 34 { 35 latestProductlistPage = SearchEngineFriendlyURLs.GetFriendlyUrl( string.Format("Default.aspx?ID={0}", UserContext.Current.LatestProductListPageIds["product"]) ); 36 } 37 38 bool isPresent = productProduct.IsPresent; 39 List< string > images = new List< string > {productProduct.Image, productProduct.Image2, productProduct.Image3, productProduct.Image4, productProduct.Image5}; 40 images = images.Where( i => !string.IsNullOrEmpty( i ) ).ToList(); 41 42 43 44 45 // VIDEO 46 47 string presentationVideoRaw = productProduct.Video; 48 49 string presentationVideo; 50 51 if ( presentationVideoRaw.Contains( "https://vimeo.com/" ) ) 52 { 53 presentationVideo = "https://player.vimeo.com/video/" + ( presentationVideoRaw.Replace( "https://vimeo.com/", "" ) ); 54 } 55 else if ( presentationVideoRaw.Contains( "https://youtu" ) ) 56 { 57 presentationVideo = ( "https://www.youtube.com/embed/" + presentationVideoRaw.Replace( "https://youtu.be/", "" ).Replace( "https://www.youtube.com/embed/", "" ) ); 58 } 59 else if ( presentationVideoRaw.Contains( "https://www.youtube.com/watch?v=" ) ) 60 { 61 presentationVideo = ( "https://www.youtube.com/embed/" + presentationVideoRaw.Replace( "https://www.youtube.com/watch?v=", "" ) ); 62 } 63 else 64 { 65 presentationVideo = ( "https://www.youtube.com/embed/" + presentationVideoRaw ); 66 } 67 68 string productName = productProduct.Name.Replace("\"", "'"); 69 70 string productDescriptionFormatted = productProduct.DescriptionFormatted; 71 string productDescriptionFormattedStrippedHtml = productDescriptionFormatted.StripHtml(); 72 73 string productDescriptionFormattedMetaDesc = !string.IsNullOrEmpty(productDescriptionFormattedStrippedHtml) ? productDescriptionFormattedStrippedHtml : productName; 74 75 if ( productDescriptionFormattedStrippedHtml.Length > 160 ) 76 { 77 productDescriptionFormattedMetaDesc = !string.IsNullOrEmpty(productDescriptionFormattedStrippedHtml) ? productDescriptionFormattedStrippedHtml.Substring(0, 160) : productName; 78 } 79 80 81 } 82 83 @RenderingService.Instance.SectionEnd() 84 85 @RenderingService.Instance.SectionStart( new SectionSettings 86 { 87 Classes = new ClassList( "e-section mch365-custom-product-details-wrapper" ) 88 } ) 89 90 91 <div class="col-12 p-columns mch365-custom-product-details-wrapper-main-content"> 92 <div class="row mt-0 mt-md-4"> 93 <div class="col-12"> 94 <div class="row"> 95 96 <div class="col-12 col-md-7 col-lg-8 mb-5 mb-md-0 p-columns"> 97 @if ( images.Any() ) 98 { 99 <div class="row mb-2 d-md-none"> 100 @RenderingService.Instance.PartialView( "ecom/product/partials/product-details/MCH365-image-carousel-mobile.cshtml", productProduct ) 101 </div> 102 } 103104 <h1 class="mega mb-half mt-0">@productProduct.Name</h1> 105 <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> 106 <span class="d-md-none"> 107 <p class="mt-0"> 108 <a class="text-black" href="@( PageView.Current().SearchFriendlyUrl )#companyInfo">@productProduct.Profile.Company.Name</a> 109 </p> 110 </span> 111112 @if ( presentationCategoriesPresent ) 113 { 114 <ul class="mch365-custom-product-product-details-categories-list"> 115 @foreach ( KeyValuePair< string, CategoryFieldValue > subcategory in productProduct.CategoryFieldValues ) 116 { 117 string filterValue = string.Format( "C{0}|{1}", tradeshowCode, subcategory.Key ); 118 <li> 119 <a href="@(latestProductlistPage)?PresentationCategory=@filterValue">@subcategory.Value.FieldLabel</a> 120 </li> 121 } 122 </ul> 123 } 124125 <div class="row"> 126 <div class="col-12 col-md-11"> 127 <p> 128 @productProduct.DescriptionFormatted 129 </p> 130 </div> 131132 @if ( !string.IsNullOrEmpty( presentationVideoRaw ) ) 133 { 134 <div class="col-12 col-md-11"> 135 <div class="video-container my-1"> 136 @if (hasCookiebot) 137 { 138 <div class="cookieconsent-optout-marketing "> 139 <a href="javascript:Cookiebot.renew()" class="btn"> 140 <small>@Translate("Cookies - Accept to watch", "Accepter marketing-cookies for at se denne video.")</small> 141 <br/> 142 <i class="material-icons">play_arrow</i> 143 </a> 144 </div> 145 <iframe data-cookieconsent="marketing" class="responsive-iframe" data-src="@presentationVideo" width="640" height="360" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe> 146 } 147 else 148 { 149 <iframe class="responsive-iframe" src="@presentationVideo" width="640" height="360" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe> 150 } 151 </div> 152 </div> 153 } 154 </div> 155 @RenderingService.Instance.PartialView( "ecom/product/partials/product-details/MCH365-related-products.cshtml", productProduct ) 156 </div> 157158 <div class="col-12 col-md-5 col-lg-4 p-columns"> 159 <div class="row"> 160 <div class="col-12"> 161 @if ( images.Any() ) 162 { 163 <div class="row mb-2 d-none d-md-flex"> 164 @RenderingService.Instance.PartialView( "ecom/product/partials/product-details/MCH365-image-carousel.cshtml", productProduct ) 165 </div> 166 } 167168 <div class="row no-gutters"> 169 <div class="col-12"> 170 @if ( productProduct.PrizeWinning ) 171 { 172 <div class="mb-2"> 173 <div class="bg-gradient border-radius-sm align-items-center p-2 h-100 small"> 174 <span> 175 <div class="row"> 176 <div class="col-12 "> 177 @if ( tradeshowName != "" ) 178 { 179 <span class="small">@tradeshowName</span> 180 } 181 <h3 class="m-0">@Translate( "MCH365 - Product details Prizewinner - Heading", "Prisvinder" )</h3> 182 <p class="mb-0 mt-1"> 183 @Translate( "MCH365 - Product details Prizewinner - Text", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vel nibh lectus. Praesent sagittis tempor aliquet." ) 184 </p> 185 </div> 186 </div> 187 </span> 188 </div> 189 </div> 190 } 191 @if ( isPresent ) 192 { 193 <div class="mb-2"> 194 <div class="bg-gradient border-radius-sm align-items-center p-2 h-100 small"> 195 <span> 196 <div class="row"> 197 <div class="col-12 "> 198 @if ( tradeshowName != "" ) 199 { 200 <span class="small">@tradeshowName</span> 201 } 202 <h3 class="m-0">@Translate( "MCH365 - Product details IsPresent - Heading", "Produktet er medbragt på messen." )</h3> 203 <p class="mb-0 mt-1"> 204 @Translate( "MCH365 - Product details IsPresent - Text", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vel nibh lectus. Praesent sagittis tempor aliquet." ) 205 </p> 206 </div> 207 </div> 208 </span> 209 </div> 210 </div> 211 } 212 </div> 213214 <div class="col-12 bg-gradient border-radius p-2 mch365-custom-product-details-sidebar mt-4 mb-4" id="companyInfo"> 215 @if ( productProduct?.Profile?.Company?.Logo != null ) 216 { 217 string logoImage = productProduct.Profile.Company.Logo; 218 string companyBackgroundColor = productProduct.Profile.Company.BrandColor; 219220 string noCompanyInfo = ""; 221 string textLight = "e-text-light"; 222223 if (string.IsNullOrEmpty(logoImage) && string.IsNullOrEmpty(companyBackgroundColor)) 224 { 225 noCompanyInfo = "bg-light"; 226 textLight = "text-muted"; 227 } 228229 string noLogoBackground = ""; 230 if (string.IsNullOrEmpty(logoImage) && !string.IsNullOrEmpty(companyBackgroundColor)) 231 { 232 noLogoBackground = "style=\"background:" + companyBackgroundColor + ";\""; 233 } 234 <span class="d-block px-custom-logo mx-auto mb-3"> 235 <div class="e-productlist-item-image-container border-radius-double @noCompanyInfo" @noLogoBackground> 236237238 <div class="e-productlist-item-image-wrapper justify-content-center align-items-center d-flex @textLight"> 239 @{ 240 if (string.IsNullOrEmpty(logoImage)) 241 { 242 <span class="h1 mb-0">@productProduct.Profile.Company.Name.Substring(0,1).ToLower()</span> 243 } 244 else 245 { 246 <img alt="@productProduct.Profile.Company.Name" class="e-productlist-item-image w-100 p-1" src="@(productProduct.Profile.Company.Logo)"> 247 } 248 } 249 </div> 250 </div> 251 </span> 252 } 253 <p class="small mb-half">@Translate( "MCH365 - Product details CreatedBy - Heading", "Produktet udbydes af:" )</p> 254 <h4 class="mt-0 mb-2">@productProduct.Profile.Company.Name</h4> 255 <p class="small line-clamp-10"> 256 @Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService.Instance.GetTruncatedFormattedString( productProduct.Profile.Company.Description, 600 ) 257 </p> 258259 @*DB: Hvordan gør vi dette?*@ 260 <a class="btn btn-transparent mt-2" href="@productProduct.Profile.Link"> 261 @Translate( "MCH365 - Product details ExhibitorProfile - Link", "Se profil" ) 262 </a> 263 </div> 264265 </div> 266 </div> 267 </div> 268 </div> 269 </div> 270 </div> 271 </div> 272 </div> 273274275 @RenderingService.Instance.SectionEnd() 276277 @RenderingService.Instance.SectionStart( new SectionSettings() ) 278279 @SnippetStart("profileProductCompanyDescription")@productDescriptionFormattedMetaDesc@SnippetEnd("profileProductCompanyDescription") @* Avoid using linebreaks in this snippet, as it will also add linebreaks to the content *@ 280 @SnippetStart("profileProductCompanyName")@productName@SnippetEnd("profileProductCompanyName") @* Avoid using linebreaks in this snippet, as it will also add linebreaks to the content *@
keyboard_arrow_up