Produkter medbragt på

Agromek 2024


 

Hvilke produkter interesserer dig?

Error executing template "Designs/exhibition_site/QueryPublisher/MCH365-products-with-filters.cshtml"
System.Exception: Product is not of type Co3.MCH.Website.Frontend.Models.Frontend.MCH365.Product. Check asset type of product id : AP0ca347be3c9ae1dfc6b456c59242.
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_196e07905b254f038f0b49202bf02572.<>c__DisplayClass1_0.<Execute>b__0(LoopItem product) in E:\dynamicweb.net\Solutions\mch365.espresso5.dk\Files\Templates\Designs\exhibition_site\QueryPublisher\MCH365-products-with-filters.cshtml:line 87
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at CompiledRazorTemplates.Dynamic.RazorEngine_196e07905b254f038f0b49202bf02572.Execute() in E:\dynamicweb.net\Solutions\mch365.espresso5.dk\Files\Templates\Designs\exhibition_site\QueryPublisher\MCH365-products-with-filters.cshtml:line 83
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 @using Co3.Espresso.Website.Models.FrontEnd 2 @using Co3.Espresso.Website.Models.FrontEnd.Ecommerce 3 @using Co3.Espresso.Website.Models.FrontEnd.Handlebars 4 @using Co3.Espresso.Website.Models.FrontEnd.Settings 5 @using Co3.Espresso.Website.Services 6 @using Co3.MCH.Website.Frontend.Models.Frontend.Ecommerce 7 @using Co3.MCH.Website.Frontend.Models.Frontend.Users 8 @using Dynamicweb 9 @using Dynamicweb.Ecommerce.ProductCatalog 10 @using Dynamicweb.Frontend 11 @using ProductService = Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService 12 @using System.Web 13 @inherits Co3.Espresso.Website.TemplateBases.Paragraphs.Module 14 15 16 @{ 17 bool showFilters = Espresso.Item.FiltersShow == "True"; 18 EspressoSort sort = ProductListService.Instance.GetSort(); 19 string assetType = Espresso.Item.Type; 20 string q = HttpUtility.HtmlAttributeEncode( HttpContext.Current.Request[ "q" ] ); 21 22 UserContext.Current.UpdateLatestProductListPageIds( assetType, PageView.Current().Page.ID ); 23 24 HandlebarsProductListTemplate handlebarsProductListTemplate = HandlebarsService.Instance.GetProductListTemplate( new HandlebarsProductListTemplateSettings 25 { 26 Classes = new ClassList( "e-productlist js-e-productlist js-e-require" ), 27 HeaderClasses = new ClassList( "col-12 border-bottom" ), 28 MainClasses = new ClassList( showFilters ? "col-12 col-lg-9 col-xl-9" : "col-12" ), 29 AsideClasses = new ClassList( "col-12 col-lg-3 col-xl-3" ), 30 FooterClasses = new ClassList( "col-12 col-lg-3 col-xl-3" ), 31 PageSize = string.IsNullOrEmpty( HttpContext.Current.Request[ "PageSize" ] ) ? GetInteger( "DwPaging.PageSize" ).ToString() : HttpContext.Current.Request[ "PageSize" ], 32 PageNumber = string.IsNullOrEmpty( HttpContext.Current.Request[ "PageNum" ] ) ? GetInteger( "DwPaging.CurrentPage" ).ToString() : HttpContext.Current.Request[ "PageNum" ], 33 SortBy = string.IsNullOrEmpty( HttpContext.Current.Request[ "SortBy" ] ) ? sort.By : HttpContext.Current.Request[ "SortBy" ], 34 SortOrder = string.IsNullOrEmpty( HttpContext.Current.Request[ "SortOrder" ] ) ? sort.Order : HttpContext.Current.Request[ "SortOrder" ], 35 ShowFilters = showFilters, 36 ShowSorting = Espresso.Item.SortShow == "True", 37 Heading = Espresso.Item.HeadingShow == "True" ? Espresso.Item.Name : string.Empty 38 } ); 39 40 41 List< EspressoPagingPage > productListPaging = new List< EspressoPagingPage >(); 42 if ( GetLoop( "DwPaging.LoopAllPages" ).Count > 0 ) 43 { 44 foreach ( LoopItem page in GetLoop( "DwPaging.LoopAllPages" ) ) 45 { 46 productListPaging.Add( new EspressoPagingPage 47 { 48 Url = page.GetString( "AllPages.PageLink" ), 49 Number = page.GetString( "AllPages.PageNumber" ) 50 } ); 51 } 52 } 53 54 string listKey = string.Empty; 55 switch ( assetType ) 56 { 57 case "article": 58 listKey = nameof( ArticleMergeProduct ); 59 break; 60 case "case": 61 listKey = nameof( ArticleMergeProduct ); 62 break; 63 case "articlemerge": 64 listKey = nameof( ArticleMergeProduct ); 65 break; 66 case "event": 67 listKey = nameof( EventProduct ); 68 break; 69 case "contact": 70 listKey = nameof( ContactPersonProduct ); 71 break; 72 case "product": 73 listKey = nameof( ProductProduct ); 74 break; 75 case "profile": 76 listKey = nameof( ProfileProduct ); 77 break; 78 default: 79 listKey = nameof( ProductProduct ); 80 break; 81 } 82 83 EspressoProductList espressoProductList = Co3.MCH.Website.Frontend.Services.Ecommerce.ProductListService.Instance.GetProductList( 84 new ProductListSettings 85 { 86 Products = GetLoop( "QueryResultItem" ).Select( 87 product => ProductService.Instance.GetEspressoProduct( 88 new ProductSettings 89 { 90 Id = product.GetString( "ID" ), 91 VariantId = product.GetString( "VariantID" ), 92 PrimaryVariantId = product.GetString( "DefaultVariantComboID" ), 93 EmbeddedInModelList = true 94 }, listKey 95 ) 96 ).ToList(), 97 Paging = productListPaging, 98 PageSize = Convert.ToInt32( handlebarsProductListTemplate.PageSize ), 99 CurrentPage = Convert.ToInt32( handlebarsProductListTemplate.PageNumber ) 100 }, listKey ); 101102 @*if ( !string.IsNullOrEmpty( Context.Current.Request.QueryString.Get( "ListViewMode" ) ) ) 103 { 104 Dynamicweb.Context.Current.Session[ "ListViewMode" ] = Context.Current.Request.QueryString.Get( "ListViewMode" ); 105 }*@ 106 string listViewMode = string.IsNullOrEmpty( Context.Current.Session[ "ListViewMode" ]?.ToString() ) ? "expanded" : Context.Current.Session[ "ListViewMode" ]?.ToString(); 107 List< FacetOptionViewModel > listViewOptions = new List< FacetOptionViewModel >(); 108 listViewOptions.Add( new FacetOptionViewModel 109 { 110 Name = "Expanded", 111 Value = "expanded", 112 Selected = listViewMode == "expanded", 113 Label = "/Files/Templates/Designs/exhibition_site/_assets/img/layout-large.svg" 114 } ); 115 listViewOptions.Add( new FacetOptionViewModel 116 { 117 Name = "Condensed", 118 Value = "condensed", 119 Selected = listViewMode == "condensed", 120 Label = "/Files/Templates/Designs/exhibition_site/_assets/img/layout-small.svg" 121 } ); 122 } 123124 <div class="@handlebarsProductListTemplate.Classes" data-current-page="@GetInteger( "Ecom:ProductList.CurrentPage" )" data-page-count="@GetLoop( "Ecom:ProductList.Pages" ).Count" data-page-size="@handlebarsProductListTemplate.PageSize" data-products-url="@Espresso.Item.ProductsUrl" data-filters-url="@Espresso.Item.ProductsUrl" data-require="productlist"> 125 <div class="row"> 126 <div class="col-12"> 127 <div class="d-flex"> 128 <form class="js-e-productlist-form js-e-require flex-fill" data-require="selectMultiple"> 129 <input name="PageNum" type="hidden" value="@HttpUtility.HtmlAttributeEncode( handlebarsProductListTemplate.PageNumber )"> 130 <input name="SortBy" type="hidden" value="@HttpUtility.HtmlAttributeEncode( handlebarsProductListTemplate.SortBy )"> 131 <input name="SortOrder" type="hidden" value="@HttpUtility.HtmlAttributeEncode( handlebarsProductListTemplate.SortOrder )"> 132 <input name="PageSize" type="hidden" value="@HttpUtility.HtmlAttributeEncode( handlebarsProductListTemplate.PageSize )"> 133 <input name="ProductAssetType" type="hidden" value="@HttpUtility.HtmlAttributeEncode( assetType )"> 134 <input id="ListViewMode" name="ListViewMode" type="hidden" value="@listViewMode"/> 135136 @if ( Espresso.Item.SearchShow != "True" ) 137 { 138 <input name="q" type="hidden" class="e-productlist-filters-search-input e-search-input form-control-plaintext js-e-search-input" value="@q"> 139 } 140141 @if ( handlebarsProductListTemplate.ShowFilters ) 142 { 143 foreach ( LoopItem facetGroup in GetLoop( "FacetGroups" ) ) 144 { 145 <input name="fg" type="hidden" value="@facetGroup.GetString( "FacetGroup.Name" )"> 146 } 147 } 148149 @foreach ( LoopItem queryParameter in GetLoop( "Query.Parameters" ) ) 150 { 151 if ( string.IsNullOrEmpty( queryParameter.GetString( "Parameter.Value" ) ) == false ) 152 { 153 if ( queryParameter.GetBoolean( "Parameter.IsHandledAsFacet" ) == false && queryParameter.GetString( "Parameter.Name" ) != "q" ) 154 { 155 <input name="@queryParameter.GetString( "Parameter.Name" )" type="hidden" value="@HttpUtility.HtmlAttributeEncode( queryParameter.GetString( "Parameter.Value" ) )"> 156 } 157 } 158 } 159160 @RenderingService.Instance.PartialView( "querypublisher/partials/mch365-filters.cshtml", Espresso ) 161 </form> 162163 @if ( assetType == "profile" ) 164 { 165 <div class="d-none d-md-block"> 166 <div class="mch365-custom-list-view-toggle js-custom-list-view-toggle ml-2"> 167 <div class="d-flex "> 168 @foreach ( FacetOptionViewModel listViewOption in listViewOptions ) 169 { 170 string listViewOptionName = listViewOption.Name; 171 string expandedLabel = Translate("listViewOption - Expanded", "Gittervisning"); 172 string condensesLabel = Translate("listViewOption - Condensed", "Listevisning"); 173174175 string cssClassSelected = listViewOption.Selected ? "active" : string.Empty; 176 <a class="@cssClassSelected d-flex align-items-center js-custom-list-view-option" data-target="#ListViewMode" data-value="@listViewOption.Value" href="/"> 177 <span> 178 <i class="e-icon">@ImageService.Instance.GetSvgMarkup(listViewOption.Label)</i> 179 </span> 180 @if (listViewOptionName == "Expanded") 181 { 182 @expandedLabel 183 } 184 else 185 { 186 @condensesLabel 187 } 188 </a> 189190 } 191 </div> 192 </div> 193 </div> 194 } 195 </div> 196197 @RenderingService.Instance.PartialView( "querypublisher/partials/mch365-header.cshtml", handlebarsProductListTemplate ) 198199 </div> 200201 <div class="col-12"> 202 @RenderingService.Instance.PartialView( "querypublisher/partials/mch365-products.cshtml", espressoProductList ) 203 @RenderingService.Instance.PartialView( "querypublisher/partials/mch365-paging.cshtml", espressoProductList ) 204 </div> 205 </div> 206 </div> 207
keyboard_arrow_up