Ovnrist Voss

Varenummer:

15309
B: 426 x D: 360 mm.
400,00 kr. InStock
1 stk. - 400,00 kr.
På lager: 1-2 dages levering

Trustpilot | 1 års returret|Dansk webshop 

Error executing template "Designs/Swift/Paragraph/Swift_ProductComponentSlider.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass6_0.<GetRelatedGroups>b__1(IGrouping`2 group)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Lazy`1.get_Value()
   at CompiledRazorTemplates.Dynamic.RazorEngine_3b8af430b80944a584640be372b10497.Execute() in D:\dynamicweb.net\Solutions\smartpage\vmelektro.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\Paragraph\Swift_ProductComponentSlider.cshtml:line 117
   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 Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Core 3 @using Dynamicweb.Ecommerce.ProductCatalog 4 5 @{ 6 ProductViewModel product = null; 7 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 8 { 9 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 10 } 11 else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) 12 { 13 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 14 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 15 16 if (productList?.Products is object) 17 { 18 product = productList.Products[0]; 19 } 20 } 21 22 string layout = Model.Item.GetRawValueString("Layout") == "slider" ? "ProductSliderComponent" : "ProductGridComponent"; 23 string lazyHeight = Model.Item.GetBoolean("SetMinHeightForLazyLoading") ? "min-height: 360px" : ""; 24 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 25 26 //Link generation 27 string pageId = Model.Item.GetLink("ProductSliderServicePage") != null ? Model.Item.GetLink("ProductSliderServicePage").PageId.ToString() : ""; 28 string servicePageByNavigationTag = GetPageIdByNavigationTag("ProductSliderService") != 0 ? GetPageIdByNavigationTag("ProductSliderService").ToString() : ""; 29 pageId = pageId == "" ? servicePageByNavigationTag : pageId; 30 31 string url = "/Default.aspx?ID=" + pageId; 32 33 if (Pageview.IsVisualEditorMode) 34 { 35 url += "&VisualEdit=True"; 36 } 37 38 bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); 39 if (isLazyLoadingForProductInfoEnabled) 40 { 41 url += "&getproductinfo=true"; 42 } 43 44 url += $"&ProductListPartial={layout}"; //Use this to render either a slider or a grid 45 46 //Source type 47 string sourceType = Model.Item.GetRawValueString("RelationType", "trending"); 48 IList<string> relateFromProductIds = new List<string> { }; 49 IList<string> relateFromProductVariantIds = new List<string> { }; 50 IList<string> relateFromGroupIds = new List<string> { }; 51 bool hasVariants = false; 52 53 54 ProductListViewModel relateToViewModel = Model.Item.GetValue<ProductListViewModel>("RelateTo"); 55 56 //--- PRODUCTS --- 57 if (sourceType == "variants" || sourceType == "frequently" || sourceType == "selected") 58 { 59 if (relateToViewModel?.Products != null) 60 { 61 hasVariants = relateToViewModel.Products.Any(p => !string.IsNullOrEmpty(p.VariantId)); 62 foreach (var fromProduct in relateToViewModel.Products) 63 { 64 if (hasVariants) 65 { 66 if (!string.IsNullOrEmpty(fromProduct.VariantId)) 67 { 68 relateFromProductVariantIds.Add($"{fromProduct.Id} {fromProduct.VariantId}"); 69 } 70 else 71 { 72 relateFromProductVariantIds.Add($"{fromProduct.Id}"); 73 } 74 } 75 relateFromProductIds.Add($"{fromProduct.Id}"); 76 } 77 } 78 } 79 80 //--- GROUPS --- 81 if (sourceType == "most-sold" || sourceType == "trending" || sourceType == "latest" || sourceType == "custom") 82 { 83 var groupsToRelateTo = Model.Item.GetList("RelateTo")?.GetRawValue().OfType<string>().ToList(); 84 85 if (groupsToRelateTo != null) { 86 foreach (var fromGroup in groupsToRelateTo) 87 { 88 var groupId = fromGroup.Length > 2 ? fromGroup.Remove(0, 2) : fromGroup; 89 90 if (!fromGroup.Contains("p_")) 91 { 92 relateFromGroupIds.Add(groupId); 93 } 94 } 95 } 96 97 if (relateToViewModel?.Products != null) 98 { 99 foreach (var fromProduct in relateToViewModel.Products) 100 { 101 var groupId = fromProduct.PrimaryOrDefaultGroup.Id; 102 relateFromGroupIds.Add(groupId); 103 } 104 } 105 } 106 107 string relationGroupId = Model.Item.GetRawValueString("RelationGroup", string.Empty); 108 109 //--- RELATED GROUP --- 110 if (sourceType == "related") 111 { 112 if (relateToViewModel?.Products != null) 113 { 114 product = relateToViewModel.Products.FirstOrDefault(); 115 } 116 117 if (product?.RelatedGroups != null) 118 { 119 foreach (var relationGroup in product.RelatedGroups) 120 { 121 if (relationGroup.Id == relationGroupId) { 122 hasVariants = relationGroup.Products.Any(p => !string.IsNullOrEmpty(p.VariantId)); 123 foreach (var fromProduct in relationGroup.Products) 124 { 125 if (hasVariants) 126 { 127 if (!string.IsNullOrEmpty(fromProduct.VariantId)) 128 { 129 relateFromProductVariantIds.Add($"{fromProduct.ProductId} {fromProduct.VariantId}"); 130 } 131 else 132 { 133 relateFromProductVariantIds.Add($"{fromProduct.ProductId}"); 134 } 135 } 136 relateFromProductIds.Add($"{fromProduct.ProductId}"); 137 } 138 } 139 } 140 } 141 } 142 143 144 //Create group id collection and products id collection strings 145 string productIds = relateFromProductIds.Count > 0 ? string.Join(",", relateFromProductIds) : ""; 146 string productVariantIds = relateFromProductVariantIds.Count > 0 ? string.Join(",", relateFromProductVariantIds) : ""; 147 string groupIds = relateFromGroupIds.Count > 0 ? string.Join(",", relateFromGroupIds) : ""; 148 149 if (product is object) 150 { 151 if (string.IsNullOrEmpty(productIds) && (sourceType == "variants" || sourceType == "frequently" || sourceType == "selected" || sourceType == "custom")) 152 { 153 productIds = product.Id; 154 } 155 156 if (string.IsNullOrEmpty(groupIds) && (sourceType == "most-sold" || sourceType == "trending" || sourceType == "latest")) 157 { 158 groupIds = product.PrimaryOrDefaultGroup.Id; 159 } 160 } 161 } 162 163 @*Container element for the request*@ 164 @if (!string.IsNullOrEmpty(productIds) || !string.IsNullOrEmpty(groupIds) || (string.IsNullOrEmpty(productIds) && string.IsNullOrEmpty(groupIds) && sourceType != "related")) 165 { 166 <form method="post" action="@url" id="ComponentSliderProductsForm_@Model.ID" data-response-target-element="ComponentSliderProducts_@Model.ID" data-preloader="inline" data-update-url="false" class="item_@Model.Item.SystemName.ToLower()"> 167 <input type="hidden" name="ParagraphId" value="@Model.ID" /> 168 <input type="hidden" name="SortOrder" value="DESC"> 169 <input type="hidden" name="SourceType" value="@sourceType"> 170 171 @if (!string.IsNullOrEmpty(groupIds)) 172 { 173 <input type="hidden" name="GroupId" value="@groupIds"> 174 } 175 @if (sourceType != "frequently" && !string.IsNullOrEmpty(productIds) && !hasVariants) 176 { 177 <input type="hidden" name="MainProductId" value="@productIds"> 178 } 179 @if (sourceType != "frequently" && hasVariants) 180 { 181 <input type="hidden" name="ProductVariantId" value="@productVariantIds"> 182 } 183 184 @if (Model.Item.GetInt32("ProductsCount") != 0) 185 { 186 <input type="hidden" name="PageSize" value="@Model.Item.GetInt32("ProductsCount")"> 187 } 188 189 @if (sourceType == "variants") 190 { 191 <input type="hidden" name="isVariant" value="true"> 192 } 193 @if (sourceType == "most-sold") 194 { 195 <input type="hidden" name="SortBy" value="OrderCount"> 196 } 197 @if (sourceType == "trending") 198 { 199 <input type="hidden" name="SortBy" value="OrderCountGrowth"> 200 } 201 @if (sourceType == "frequently" && !string.IsNullOrEmpty(productIds)) 202 { 203 <input type="hidden" name="BoughtWithProductIds" value="[@productIds]"> 204 } 205 @if (sourceType == "latest") 206 { 207 <input type="hidden" name="SortBy" value="Created"> 208 } 209 </form> 210 211 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/swiffy-slider.js"></script> 212 <script> 213 window.addEventListener("load", () => { 214 swift.AssetLoader.Load('/Files/Templates/Designs/Swift/Assets/css/swiffy-slider.min.css', 'css'); 215 }); 216 </script> 217 218 <div class="w-100 h-100@(theme)"> 219 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 220 <div id="ComponentSliderProducts_@Model.ID" class="h-100" style="@lazyHeight"></div> 221 </div> 222 223 <script type="module"> 224 const productSliderContainer = document.querySelector("#ComponentSliderProducts_@Model.ID"); 225 const productSliderForm = document.querySelector("#ComponentSliderProductsForm_@Model.ID"); 226 227 swift.PageUpdater.Update(productSliderForm); 228 productSliderForm.addEventListener("updated.swift.pageupdater", function(e){ 229 if (e.detail.html === "") { 230 productSliderContainer.closest("[data-col-size]").classList.add("d-none"); 231 } 232 }); 233 </script> 234 } 235 else if (Pageview.IsVisualEditorMode == true) 236 { 237 <div class="alert alert-dark" role="alert"> 238 <span>@Translate("Product component slider: The slider will be rendered here, if there is anything to show")</span> 239 </div> 240 } 241

1-2 dages levering
på lagervarer

365 dages returret
 

Vores kunder elsker os
4,8 Trustscore

Erfaren kundeservice
85 års samlet brancheerfaring