Standard
Exception in template (Designs\Basic\eCom/Productlist/ProductList.cshtml): System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at CompiledRazorTemplates.Dynamic.ddebcdaebbaedb.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateBase.cs:line 126
   at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateService.cs:line 608
   at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateService.cs:line 439
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Razor.cs:line 276
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()
@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System; @using Dynamicweb; @using Dynamicweb.Core; @using Dynamicweb.Core.Encoders; @using Dynamicweb.Ecommerce.Products @using Dynamicweb.Environment; @using Dynamicweb.Frontend @using Dynamicweb.Environment.Helpers; @using System; @using Dynamicweb; @using SGMLight.Website.CustomModules.Helpers; @using System.Linq; @using System.Collections.Generic; @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @helper RenderProductFilters(bool mobile = false) { @* Base.GetHttpUrl(true, false) *@ <form name="EcomSearch" class="js-form-filters" method="get" action="/Default.aspx" data-page-url='@Dynamicweb.Environment.Helpers.LinkHelper.GetHttpDomain()'> <input type="hidden" name="ID" value='@Pageview.Page.ID' /> @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("SortBy"))) { <input type="hidden" name="SortBy" value='@Dynamicweb.Context.Current.Request.GetString("SortBy")' /> } @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("SortOrder"))) { <input type="hidden" name="SortOrder" value='@Dynamicweb.Context.Current.Request.GetString("SortOrder")' /> } @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("GroupID"))) { <input type="hidden" name="GroupID" value='@Dynamicweb.Context.Current.Request.GetString("GroupID")' /> } @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("q"))) { <input type="hidden" name="q" value='@Dynamicweb.Context.Current.Request.GetString("q")' /> } <input type="submit" class="sr-only"> @{ var facetGroups = GetLoop("FacetGroups"); bool skipFacet = false; string skipFacetGroup = Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["SkipFacetGroup"]); string skipFacetName = Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["SkipFacetName"]); var queryParameter = GetLoop("Query.Parameters").FirstOrDefault(x => x.GetString("Parameter.Name").ToLower() == "groupid"); if (queryParameter != null && queryParameter.GetString("Parameter.Value") == skipFacetGroup) { skipFacet = true; } } @if (facetGroups.Any()) { var navString = RenderNavigation(new { template = "FacetNavigation.xslt", expandmode = "all", startlevel = 2, endlevel = 4 }); List<string> validGroups = new List<string>(); if (!string.IsNullOrEmpty(navString)) { var arrGroups = navString.Split(";".ToCharArray()); foreach (var group in arrGroups) { if (!string.IsNullOrEmpty(group)) { validGroups.Add(group.Substring(group.LastIndexOf("=") + 1)); } } } bool facetFound = false; <div> <div class="your-choises"> <h6 class="font-weight-semibold">@Translate("Co3:Productlist.Facets.FilterSelection", "Filter selections")</h6> @foreach (LoopItem i in facetGroups) { foreach (LoopItem j in i.GetLoop("Facets")) { if (facetFound) { break; } foreach (LoopItem k in j.GetLoop("FacetOptions")) { if (k.GetBoolean("FacetOption.Selected")) { facetFound = true; <small class="btn btn-block btn-small reset_filter">@Translate("Smartpage:Productlist.Facets.ResetAll", "Reset all")</small> break; } } } } <ul class="co3-selected-filters"> @foreach (LoopItem i in facetGroups) { foreach (LoopItem j in i.GetLoop("Facets")) { foreach (LoopItem k in j.GetLoop("FacetOptions")) { if (k.GetBoolean("FacetOption.Selected")) { var inputId1 = j.GetString("Facet.QueryParameter") + "_" + k.GetString("FacetOption.Value"); <li> <svg class="js-remove-facet" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14" data-target="@inputId1.Replace(" ", "_")"> <path class="cls-1" d="M11.95,2.05a7,7,0,0,0-9.9,0A7,7,0,0,0,7,14,7,7,0,0,0,11.95,2.05Zm-.56,9.34A6.2,6.2,0,0,1,2.61,2.61a6.2,6.2,0,0,1,8.77,8.77Zm-1.3-7.47a.4.4,0,0,0-.56,0L7,6.44,4.48,3.92a.4.4,0,0,0-.56.56L6.44,7,3.91,9.52a.4.4,0,0,0,.28.68.39.39,0,0,0,.28-.12L7,7.56l2.52,2.52a.4.4,0,0,0,.28.12.38.38,0,0,0,.28-.12.4.4,0,0,0,0-.56L7.56,7l2.52-2.52A.4.4,0,0,0,10.09,3.92Z" transform="translate(0)" /> </svg> <span class='choise-label'>@k.GetString("FacetOption.Label")</span> </li> } } } } </ul> </div> @foreach (LoopItem i in facetGroups) { foreach (LoopItem j in i.GetLoop("Facets")) { if (skipFacet && j.GetString("Facet.Name").ToLower() == skipFacetName) { continue; } var facetOptions = j.GetLoop("FacetOptions"); if (facetOptions.Any()) { int counter = 0; int facetCount = Dynamicweb.Core.Converter.ToInt32(Pageview.Area.Item["ProductFacetsShown"]); <div class="filter-section"> @if (mobile) { <button class="btn btn-blank btn-block text-xs-left" type="button" data-toggle="collapse" data-target="#filter-mobile-@j.GetString("Facet.QueryParameter")" aria-expanded="false" aria-controls="filter-@j.GetString("Facet.QueryParameter")"> <span class="facet-name"><i class="js-ecom-productlist-facet-spinner pull-right"></i><i class="fa fa-angle-down pull-right" aria-hidden="true"></i> @j.GetValue("Facet.Name")</span> </button> <div class="collapse js-foldable-section" id="filter-mobile-@j.GetString("Facet.QueryParameter")"> @foreach (LoopItem k in facetOptions.OrderBy(f => f.GetInteger("FacetOption.Sort"))) { counter++; string hiddenClass = ""; if (j.GetString("Facet.QueryParameter").ToLower() == "product-category".ToLower()) { if (!validGroups.Contains(@k.GetString("FacetOption.Value"))) { continue; } } var inputId = j.GetString("Facet.QueryParameter") + "_" + k.GetString("FacetOption.Value"); <div class="js-facet-container @hiddenClass filter-container"> <div class="form-check"> <label class="form-check-label" for="@inputId.Replace(" ", "_")"> <input id="@inputId.Replace(" ", "_")-mobile" class="form-check-input js-select-filter-option" type="checkbox" value='@k.GetString("FacetOption.Value")' name='@j.GetString("Facet.QueryParameter")' checked='@k.GetBoolean("FacetOption.Selected")'> <span class="control-indicator"></span> <span class="facet-label">@k.GetValue("FacetOption.Label")</span> <span class="facet-quantity">(@k.GetValue("FacetOption.Count"))</span> </label> </div> </div> } </div> } else { <button class="btn btn-blank btn-block text-xs-left" type="button" data-toggle="collapse" data-target="#filter-@j.GetString("Facet.QueryParameter")" aria-expanded="@(j.GetString("Facet.QueryParameter") == "product-series" ? "true" : "false")" aria-controls="filter-@j.GetString("Facet.QueryParameter")"> <span class="facet-name"><i class="js-ecom-productlist-facet-spinner pull-right"></i><i class="fa fa-angle-down pull-right" aria-hidden="true"></i> @j.GetValue("Facet.Name")</span> </button> <div class="collapse @(j.GetString("Facet.QueryParameter") == "product-series" ? "in" : "") js-foldable-section" id="filter-@j.GetString("Facet.QueryParameter")"> @foreach (LoopItem k in facetOptions.OrderBy(f => f.GetInteger("FacetOption.Sort"))) { counter++; string hiddenClass = ""; if (j.GetString("Facet.QueryParameter").ToLower() == "product-category".ToLower()) { if (!validGroups.Contains(@k.GetString("FacetOption.Value"))) { continue; } } var inputId = j.GetString("Facet.QueryParameter") + "_" + k.GetString("FacetOption.Value"); <div class="js-facet-container @hiddenClass filter-container"> <div class="form-check"> <label class="form-check-label" for="@inputId.Replace(" ", "_")"> <input id="@inputId.Replace(" ", "_")" class="form-check-input js-select-filter-option" type="checkbox" value='@k.GetString("FacetOption.Value")' name='@j.GetString("Facet.QueryParameter")' checked='@k.GetBoolean("FacetOption.Selected")'> <span class="control-indicator"></span> <span class="facet-label">@k.GetValue("FacetOption.Label")</span> <span class="facet-quantity">(@k.GetValue("FacetOption.Count"))</span> </label> </div> </div> } </div> } </div> } } } </div> } </form> <div class="mobile_filter_search row no-gutters hidden-lg-up"> <div class="close-filters-container col-xs-5"> <button class="btn btn-border js-close-filter">@Translate("Smartpage:Facets.CloseFilter", "Luk")</button> </div> <div class="reset-filter-container col-xs-9"> <button class="btn btn-border reset_filter">@Translate("Smartpage:Facets.ResetFilter", "Nulstil")</button> </div> <div class="get-filter-results-container col-xs-10"> <button class="btn btn-border js-get-filter-results">@Translate("Smartpage:Facets.GetFilterResults", "Resultater")</button> </div> </div> } @helper RenderProjectFilter() { <form name="EcomSearch" class="js-form-filters" method="get" action="/Default.aspx" data-page-url='@Dynamicweb.Environment.Helpers.LinkHelper.GetHttpDomain()'> <input type="hidden" name="ID" value='@Pageview.Page.ID' /> @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("SortBy"))) { <input type="hidden" name="SortBy" value='@Dynamicweb.Context.Current.Request.GetString("SortBy")' /> } @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("SortOrder"))) { <input type="hidden" name="SortOrder" value='@Dynamicweb.Context.Current.Request.GetString("SortOrder")' /> } @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("GroupID"))) { <input type="hidden" name="GroupID" value='@Dynamicweb.Context.Current.Request.GetString("GroupID")' /> } @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("q"))) { <input type="hidden" name="q" value='@Dynamicweb.Context.Current.Request.GetString("q")' /> } <input type="submit" class="sr-only"> @{ var facetGroups = GetLoop("FacetGroups"); } @if (facetGroups.Any()) { List<string> facets = new List<string>(); foreach (LoopItem i in GetLoop("FacetGroups")) { foreach (LoopItem j in i.GetLoop("Facets")) { var facetOptions = j.GetLoop("FacetOptions"); string[] productIds = new string[facetOptions.Count]; if (j.GetString("Facet.QueryParameter").Equals("product")) { int counter = 0; foreach (LoopItem k in facetOptions) { productIds[counter] = k.GetString("FacetOption.Value"); counter++; } } IEnumerable<Dynamicweb.Ecommerce.Products.Product> products = null; // var products = Dynamicweb.Ecommerce.Products.Product.GetProductsByProductIDs(productIds);// Helpers.GetProductsByProductId(productIds); // IQueryable<T> products = null; if (j.GetString("Facet.QueryParameter").Equals("product")) { products = Helpers.GetProductsByProductId(productIds); //var products = Helpers.QueryProductIndex(productIds).QueryResult; // Dictionary<string, object> test = products.First() as Dictionary<string, object>; // @test.First().Value.GetType().ToString() // var product = products.Where((Dictionary<string, object> p) => p["ID"].ToString() == "18434"); // // products.First((Dictionary<string, object> p) => p.First(kp => kp.Key == "ID")); /* foreach (var t in test) { @t.Key @:<br /> } */ } Dictionary<string, Dictionary<string, string> > collection = new Dictionary< string, Dictionary<string, string> >(); <div class="col-lg-8 js-foldable-section" id="filter-@j.GetString("Facet.QueryParameter")"> <select name="@j.GetString("Facet.QueryParameter")" id="@j.GetString("Facet.QueryParameter")" class="form-style js-project-filter"> <option value="">By @j.GetString("Facet.QueryParameter")</option> @foreach (LoopItem k in facetOptions.OrderBy(f => f.GetValue("FacetOption.Value"))) { var inputId = j.GetString("Facet.QueryParameter") + "_" + k.GetString("FacetOption.Value"); if (j.GetString("Facet.QueryParameter").Equals("product")) { var product = products.Where(x => x.Id == k.GetString("FacetOption.Value")).FirstOrDefault(); // products.FirstOrDefault(x => x.Id == k.GetString("FacetOption.Value") if ( product != null ) { Dictionary< string, string > productItem = new Dictionary< string, string >(); productItem.Add( "Id", k.GetString( "FacetOption.Value" ) ); productItem.Add( "Selected", k.GetBoolean( "FacetOption.Selected" ) ? "selected" : "" ); productItem.Add( "Count", k.GetString( "FacetOption.Count" ) ); productItem.Add( "Name", product.Name ); collection.Add( product.Name, productItem ); } } else { <option value='@k.GetString("FacetOption.Value")' selected='@k.GetBoolean("FacetOption.Selected")'>@k.GetString("FacetOption.Value") (@k.GetValue("FacetOption.Count"))</option> } } @foreach (KeyValuePair<string, Dictionary<string,string> > collectionItem in collection.OrderBy( x => x.Key ) ) { string id; string selected; string count; string name; if(collectionItem.Value.TryGetValue("Id", out id) && collectionItem.Value.TryGetValue("Selected", out selected) && collectionItem.Value.TryGetValue("Count", out count) && collectionItem.Value.TryGetValue("Name", out name)) { string option = "<option value='" + id + "'" + selected + ">" + name + "(" + count + ")</option>"; @option } } </select> @foreach (LoopItem k in facetOptions.OrderBy(f => f.GetInteger("FacetOption.Sort"))) { var inputId = j.GetString("Facet.QueryParameter") + "_" + k.GetString("FacetOption.Value"); <div class="js-facet-container filter-container" style="display:none;"> <div class="form-check"> <label class="form-check-label" for="@inputId.Replace(" ", "_")"> <input id="@inputId.Replace(" ", "_")" class="form-check-input js-select-filter-option" type="checkbox" value='@k.GetString("FacetOption.Value")' name='@j.GetString("Facet.QueryParameter")' checked='@k.GetBoolean("FacetOption.Selected")'> </label> </div> </div> } </div> } } } </form> } @helper RenderCartFilter() { var queryService = Dynamicweb.Extensibility.ServiceLocator.Current.GetInstance<Dynamicweb.Indexing.Querying.IQueryService>(); Dynamicweb.Indexing.Querying.QuerySettings querySettings = new Dynamicweb.Indexing.Querying.QuerySettings(); querySettings.Take = 1000; Dynamicweb.Indexing.Querying.IQueryResult result = queryService.Query(queryService.LoadQuery("representatives", "representativeQuery.query"), querySettings); var dictionaries = result.QueryResult.Select(x => x as Dictionary<string, object>); var dictionariesFlattened = dictionaries.Select(x => x.ContainsKey("GroupCountry") ? (string)x["GroupCountry"] : ""); var countryCountList = dictionariesFlattened.GroupBy<string, string, int>(k => k, e => 1) .Select(f => new KeyValuePair<string, int>(f.Key, f.Sum())) .ToDictionary(k => k.Key, e => e.Value); <form name="EcomSearch" class="js-form-filters" method="get" action="/Default.aspx" data-page-url='@Dynamicweb.Environment.Helpers.LinkHelper.GetHttpDomain()'> <input type="hidden" name="ID" value='@Pageview.Page.ID' /> @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("SortBy"))) { <input type="hidden" name="SortBy" value='@Dynamicweb.Context.Current.Request.GetString("SortBy")' /> } @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("SortOrder"))) { <input type="hidden" name="SortOrder" value='@Dynamicweb.Context.Current.Request.GetString("SortOrder")' /> } @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("GroupID"))) { <input type="hidden" name="GroupID" value='@Dynamicweb.Context.Current.Request.GetString("GroupID")' /> } @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("q"))) { <input type="hidden" name="q" value='@Dynamicweb.Context.Current.Request.GetString("q")' /> } <input type="submit" class="sr-only"> @{ var facetGroups = GetLoop("FacetGroups"); } @if (facetGroups.Any()) { List<string> facets = new List<string>(); foreach (LoopItem i in GetLoop("FacetGroups")) { foreach (LoopItem j in i.GetLoop("Facets")) { var facetOptions = j.GetLoop("FacetOptions"); <div class="js-foldable-section" id="filter-@j.GetString("Facet.QueryParameter")"> <select id="@j.GetString("Facet.QueryParameter")" class="form-style js-project-filter country-selector"> <option value="">Select @j.GetString("Facet.QueryParameter")</option> @foreach (LoopItem k in facetOptions.OrderBy(f => f.GetInteger("FacetOption.Sort"))) { var facetValue = k.GetString("FacetOption.Value"); var inputId = j.GetString("Facet.QueryParameter") + "_" + facetValue; var facetCount = countryCountList.FirstOrDefault(x => x.Key.ToLower() == facetValue.ToLower()).Value; <option name="@j.GetString("Facet.QueryParameter")" value="@facetValue" selected="@k.GetBoolean("FacetOption.Selected")">@char.ToUpper(facetValue[0])@facetValue.Substring(1) (@facetCount)</option> } </select> @*@foreach (LoopItem k in facetOptions.OrderBy(f => f.GetInteger("FacetOption.Sort"))) { var inputId = j.GetString("Facet.QueryParameter") + "_" + k.GetString("FacetOption.Value"); <div class="js-facet-container filter-container"> <div class="form-check"> <label class="form-check-label" for="@inputId.Replace(" ", "_")"> <input id="@inputId.Replace(" ", "_")" class="form-check-input js-select-filter-option" type="checkbox" value='@k.GetString("FacetOption.Value")' name='@j.GetString("Facet.QueryParameter")' checked='@k.GetBoolean("FacetOption.Selected")'> </label> </div> </div> }*@ </div> } } } </form> } @helper RenderVideoFilter() { <form name="EcomSearch" class="js-form-filters" method="get" action="/Default.aspx" data-page-url='@Dynamicweb.Environment.Helpers.LinkHelper.GetHttpDomain()'> <input type="hidden" name="ID" value='@Pageview.Page.ID' /> @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("SortBy"))) { <input type="hidden" name="SortBy" value='@Dynamicweb.Context.Current.Request.GetString("SortBy")' /> } @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("SortOrder"))) { <input type="hidden" name="SortOrder" value='@Dynamicweb.Context.Current.Request.GetString("SortOrder")' /> } @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("GroupID"))) { <input type="hidden" name="GroupID" value='@Dynamicweb.Context.Current.Request.GetString("GroupID")' /> } @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.GetString("q"))) { <input type="hidden" name="q" value='@Dynamicweb.Context.Current.Request.GetString("q")' /> } <input type="submit" class="sr-only"> @{ var facetGroups = GetLoop("FacetGroups"); } @if (facetGroups.Any()) { List<string> facets = new List<string>(); foreach (LoopItem i in GetLoop("FacetGroups")) { foreach (LoopItem j in i.GetLoop("Facets")) { var facetOptions = j.GetLoop("FacetOptions"); string[] productIds = new string[facetOptions.Count]; if (j.GetString("Facet.QueryParameter").Equals("product")) { int counter = 0; foreach (LoopItem k in facetOptions) { productIds[counter] = k.GetString("FacetOption.Value"); counter++; } } IEnumerable<Dynamicweb.Ecommerce.Products.Product> products = null; // var products = Dynamicweb.Ecommerce.Products.Product.GetProductsByProductIDs(productIds);// Helpers.GetProductsByProductId(productIds); // IQueryable<T> products = null; if (j.GetString("Facet.QueryParameter").Equals("product")) { products = Helpers.GetProductsByProductId(productIds); //var products = Helpers.QueryProductIndex(productIds).QueryResult; // Dictionary<string, object> test = products.First() as Dictionary<string, object>; // @test.First().Value.GetType().ToString() // var product = products.Where((Dictionary<string, object> p) => p["ID"].ToString() == "18434");// products.First((Dictionary<string, object> p) => p.First(kp => kp.Key == "ID")); /* foreach (var t in test) { @t.Key @:<br /> } */ } <div class="col-lg-8 js-foldable-section" id="filter-@j.GetString("Facet.QueryParameter")"> <select name="@j.GetString("Facet.QueryParameter")" id="@j.GetString("Facet.QueryParameter")" class="form-style js-project-filter"> <option value="">By @j.GetString("Facet.QueryParameter")</option> @foreach (LoopItem k in facetOptions.OrderBy(f => f.GetValue("FacetOption.Label"))) { var inputId = j.GetString("Facet.QueryParameter") + "_" + k.GetString("FacetOption.Value"); if (j.GetString("Facet.QueryParameter").Equals("product")) { var product = products.Where(x => x.Id == k.GetString("FacetOption.Value")).FirstOrDefault();// products.FirstOrDefault(x => x.Id == k.GetString("FacetOption.Value")); if (product != null) { <option value='@k.GetString("FacetOption.Value")' selected='@k.GetBoolean("FacetOption.Selected")'>@product.Name (@k.GetValue("FacetOption.Count"))</option> } } else { <option value='@k.GetString("FacetOption.Value")' selected='@k.GetBoolean("FacetOption.Selected")'>@Translate(k.GetString("FacetOption.Value"), k.GetString("FacetOption.Value")) (@k.GetValue("FacetOption.Count"))</option> } } </select> @foreach (LoopItem k in facetOptions.OrderBy(f => f.GetInteger("FacetOption.Sort"))) { var inputId = j.GetString("Facet.QueryParameter") + "_" + k.GetString("FacetOption.Value"); <div class="js-facet-container filter-container" style="display:none;"> <div class="form-check"> <label class="form-check-label" for="@inputId.Replace(" ", "_")"> <input id="@inputId.Replace(" ", "_")" class="form-check-input js-select-filter-option" type="checkbox" value='@k.GetString("FacetOption.Value")' name='@j.GetString("Facet.QueryParameter")' checked='@k.GetBoolean("FacetOption.Selected")'> </label> </div> </div> } </div> } } } </form> } @using System.ServiceModel.Security @using System.Web @using Dynamicweb @using Dynamicweb.Environment; @using Dynamicweb.Core; @using Dynamicweb.Ecommerce; @using System.Text.RegularExpressions; @using SGMLight.Website.CustomModules.Files; @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @helper RenderProductClean(LoopItem i, string gutter, string colSize, bool useGroupLink = true, string pageId = null) { object productLink = i.GetValue("Ecom:Product.Link.Clean"); string productName = i.GetString("Ecom:Product.Name"); string productNameForAttribute = Dynamicweb.Core.Encoders.HtmlEncoder.HtmlEncode(productName); string productImageClean = i.GetString("Ecom:Product:Field.SpPerfionMarketingProductPageImage1"); string productImage = string.IsNullOrEmpty(productImageClean) ? i.GetString("Ecom:Product.ImageLarge.Default.Clean") : "/admin/public/GetImage.ashx?Image=" + Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(productImageClean) + "&amp;Compression=75&amp;crop=6&amp;width=400&amp;height=400"; Image image = new Image(productImage); string featured = i.GetString("Ecom:Product:Field.featured"); string featuredClass = string.IsNullOrEmpty(featured) ? "" : "featured"; <div class="productlist-item @gutter @colSize js-productlist-item"> <form method="post" class="js-ecom-product-form @featuredClass @i.GetString("Ecom:Product:Field.featured")" autocomplete="off" data-disabled="false" data-check-stock='@Converter.ToString(Pageview.Area.Item["CheckStock"])'> <input type="hidden" name="CartCmd" value="add"> <input type="hidden" name="ProductID" value="@i.GetValue("Ecom:Product.ID")"> @if(!String.IsNullOrEmpty(i.GetString("Ecom:Product:Field.featured"))) { <span class="featured-text">Featured</span> } <a href="@productLink" class="productlist-content js-product-link"> <div class="e-productlist-item-image-container"> <div class="e-productlist-item-image-wrapper"> <img class="e-productlist-item-image hover-zoom" alt='@(image.GetMetaData("ImageAlt") ?? Translate("Novicell:DefaultImageAltText", "SGM LIGHT"))' src="@productImage" title="@productNameForAttribute"> </div> </div> <span class="co3-productlist-name" title="@productNameForAttribute"> @productNameForAttribute </span> <span class="d-block"><small>@i.GetString("Ecom:Product:Field.SpPerfionStrMarketingDataProductFolderProductPageSubheader")</small></span> @RenderProductRibbon(i) </a> @RenderProductListAddToCart(i) </form> </div> } @helper RenderProduct(LoopItem i, string gutter, string colSize, bool useGroupLink = true, string pageId = null) { var id = i.GetValue("Ecom:Product.ID"); var productLink = i.GetValue("Ecom:Product.Link.Clean"); string productName = i.GetString("Ecom:Product.Name"); string ItemNumber = i.GetString("Ecom:Product:Field.SpPerfionItemNumber"); //string productImageClean = i.GetString("Ecom:Product.Image.1.Clean"); var productImageClean = i.GetString("Ecom:Product:Field.SpPerfionMarketingProductPageImage1"); string productImage = string.IsNullOrEmpty(productImageClean) ? i.GetString("Ecom:Product.ImageLarge.Default.Clean") : "/admin/public/GetImage.ashx?Image=" + Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(productImageClean) + "&amp;Compression=75&amp;crop=6&amp;width=400&amp;height=400"; var image = new Image(productImageClean); //var altText = metaData == null ? Translate("Novicell:DefaultImageAltText", "SGM LIGHT") : metaData.GetValue("ImageAlt") ?? Translate("Novicell:DefaultImageAltText", "SGM LIGHT"); bool service = i.GetInteger("Ecom:Product.Type") == 1; string productNameForAttribute = Dynamicweb.Core.Encoders.HtmlEncoder.HtmlEncode(productName); @*var iam = Dynamicweb.Content.Files.Metadata.EditorFactory.GetMetadataForFile("C:/DW9Projects/SGMLight.Website/SGMLight.Website/Files/images/perfion/P-1_front.png"); @iam.GetValue("ImageAlt")<hr />*@ @*var product = Dynamicweb.Ecommerce.Products.Product.GetProductById(i.GetString("Ecom:Product.ID")); @product.Meta.ToString()*@ <div class='productlist-item @gutter @colSize js-productlist-item'> <form method="post" class="js-ecom-product-form" autocomplete="off" data-disabled="false" data-check-stock='@Converter.ToString(Pageview.Area.Item["CheckStock"])'> <input type="hidden" name="CartCmd" value="add"> <input type="hidden" name="ProductID" value="@i.GetValue("Ecom:Product.ID")"> <div class="productlist-content"> <a href="@productLink" class="productlist-image-link js-product-link d-block"> <img class="img-fluid hover-zoom" alt='@(image.GetMetaData("ImageAlt") ?? Translate("Novicell:DefaultImageAltText", "SGM LIGHT"))' src="@productImage" title="@productNameForAttribute"> </a> <a href="@productLink" class="name" title="@productNameForAttribute"> @productNameForAttribute </a> <span class="d-block">@i.GetString("Ecom:Product:Field.SpPerfionStrMarketingDataProductFolderProductPageSubheader")</span> @*@RenderProductPrice(false, i)*@ @RenderProductRibbon(i) </div> @RenderProductListAddToCart(i) </form> </div> } @helper RenderProductListAddToCart(LoopItem i, bool isAddMulti = false) { var enableCart = Converter.ToBoolean(Pageview.Area.Item["EnableCart"]); if (enableCart) { var enableVariant = false; var quantityColClass = isAddMulti ? "col-xs-24" : "col-xs-10"; <div class="row no-gutters js-input-spinner add-to-cart"> @if (enableVariant && i.GetInteger("Ecom:Product.VariantCount") > 0) { @*<a href="@productLink" class="btn btn-primary btn-block js-ecom-product-button">@Translate("Smartpage:Ecom.ProductList.Button.ChooseVariant", "Vælg variant")</a>*@ } else { @*<div class="@quantityColClass"> @RenderChevrons(i, isAddMulti) </div>*@ if (!isAddMulti) { <div class="col-xs-24"> @*<button class="btn btn-primary btn-block js-ecom-product-button"> <i class="js-ecom-product-button-spinner"></i> <span class="js-ecom-product-button-text">@Translate("Smartpage:Ecom.ProductList.Button.AddToBasket", "Læg i kurv")</span> </button>*@ <button class="btn btn-block btn-small js-ecom-product-button"> <i class="js-ecom-product-button-spinner"></i> <span class="js-ecom-product-button-text">@Translate("Smartpage:Ecom.ProductList.Button.AddToQuote", "Add to quote list")</span> </button> </div> } } </div> } } @helper RenderProductAddToCart() { @*@if (i.GetInteger("Ecom:Product.VariantCount") > 0) { <a href="@productLink" class="btn btn-primary btn-block js-ecom-product-button">@Translate("Smartpage:Ecom.ProductList.Button.ChooseVariant", "Vælg variant")</a> } else {*@ <div class="row"> <div class="col-xs-7"> @RenderChevrons(null, false) </div> <div class="col-xs-17"> <button class="btn btn-primary js-ecom-product-button addtocart"> <i class="js-ecom-product-button-spinner"></i> <span class="js-ecom-product-button-text">@Translate("Smartpage:Ecom.ProductList.Button.AddToBasket", "Læg i kurv")</span> </button> </div> </div> @* } *@ } @helper RenderChevrons(LoopItem i, bool isAddMulti, bool isreciept = false) { bool service = getIntegerByKey(i, "Ecom:Product.Type") == 1; string id = getStringByKey(i, "Ecom:Product.ID"); string productName = getStringByKey(i, "Ecom:Product.Name"); string productNameForAttribute = Dynamicweb.Core.Encoders.HtmlEncoder.HtmlEncode(productName); string quantity = isAddMulti ? "0" : (getStringByKey(i, "Ecom:Order:OrderLine.Quantity") != "") ? getStringByKey(i, "Ecom:Order:OrderLine.Quantity") : "1"; int loopCounter = getIntegerByKey(i, "Ecom:Product.LoopCounter"); string name = isAddMulti ? "Quantity" + loopCounter : (getStringByKey(i, "Ecom:Order:OrderLine.Quantity.Input.Name") != "") ? getStringByKey(i, "Ecom:Order:OrderLine.Quantity.Input.Name") : "Quantity"; if (!isreciept) { <div class="input-group qty-container"> @*<input type="number" min="@quantity" name="@name" tabindex="@loopCounter" class="form-control stack-input js-ecom-product-quantity" value="@quantity" data-productid='@id' data-service='@service' data-productname="@productNameForAttribute" />*@ <input type="tel" min="1" name="@name" tabindex='@loopCounter' class="form-control text-xs-center js-ecom-product-quantity" value="@quantity" /> <div class="input-group-btn qty-group"> <span class="btn-chevron btn-chevron-up js-input-spinner-up"> <i class="fa fa-angle-up" aria-hidden="true"></i> </span> <span class="btn-chevron btn-chevron-down js-input-spinner-down"> <i class="fa fa-angle-down"></i> </span> </div> </div> } else { @quantity } } @helper RenderProductList(LoopItem i, string gutter, string colSize, bool favoriteList = false, string pageId = null, bool priceDeals = false) { <form method="post" class="js-ecom-product-form @colSize" autocomplete="off" data-disabled="false" data-check-stock='@Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["CheckStock"])'> <input type="hidden" name="CartCmd" value="add"> <input type="hidden" name="ProductID" value="@i.GetValue("Ecom:Product.ID")"> @RenderProductListContent(i, gutter, colSize, favoriteList, false, true, pageId) </form> } @helper RenderProductListContent(LoopItem i, string gutter, string colSize, bool favoriteList = false, bool isAddMulti = false, bool useGroupLink = true, string pageId = null, bool priceDeals = false) { var id = i.GetValue("Ecom:Product.ID"); var productLink = useGroupLink ? i.GetValue("Ecom:Product.LinkGroup.Clean") : i.GetValue("Ecom:Product.Link.Clean"); if (!string.IsNullOrEmpty(pageId)) { productLink = "/Default.aspx?Id=" + pageId; if (useGroupLink) { productLink += "&groupid=" + i.GetString("Ecom:Product.PrimaryOrFirstGroupID"); } productLink += "&ProductId=" + id; } string productName = i.GetString("Ecom:Product.Name"); string productImageClean = i.GetString("Ecom:Product.Image.1.Clean"); string productImage = string.IsNullOrEmpty(productImageClean) ? i.GetString("Ecom:Product.ImageLarge.Default.Clean") : "/admin/public/GetImage.ashx?Image=" + Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(productImageClean) + "&amp;Compression=75&amp;width=400&amp;height=400"; bool service = i.GetInteger("Ecom:Product.Type") == 1; string productNameForAttribute = Dynamicweb.Core.Encoders.HtmlEncoder.HtmlEncode(productName); string shortDescription = i.GetString("Ecom:Product.ShortDescription"); int loopCounter = GetInteger("Ecom:Product.LoopCounter"); string addMultiClass = isAddMulti ? "add-multi" : ""; colSize = isAddMulti ? colSize : ""; <div class="py-2 my-1 productlist-content productlist-item @gutter @colSize @addMultiClass"> @if (isAddMulti) { <text>@i.GetString("Ecom:Product.Form.Multi.HiddenFields")</text> } <div class=""> <div class="row row-eq-height"> <div class="col-xs-24 col-lg-5 text-xs-center"> <a href="@productLink" title="@productNameForAttribute" class="productlist-image-link "> <img class="img-fluid product-img" alt="@productNameForAttribute" src="@productImage" title="@productNameForAttribute"> @RenderProductRibbon(i) </a> @RenderProductRibbon(i) </div> <div class="col-xs-24 col-lg-11 text-lg-left list_text"> <a href="@productLink" class="name" title="@productNameForAttribute"> @productNameForAttribute </a> <div class="short_desc"> @shortDescription </div> @if (string.IsNullOrEmpty(i.GetString("Ecom.Product.Number"))) { <div class="row"> <div class="col-xs-14 col-xl-11"> <strong>@Translate("Smartpage:Ecom.ProductList.SKU.Label", "Varenr"):</strong> </div> <div class="col-xs-10 col-xl-13 text-xs-right text-md-left"> @i.GetString("Ecom:Product.Number") </div> </div> } @if (priceDeals) { <div class="row"> <div class="col-xs-14 col-xl-11"> <strong>@Translate("Smartpage:Ecom.ProductList.BruttoPrice", "Bruttopris"):</strong> </div> <div class="col-xs-10 col-xl-13 text-xs-right text-md-left"> @i.GetString("Ecom:Product:Field.AXBruttoPrice") </div> </div> } <div class="row"> <div class="col-xs-14 col-xl-11"> <strong>@Translate("Smartpage:Ecom.ProductList.Stock.Label", "Lagerbeholdning"):</strong> </div> <div class="col-xs-10 col-xl-13 text-xs-right text-md-left"> @RenderProductStock(false, i) </div> </div> </div> <div class="col-xs-24 col-lg-8 vbottom"> @if (favoriteList) { <div class="row no-gutters pull-right"> <a class="remove-from-fav js-remove-from-fav" href="@i.GetValue("Ecom:Product.RemoveFromList")"><strong>@Translate("Smartpage:MyList.ProductList.DeleteFromList", "Fjern fra liste")</strong></a> </div> } <div class="row no-gutters"> <div class="col-xs-24"> <div class="float-xs-left float-lg-right"> @RenderProductPrice(false, i) </div> </div> </div> <div class="row no-gutters js-input-spinner add-to-cart"> <div class="col-xs-24"> @*@if (i.GetInteger("Ecom:Product.VariantCount") > 0) { <a href="@productLink" class="btn btn-primary btn-block js-ecom-product-button">@Translate("Smartpage:Ecom.ProductList.Button.ChooseVariant", "Vælg variant")</a> } else {*@ @RenderProductListAddToCart(i, isAddMulti) @* } *@ </div> </div> </div> </div> </div> </div> } @helper RenderGroup(LoopItem g, string colSize) { string imagePath = g.GetString("Ecom:Group.LargeImage"); var groupImg = "/Admin/Public/GetImage.ashx?Image=" + imagePath + "&Width=400&Height=400&Crop=5;"; var tempImg = groupImg.Replace("//", "/"); string groupName = g.GetString("Ecom:Group.Name"); string groupLink = g.GetString("Ecom:Group.Link.Clean"); <div class="@colSize"> <div class="grouplist"> <a href="@groupLink"> <img src="@tempImg" alt="@groupName" class="img-fluid grouplist-img hidden-md-down"> </a> <div class="grouplist-name"> <a href="@groupLink"> @groupName </a> </div> </div> </div> } @helper RenderPageTotals() { <div> @{ var pageSize = Dynamicweb.Core.Converter.ToInt32(@GetValue("Ecom:ProductList.PageSize")); var pageCount = Dynamicweb.Core.Converter.ToInt32(@GetValue("Ecom:ProductList.PageProdCnt")); } @if (pageSize > pageCount) { <span>@pageCount @Translate("SmartPage:ProductList.Total.Of", "af") @pageCount @Translate("SmartPage:ProductList.Total.ProductsInTotal", "produkter")</span> } else { <span>@pageSize @Translate("SmartPage:ProductList.Total.Of", "af") @pageCount @Translate("SmartPage:ProductList.Total.ProductsInTotal", "produkter")</span> } </div> } @functions { string getStringByKey(LoopItem i, string key) { return (i == null ? GetString(key) : i.GetString(key)); } int getIntegerByKey(LoopItem i, string key) { return (i == null ? GetInteger(key) : i.GetInteger(key)); } double getDoubleByKey(LoopItem i, string key) { return (i == null ? GetDouble(key) : i.GetDouble(key)); } bool getBooleanByKey(LoopItem i, string key) { return (i == null ? GetBoolean(key) : i.GetBoolean(key)); } } @helper RenderProductPrice(bool showItemProp, LoopItem product = null) { var enableProductPrices = Converter.ToBoolean(Pageview.Area.Item["EnableProductPrices"]); if (enableProductPrices) { var productPrice = getStringByKey(product, "Ecom:Product.Price.PriceFormatted"); var productHasDiscount = getBooleanByKey(product, "Ecom:Product.HaveDiscount"); var productPriceDiscount = getStringByKey(product, "Ecom:Product.Discount.Price.PriceFormatted"); var productPriceItemProp = getDoubleByKey(product, "Ecom:Product.Discount.Price.PricePIP") / 100; var productCurrencyCode = getStringByKey(product, "Ecom:Product.Currency.Code"); string productStockItemPropSchema = (getDoubleByKey(product, "Ecom:Product.Stock") > 0 || getIntegerByKey(product, "Ecom:Product.Type") == 1) ? "http://schema.org/InStock" : "http://schema.org/OutOfStock"; if (showItemProp) { <div class="prices" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> <span class="price">@productPriceDiscount</span> @if (productHasDiscount) { <span class="price-old">@productPrice</span> } <span itemprop="price" class="display-none">@productPriceItemProp.ToString().Replace(",", ".")</span> <span itemprop="priceCurrency" class="display-none">@productCurrencyCode</span> <link itemprop="availability" href="@productStockItemPropSchema" /> </div> } else { <div class="prices"> <span class="price">@productPriceDiscount</span> @if (productHasDiscount) { <span class="price-old">@productPrice</span> } </div> } } } @helper RenderProductRibbon(LoopItem product = null) { var enableProductPrices = Converter.ToBoolean(Pageview.Area.Item["EnableProductPrices"]); if (enableProductPrices) { var productHasDiscount = getBooleanByKey(product, "Ecom:Product.HaveDiscount"); if (productHasDiscount) { <ul class="ribbons"> @if (productHasDiscount) { var productPriceDiscountTotalProcentage = getDoubleByKey(product, "Ecom:Product.Discount.TotalPercentWithVATFormatted"); <li><span class="ribbon ribbon-price-savings">@Translate("Smartpage:Ecom.Product.Price.Discount.Save", "Spar") @productPriceDiscountTotalProcentage%</span></li> } </ul> } } } @helper RenderProductSort() { string sortPriceUrl = Dynamicweb.Environment.Helpers.LinkHelper.ReplaceQueryString("sortby", "price"); string sortNameUrl = Dynamicweb.Environment.Helpers.LinkHelper.ReplaceQueryString("sortby", "productname"); string sortCreated = Dynamicweb.Environment.Helpers.LinkHelper.ReplaceQueryString("sortby", "created"); string priceQueryAsc = Dynamicweb.Environment.Helpers.LinkHelper.ReplaceQueryString(sortPriceUrl, "sortorder", "asc"); string priceQueryDesc = Dynamicweb.Environment.Helpers.LinkHelper.ReplaceQueryString(sortPriceUrl, "sortorder", "desc"); string nameQueryAsc = Dynamicweb.Environment.Helpers.LinkHelper.ReplaceQueryString(sortNameUrl, "sortorder", "asc"); string nameQueryDesc = Dynamicweb.Environment.Helpers.LinkHelper.ReplaceQueryString(sortNameUrl, "sortorder", "desc"); string createdQueryDesc = Dynamicweb.Environment.Helpers.LinkHelper.ReplaceQueryString(sortCreated, "sortorder", "desc"); string sortByValue = Dynamicweb.Context.Current.Request.GetString("sortby"); string sortOrderValue = Dynamicweb.Context.Current.Request.GetString("sortorder"); bool priceQueryAscSelected = Dynamicweb.Core.Converter.ToString(sortByValue).ToLower() == "price" && Dynamicweb.Core.Converter.ToString(sortOrderValue).ToLower() == "asc"; bool priceQueryDescSelected = Dynamicweb.Core.Converter.ToString(sortByValue).ToLower() == "price" && Dynamicweb.Core.Converter.ToString(sortOrderValue).ToLower() == "desc"; bool nameQueryAscSelected = Dynamicweb.Core.Converter.ToString(sortByValue).ToLower() == "productname" && Dynamicweb.Core.Converter.ToString(sortOrderValue).ToLower() == "asc"; bool nameQueryDescSelected = Dynamicweb.Core.Converter.ToString(sortByValue).ToLower() == "productname" && Dynamicweb.Core.Converter.ToString(sortOrderValue).ToLower() == "desc"; bool createdQueryDescSelected = Dynamicweb.Core.Converter.ToString(sortByValue).ToLower() == "created" && Dynamicweb.Core.Converter.ToString(sortOrderValue).ToLower() == "desc"; <div class="list-sort-wrapper"> <i class="fa fa-spinner fa-spin"></i> <select class="form-control js-sort-list"> <option value="">@Translate("SmartPage:Product.Sort.ChooseSort", "Sorter efter")</option> <option value="@priceQueryAsc" data-href="@priceQueryAsc" selected="@priceQueryAscSelected">@Translate("SmartPage:Product.Sort.PristAsc", "Pris stigende")</option> <option value="@priceQueryDesc" data-href="@priceQueryDesc" selected="@priceQueryDescSelected">@Translate("SmartPage:Product.Sort.PristDesc", "Pris faldende")</option> <option value="@nameQueryAsc" data-href="@nameQueryAsc" selected="@nameQueryAscSelected">@Translate("SmartPage:Product.Sort.NameA-z", "Navn (A-Z)")</option> <option value="@nameQueryDesc" data-href="@nameQueryDesc" selected="@nameQueryDescSelected">@Translate("SmartPage:Product.Sort.NameZ-A", "Navn (Z-A)")</option> <option value="@createdQueryDesc" data-href="@createdQueryDesc" selected="@createdQueryDescSelected">@Translate("SmartPage:Product.Sort.Newest", "Nyeste")</option> </select> </div> } @helper RenderProductStock(bool useDescriptionList, LoopItem i = null) { string stockState = Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["StockState"]); if (string.IsNullOrWhiteSpace(stockState) || stockState == "none") { return; //If stockstate is set to "none" og not set - don't show stock } double stock = getDoubleByKey(i, "Ecom:Product.Stock"); string image = getStringByKey(i, "Ecom:Product:Stock.Image.Clean"); string text = getStringByKey(i, "Ecom:Product:Stock.Text"); string imageUrl = "/admin/public/GetImage.ashx?Image=" + Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(image) + "&amp;Compression=75&amp;width=12&amp;height=12"; if (useDescriptionList) { <dt class="col-sm-8">@Translate("Smartpage:eCom.Product.StockStatus.Label.DescriptionList", "Lager")</dt> if (stockState == "quantity") { <dd class="col-sm-16">@stock</dd> } else if (stockState == "range") { <dd class="col-sm-16"> @if (!string.IsNullOrWhiteSpace(image)) { <img src="@imageUrl" alt="@text" /> } <span>&nbsp;@text</span> </dd> } } else { if (stockState == "quantity") { <span><strong>@Translate("Smartpage:eCom.Product.StockStatus.Label", "Lager:") </strong>@stock</span> } else if (stockState == "range") { if (!string.IsNullOrEmpty(text)) { if (!string.IsNullOrWhiteSpace(image)) { <img src="@imageUrl" alt="@text" /><span>&nbsp;@text</span> } else { <span><strong>@Translate("Smartpage:eCom.Product.StockStatus.Label", "Lager:") </strong>@text</span> } } else { <span>@Translate("Smartpage:eCom.Product.StockStatus.Unknown", "Ukendt")</span> } } } } @helper RenderProductStockCheckModal(string Mode) { if (!string.IsNullOrWhiteSpace(Mode) && Mode != "ignore") { <div class="modal fade js-stock-check-modal-@Mode" id="stock-check-modal-@Mode" tabindex="-1" role="dialog" aria-labelledby="stock-check-label-@Mode" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content js-stock-check-@Mode"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> <h4 class="modal-title" id="stock-check-label-@Mode"> @if (Mode == "break") { @Translate("Smartpage:Ecom.Modal.StockCheck.Title.Stop", "Der er ikke nok på lager, prøv med et mindre antal.") } else if (Mode == "retry") { @Translate("Smartpage:Ecom.Modal.StockCheck.Title.Retry", "Der er ikke nok på lager, antallet er blevet justeret automatisk.") } </h4> </div> <div class="modal-body js-stock-check-body"> @if (Mode == "break") { <div> @Translate("Smartpage:Ecom.Modal.StockCheck.ProductsAffected.Stop", "Følgende produkter var ikke tilgængelige:") </div> <div class="js-stock-check-productname"></div> } else if (Mode == "retry") { <div> @Translate("Smartpage:Ecom.Modal.StockCheck.ProductsAffected.Retry", "Der er lagt følgende antal i kurven:") </div> <dl class="js-stock-check-productline"> <dt class="js-stock-check-productname"></dt> <dd class="js-stock-check-productname"></dd> </dl> } </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">@Translate("Smartpage:UserManagement.LoginModal.Button.Close", "Luk")</button> </div> </div> </div> </div> } } @helper RenderProductCarousel(LoopItem i, bool useGroupLink = true, string pageId = null) { var id = i.GetValue("Ecom:Product.ID"); //var productLink = useGroupLink ? i.GetValue("Ecom:Product.LinkGroup.Clean") : i.GetValue("Ecom:Product.Link.Clean"); var projectsGroup = ""; if (i.GetString("Ecom:Product:Field.SpProductDivisionGroup") == "Architectural") { projectsGroup = "2426"; } else if (i.GetString("Ecom:Product:Field.SpProductDivisionGroup") == "Entertainment") { projectsGroup = "2410"; } var groupId = !string.IsNullOrEmpty(GetString("Ecom:Product.PrimaryOrCurrentPageID")) ? GetString("Ecom:Product.PrimaryOrCurrentPageID") : projectsGroup; var productLink = "Default.aspx?ID=" + groupId + "&ProductID=" + i.GetString("Ecom:Product.ID"); if (!string.IsNullOrEmpty(pageId)) { productLink = "/Default.aspx?Id=" + pageId; if (useGroupLink) { productLink += "&groupid=" + i.GetString("Ecom:Product.PrimaryOrFirstGroupID"); } productLink += "&ProductId=" + id; } string productName = i.GetString("Ecom:Product.Name"); string productImageClean = i.GetString("Ecom:Product:Field.SpPerfionMarketingProductPageImage1"); string productImage = string.IsNullOrEmpty(productImageClean) ? i.GetString("Ecom:Product.ImageLarge.Default.Clean") : "/admin/public/GetImage.ashx?Image=" + Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(productImageClean) + "&amp;Compression=75&amp;crop=6&amp;width=400&amp;height=400"; var image = new Image(productImageClean); bool service = i.GetInteger("Ecom:Product.Type") == 1; string productNameForAttribute = Dynamicweb.Core.Encoders.HtmlEncoder.HtmlEncode(productName); <div class="product-item"> <form method="post" class="js-ecom-product-form" autocomplete="off" data-disabled="false" data-check-stock='@Converter.ToString(Pageview.Area.Item["CheckStock"])'> <input type="hidden" name="CartCmd" value="add"> <input type="hidden" name="ProductID" value='@i.GetString("Ecom:Product.ID")'> <div class="productlist-content"> @if (image.Exists) { <a href="@productLink" title="@productNameForAttribute" class="productlist-image-link"> <img class="img-fluid" alt='@(image.GetMetaData("ImageAlt") ?? productNameForAttribute ?? Translate("Novicell:DefaultImageAltText", "SGM Light"))' src="@productImage" title="@productNameForAttribute"> </a> } <a href="@productLink" class="name" title="@productNameForAttribute"> <h5>@productNameForAttribute</h5> </a> <span>@i.GetString("Ecom:Product:Field.SpPerfionStrMarketingDataProductFolderProductPageSubheader")</span> </div> @RenderProductCarouselAddToCart(i) </form> </div> } @helper RenderProductRelatedProductsList(LoopItem i, bool useGroupLink = true, string pageId = null) { var id = i.GetValue("Ecom:Product.ID"); var projectsGroup = ""; if (i.GetString("Ecom:Product:Field.SpProductDivisionGroup") == "Architectural") { projectsGroup = "2426"; } else if (i.GetString("Ecom:Product:Field.SpProductDivisionGroup") == "Entertainment") { projectsGroup = "2410"; } var groupId = !string.IsNullOrEmpty(GetString("Ecom:Product.PrimaryOrCurrentPageID")) ? GetString("Ecom:Product.PrimaryOrCurrentPageID") : projectsGroup; var productLink = "Default.aspx?ID=" + groupId + "&ProductID=" + i.GetString("Ecom:Product.ID"); if (!string.IsNullOrEmpty(pageId)) { productLink = "/Default.aspx?Id=" + pageId; if (useGroupLink) { productLink += "&groupid=" + i.GetString("Ecom:Product.PrimaryOrFirstGroupID"); } productLink += "&ProductId=" + id; } string productName = i.GetString("Ecom:Product.Name"); string productImageClean = i.GetString("Ecom:Product:Field.SpPerfionMarketingProductPageImage1"); string productImage = string.IsNullOrEmpty(productImageClean) ? i.GetString("Ecom:Product.ImageLarge.Default.Clean") : "/admin/public/GetImage.ashx?Image=" + Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(productImageClean) + "&amp;Compression=75&amp;crop=6&amp;width=400&amp;height=400"; var image = new Image(productImageClean); string productNameForAttribute = Dynamicweb.Core.Encoders.HtmlEncoder.HtmlEncode(productName); <div class="col-xs-12 col-lg-6 text-xs-center co3-sgm-related-product product-item"> <form method="post" class="js-ecom-product-form" autocomplete="off" data-disabled="false" data-check-stock='@Converter.ToString(Pageview.Area.Item["CheckStock"])'> <input type="hidden" name="CartCmd" value="add"> <input type="hidden" name="ProductID" value='@i.GetString("Ecom:Product.ID")'> <a href="@productLink" class="productlist-content js-product-link"> <div class="e-productlist-item-image-container"> <div class="e-productlist-item-image-wrapper"> <img class="e-productlist-item-image hover-zoom" alt='@(image.GetMetaData("ImageAlt") ?? Translate("Novicell:DefaultImageAltText", "SGM LIGHT"))' src="@productImage" title="@productNameForAttribute"> </div> </div> <span class="co3-productlist-name" title="@productNameForAttribute"> @productNameForAttribute </span> <span class="d-block"><small>@i.GetString("Ecom:Product:Field.SpPerfionStrMarketingDataProductFolderProductPageSubheader")</small></span> @RenderProductRibbon(i) </a> @RenderProductRelatedProductsListAddToCart(i) </form> </div> } @helper RenderProductCarouselAddToCart(LoopItem i) { var enableCart = Converter.ToBoolean(Pageview.Area.Item["EnableCart"]); if (enableCart) { @*<button class="btn btn-border js-ecom-product-button"> <i class="js-ecom-product-button-spinner"></i> <span class="js-ecom-product-button-text">@Translate("Smartpage:Ecom.ProductList.Button.AddToList", "Add to List")</span> </button>*@ <div class="row no-gutters js-input-spinner add-to-cart"> <div class="col-xs-24"> <button class="btn btn-border btn-small js-ecom-product-button"> <i class="js-ecom-product-button-spinner"></i> <span class="js-ecom-product-button-text">@Translate("Smartpage:Ecom.ProductList.Button.AddToList", "Add to List")</span> </button> </div> </div> } } @helper RenderProductRelatedProductsListAddToCart(LoopItem i) { var enableCart = Converter.ToBoolean(Pageview.Area.Item["EnableCart"]); if (enableCart) { <div class="js-input-spinner add-to-cart"> <button class="btn btn-block btn-small js-ecom-product-button"> <i class="js-ecom-product-button-spinner"></i> <span class="js-ecom-product-button-text">@Translate("Smartpage:Ecom.ProductList.Button.AddToQuote", "Add to quote list")</span> </button> </div> } } @helper RenderCollapseButton(string tag, string containerId) { <div class="collapse-button" data-toggle="collapse" data-target="#@containerId" aria-expanded="false" role="button" aria-controls="@containerId"> <p> <svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.84 30.84"> <path d="M15.42,30.84A15.42,15.42,0,1,1,30.84,15.42,15.44,15.44,0,0,1,15.42,30.84Zm0-29.34A13.92,13.92,0,1,0,29.34,15.42,13.93,13.93,0,0,0,15.42,1.5Z" transform="translate(0 0)" /> <path d="M14.85,22.3h1.32V16.13h6.65V14.71H16.17V8.5H14.85v6.21H8v1.42h6.84Z" transform="translate(0 0)" /> </svg> @tag </p> </div> } @helper RenderCollapseButtonTextUpdate(string textshow, string texthide, string containerId) { <div class="js-btn-collapse collapse-button" data-toggle="collapse" data-target="#@containerId" aria-expanded="false" role="button" aria-controls="@containerId" data-textshow="@textshow" data-texthide="@texthide"> <p> <svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.84 30.84"> <path d="M15.42,30.84A15.42,15.42,0,1,1,30.84,15.42,15.44,15.44,0,0,1,15.42,30.84Zm0-29.34A13.92,13.92,0,1,0,29.34,15.42,13.93,13.93,0,0,0,15.42,1.5Z" transform="translate(0 0)" /> <path d="M14.85,22.3h1.32V16.13h6.65V14.71H16.17V8.5H14.85v6.21H8v1.42h6.84Z" transform="translate(0 0)" /> </svg> <span class="js-btn-collapse-text-@containerId">@textshow</span> </p> </div> @SnippetStart("JavaScript") <script> $('.js-btn-collapse[data-target="#@containerId"]') .click(function () { $(this).toggleClass("active"); var testshow = $('.js-btn-collapse[data-target="#@containerId"]').data('textshow'); var texthide = $('.js-btn-collapse[data-target="#@containerId"]').data('texthide'); if ($(this).hasClass("active")) { $(this).find('.js-btn-collapse-text-'+'@containerId').text(texthide); } else { $(this).find('.js-btn-collapse-text-'+'@containerId').text(testshow); } }); </script> @SnippetEnd("JavaScript") } @helper RenderSimpleStringCollapse(string tag, string containerId, bool img = false) { <div class="background gray collapse m-0 p-0" id="@containerId"> <div class="container text-xs-center pt-3 pb-3"> @if (img) { <img src="@("/files")@tag" class="img-fluid" alt="SGM Light" /> } else { @tag } </div> </div> } @helper RenderProductHr() { <div class="container text-xs-center"> <div class="row narrow"> <hr /> </div> </div> } @helper RenderProjectCarousel(LoopItem i, bool useGroupLink = true, string pageId = null) { string img = i.GetString("Smartpage:RelatedProjects.MarketingProjectPrimaryPhoto"); string image = !string.IsNullOrEmpty(img) ? "/admin/public/GetImage.ashx?Image=/files" + img + "&amp;Compression=75&amp;crop=6&amp;width=300&amp;height=200" : "/admin/public/GetImage.ashx?Image=/files/images/light-press2.jpg&amp;Compression=75&amp;crop=6&amp;width=300&amp;height=200"; string text = i.GetString("Smartpage:RelatedProjects.MarketingProjectTextPrimaryPhotoHeadline"); string textStripped = Regex.Replace(text, "<.*?>", string.Empty); if (pageId == null) { pageId = i.GetString("Smartpage:RelatedProjects.PageId"); } var link = "Default.aspx?ID=" + pageId; string[] tags = i.GetString("ItemPublisher:Item.Tags").Split(','); <div class="project-item-carousel"> <div class="img-container"> <a class="d-block" href="@link"> <img src="@image" class="img-block img-fluid" alt="SGM LIGHT" /> </a> </div> <div class="text-container"> @if (!string.IsNullOrEmpty(GetString("ItemPublisher:Item.Tags"))) { <ul class="tags"> @foreach (var tag in tags) { <li class="tag">@tag</li> } </ul> } @textStripped <a class="d-block" href="@link">@Translate("Smartpage:Press.Readmore", "Read more")</a> </div> </div> } @using System; @using System.Web; @using Dynamicweb; @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @helper RenderBreadcrumbsProductPage(string currentGroup, string linkPageId, string productId) { List<Dynamicweb.Ecommerce.Products.Group> breadcumbGroups = SGMLight.Website.CustomCode.EcomGroups.getBreadCrumbGroupListByProduct(productId, true); if (Dynamicweb.Core.Converter.ToBoolean(Pageview.Area.Item["ShowBreadcrumbsOnWebsite"]) && (Pageview.Page.PropertyItem == null || !Dynamicweb.Core.Converter.ToBoolean(Pageview.Page.PropertyItem["DisableBreadcrumbsOnPage"])) && breadcumbGroups != null && breadcumbGroups.Count > 0) { string hiddenMobileClass = Dynamicweb.Core.Converter.ToBoolean(Pageview.Area.Item["ShowBreadcrumbsOnMobile"]) ? "" : "hidden-xs-down"; string prefix = Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["BreadcrumbsPrefix"]); <div class="container breadcrumbs @hiddenMobileClass"> @if (!string.IsNullOrWhiteSpace(prefix)) { <span class="pull-left">@prefix&nbsp;&nbsp;</span> } <ul class="breadcrumb-ul"> @foreach (Dynamicweb.Ecommerce.Products.Group group in breadcumbGroups) { string groupLinkLoop = string.Format("/Default.aspx?ID={0}&GroupID={1}", int.Parse(linkPageId), group.Id); <li> <a href="@groupLinkLoop ">@group.Name</a> <span> / </span> </li> } <li><span class="divider">@GetString("Ecom:Product.Name")</span></li> </ul> </div> } } @helper RenderBreadcrumbsProductGroupPage(Dynamicweb.Ecommerce.Products.Group breadcumbGroup, string linkPageId) { List<Dynamicweb.Ecommerce.Products.Group> breadcumbGroups = SGMLight.Website.CustomCode.EcomGroups.getBreadCrumbGroupList(breadcumbGroup, true); if (Dynamicweb.Core.Converter.ToBoolean(Pageview.Area.Item["ShowBreadcrumbsOnWebsite"]) && (Pageview.Page.PropertyItem == null || !Dynamicweb.Core.Converter.ToBoolean(Pageview.Page.PropertyItem["DisableBreadcrumbsOnPage"])) && breadcumbGroups != null && breadcumbGroups.Count > 0) { string hiddenMobileClass = Dynamicweb.Core.Converter.ToBoolean(Pageview.Area.Item["ShowBreadcrumbsOnMobile"]) ? "" : "hidden-xs-down"; string prefix = Dynamicweb.Core.Converter.ToString(Pageview.Area.Item["BreadcrumbsPrefix"]); if (breadcumbGroups.Any(x => x.Id != breadcumbGroup.Id)) { <div class="container breadcrumbs @hiddenMobileClass"> @if (!string.IsNullOrWhiteSpace(prefix)) { <span class="pull-left">@prefix&nbsp;&nbsp;</span> } <ul class="breadcrumb-ul"> @foreach (Dynamicweb.Ecommerce.Products.Group group in breadcumbGroups.Where(x => x.Id != breadcumbGroup.Id)) { string groupLinkLoop = string.Format("/Default.aspx?ID={0}&GroupID={1}", int.Parse(linkPageId), group.Id); <li> <a href="@groupLinkLoop ">@group.Name</a> <span> / </span> </li> } <li><span class="divider">@breadcumbGroup.Name</span></li> </ul> </div> } else { <div class="container breadcrumbs @hiddenMobileClass"> @if (!string.IsNullOrWhiteSpace(prefix)) { <span class="pull-left">@prefix&nbsp;&nbsp;</span> } <ul class="breadcrumb-ul"> <li><span class="divider">@breadcumbGroup.Name</span></li> </ul> </div> } } } @{ /* TOP GROUP INFO */ string topGroupId = ""; foreach (LoopItem query in GetLoop("Query.Parameters")) { if (string.IsNullOrEmpty(query.GetString("Parameter.Value")) == false) { if (query.GetString("Parameter.Name") == "groupId") { string[] topGroupIds = query.GetString("Parameter.Value").Split(','); topGroupId = topGroupIds.FirstOrDefault(); } } } Dynamicweb.Ecommerce.Products.Group topGroup = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(topGroupId); string topGroupNameFieldValue = topGroup.Name; string topGroupName = !string.IsNullOrWhiteSpace(topGroupNameFieldValue) ? topGroupNameFieldValue : Pageview.Page.MenuText; string topGroupDescription = topGroup.Description; ProductGroupFieldValue topGroupStreamerImageFieldValue = topGroup.ProductGroupFieldValues.GetProductGroupFieldValue("TopStreamerImage"); string groupIconsPage = GetString("Ecom:Group:Field.iconspage.Value.Clean"); int groupIconsPageId = Int32.Parse(groupIconsPage.Substring(groupIconsPage.LastIndexOf('=') + 1)); string topGroupStreamerImage = ""; if (topGroupStreamerImageFieldValue != null && topGroupStreamerImageFieldValue.HasValue) { topGroupStreamerImage = topGroupStreamerImageFieldValue.Value.ToString(); } var subGroups = topGroup.Subgroups; // Display Mode string[] displayModeList = { "grid", "list" }; // options string displayMode = "grid"; // default string displayModeRequest = Converter.ToString(Context.Current.Request["mode"]); if (!string.IsNullOrEmpty(displayModeRequest)) { CookieManager.SetCookie("mode", displayModeRequest, DateTime.Now.AddMonths(1)); displayMode = displayModeRequest; } else { string displayModeCookie = Converter.ToString(CookieManager.GetCookie("mode")); if (!string.IsNullOrEmpty(displayModeCookie)) { displayMode = displayModeCookie; } else { CookieManager.SetCookie("mode", displayMode, DateTime.Now.AddMonths(1)); } } string primaryProductPageId = PageView.Current().Area.Item["PrimaryProductPage"].ToString(); } <script src="https://sgmlight.activehosted.com/f/embed.php?id=23" type="text/javascript" charset="utf-8"></script> @RenderBreadcrumbsProductGroupPage(topGroup, primaryProductPageId) <section class="co3-product-splash-container d-none d-lg-block p-0" style="background-image: url('@topGroupStreamerImage'); "></section> <div class="container co3-top-content-wrapper"> <div class="row pt-6 bg-white"> <div class="col-xs-24 col-lg-24"> <div class="row d-flex"> <div class="col-xs-24 col-lg-16 text-xs-center mx-auto"> <h1 class="font-weight-semibold mb-2">@topGroupName</h1> <div class="small mb-6"> @topGroupDescription </div> </div> </div> </div> @if (subGroups.Any()) { var areaId = Dynamicweb.Frontend.PageView.Current().AreaID; var pageService = new Dynamicweb.Content.PageService(); var productPage = pageService.GetPageByNavigationTag(areaId, "productcatalogue"); var productPageId = productPage.ID; <div class="col-xs-24"> <div class="row d-flex subgroup-list"> @foreach (var group in subGroups) { string groupLink = String.Format("Default.aspx?ID={0}&GroupID={1}", productPageId, group.Id); string groupImage = String.Format("/admin/public/GetImage.ashx?Image={0}&crop=5&width=400", group.SmallImage); <div class="col-xs-24 col-sm-12 col-md-8 col-lg-6"> <a class="subgroup-link mb-6" href="@groupLink"> <img src="@groupImage" alt="@group.Name" /> <h4 class="group-header">@group.Name (@group.ProductCount)</h4> </a> </div> } </div> </div> } else { <div class="product-list"> <div class="col-xs-24 col-sm-24 col-lg-6 js-sticky-sidebar"> <div class="product-filters js-productlist-filters-container" style="display: none;"> @RenderProductFilters() </div> </div> <div class="col-xs-24 hidden-lg-up"> <div class="product-filters js-filter-fw" style="display: none;"> @RenderProductFilters(true) </div> </div> <div class="col-xs-24 col-sm-24 col-lg-17 offset-lg-1 js-ecom-content"> <div class="js-ecom-content-row"> <div class="icons mb-1">@RenderPageContent(groupIconsPageId)</div> <div class="row mb-2 hidden-lg-up"> <div class="col-xs-24 col-sm-12"> <button class="btn btn-border btn-block js-toggle" id="mobile-filter-toggle" data-target=".js-productlist-filters-container"> @Translate("Smartpage:Ecom.ProductList.Filter.Filter", "Filter") </button> </div> </div> @{ var products = GetLoop("Products"); } <div class="row list-grid js-productlist-infinite"> @{ var navString = RenderNavigation(new { template = "FacetNavigation.xslt", expandmode = "all", startlevel = 2, endlevel = 4 }); List<string> validGroups = new List<string>(); if (!string.IsNullOrEmpty(navString)) { var arrGroups = navString.Split(";".ToCharArray()); foreach (var group in arrGroups) { if (!string.IsNullOrEmpty(group)) { validGroups.Add(group.Substring(group.LastIndexOf("=") + 1)); } } } } @foreach (LoopItem i in products) { @RenderProductClean(i, displayMode, "col-xs-24 col-sm-12 col-md-12 col-lg-8") } </div> <div class="d-block text-xs-center infinite-spinner-container"> <svg width="106px" height="106px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="lds-reload js-infinite-spinner" style="background: rgba(0, 0, 0, 0) none repeat scroll 0% 0%;display:none;"> <g> <path d="M50 15A35 35 0 1 0 74.787 25.213" fill="none" stroke="#63a6b5" stroke-width="4"></path> <path d="M49 7L49 23L57 15L49 7" fill="#63a6b5"></path> <animateTransform attributeName="transform" type="rotate" calcMode="linear" values="0 50 50;360 50 50" keyTimes="0;1" dur="1s" begin="0s" repeatCount="indefinite"></animateTransform> </g> </svg> </div> <div class="lazy-load js-pagination-container hidden-xs-up"> @if (!String.IsNullOrEmpty(GetString("Ecom:ProductList.NextPage.Clean"))) { <i class="fa fa-spinner fa-spin fa-3x fa-fw"></i> <a href="@GetString("Ecom:ProductList.NextPage.Clean")" aria-label="Next" class="btn btn-block btn-default js-next-page-link"> <span aria-hidden="true">@Translate("SmartPage:Product.Paging.Next", "Indlæs flere produkter")</span> </a> } </div> </div> </div> </div> } </div> </div>