Copy of Flamingo-tang - hydraulisk - Manitou ophæng
Error executing template "/Designs/Swift/Paragraph/Custom_ProductDetailsGallery.cshtml" System.NullReferenceException: Object reference not set to an instance of an object. at CompiledRazorTemplates.Dynamic.RazorEngine_e03cb57114ee4193b67c12b1c76558d7.<ExecuteAsync>g__renderHeader|0_0(Int32 totalAssets, Int32 value, IEnumerable`1 assetsList, Int32 index, Int32 mobileIndex, String theme, Int32 modalAssetNumber, CustomProductViewModel product) at CompiledRazorTemplates.Dynamic.RazorEngine_e03cb57114ee4193b67c12b1c76558d7.ExecuteAsync() at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader) at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag) 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.Ecommerce.ProductCatalog 3 @using Scantruck.Website.Custom.ViewModels 4 @using Dynamicweb.Content 5 6 @functions { 7 public CustomProductViewModel product { get; set; } = new CustomProductViewModel(); 8 public string galleryLayout { get; set; } 9 public string[] supportedImageFormats { get; set; } 10 public string[] supportedVideoFormats { get; set; } 11 public string[] supportedDocumentFormats { get; set; } 12 public string[] allSupportedFormats { get; set; } 13 14 public class RatioSettings 15 { 16 public string Ratio { get; set; } 17 public string CssClass { get; set; } 18 public string CssVariable { get; set; } 19 public string Fill { get; set; } 20 } 21 22 public RatioSettings GetRatioSettings(string size = "desktop") 23 { 24 var ratioSettings = new RatioSettings(); 25 26 string ratio = Model.Item.GetRawValueString("ImageAspectRatio", ""); 27 ratio = ratio != "0" ? ratio : ""; 28 string cssClass = ratio != "" && ratio != "fill" ? " ratio" : ""; 29 string cssVariable = ratio != "" && ratio != "fill" ? "--bs-aspect-ratio: " + ratio : ""; 30 cssClass = ratio == "fill" && size == "mobile" ? " ratio" : cssClass; 31 cssVariable = ratio == "fill" && size == "mobile" ? "--bs-aspect-ratio: 66%" : cssVariable; 32 33 ratioSettings.Ratio = ratio; 34 ratioSettings.CssClass = cssClass; 35 ratioSettings.CssVariable = cssVariable; 36 ratioSettings.Fill = ratio == "fill" ? " h-100" : ""; 37 38 return ratioSettings; 39 } 40 } 41 42 @{ 43 PageService ps = new PageService(); 44 Page p = ps.GetPage(Model.PageID); 45 46 CustomProductViewModel product = null; 47 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 48 { 49 product = (CustomProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 50 } 51 else if (p.Item["DummyProduct"] != null) 52 { 53 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 54 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 55 56 if (productList?.Products is object) 57 { 58 // product = productList.Products[0]; 59 // This is only for viewin dummy product in DW. We dont need that. 60 } 61 } 62 } 63 64 @if (product is object) 65 { 66 @* Supported formats *@ 67 supportedImageFormats = new string[] { ".jpg", ".jpeg", ".webp", ".png", ".gif", ".bmp", ".tiff", "JPG" }; 68 supportedVideoFormats = new string[] { "youtu.be", "youtube", "vimeo", ".mp4", ".webm" }; 69 supportedDocumentFormats = new string[] { ".pdf", ".docx", ".xlsx", ".ppt", "pptx" }; 70 allSupportedFormats = supportedImageFormats.Concat(supportedVideoFormats).Concat(supportedDocumentFormats).ToArray(); 71 72 @* Collect the assets *@ 73 var selectedAssetCategories = Model.Item.GetRawValueString("ImageAssets").Split(',').ToList(); 74 bool includeImagePatternImages = Model.Item.GetBoolean("ImagePatternImages"); 75 76 @* Needed image data collection to support both DefaultImage, ImagePatterns and Image Assets *@ 77 string defaultImage = product.DefaultImage != null ? product.DefaultImage.Value : ""; 78 IEnumerable<MediaViewModel> assetsImages = product.AssetCategories.Where(x => selectedAssetCategories.Contains(x.SystemName)).SelectMany(x => x.Assets); 79 assetsImages = assetsImages.OrderByDescending(x => x.Value.Equals(defaultImage)); 80 IEnumerable<MediaViewModel> assetsList = new MediaViewModel[] { }; 81 assetsList = assetsImages.Count() == 0 ? assetsList.Append(product.DefaultImage) : assetsList; 82 assetsList = assetsList.Union(assetsImages); 83 assetsList = includeImagePatternImages ? assetsList.Union(product.ImagePatternImages) : assetsList; 84 85 bool defaultImageFallback = Model.Item.GetBoolean("DefaultImageFallback"); 86 bool showOnlyPrimaryImage = Model.Item.GetBoolean("ShowOnlyPrimaryImage"); 87 88 int totalAssets = 0; 89 if (showOnlyPrimaryImage == false) 90 { 91 foreach (MediaViewModel asset in assetsList) 92 { 93 var assetValue = asset.Value.ToLower(); 94 foreach (string format in allSupportedFormats) 95 { 96 if (assetValue.Contains(format)) 97 { 98 totalAssets++; 99 } 100 } 101 } 102 } 103104 if ((totalAssets == 0 && product.DefaultImage != null && selectedAssetCategories.Count() == 0) || (showOnlyPrimaryImage == true && product.DefaultImage != null) || totalAssets == 0 && defaultImageFallback) 105 { 106 assetsList = new List<MediaViewModel>() { product.DefaultImage }; 107 totalAssets = 1; 108 } 109110 @* Theme settings *@ 111 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 112113 var badgeParms = new Dictionary<string, object>(); 114 badgeParms.Add("size", "h5"); 115 badgeParms.Add("saleBadgeType", Model.Item.GetRawValue("SaleBadgeType")); 116 badgeParms.Add("saleBadgeCssClassName", Model.Item.GetRawValue("SaleBadgeDesign")); 117 badgeParms.Add("newBadgeCssClassName", Model.Item.GetRawValue("NewBadgeDesign")); 118 badgeParms.Add("newPublicationDays", Model.Item.GetInt32("NewPublicationDays")); 119 badgeParms.Add("campaignBadgesValues", Model.Item.GetRawValueString("CampaignBadges")); 120121 bool saleBadgeEnabled = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("SaleBadgeDesign")) && Model.Item.GetRawValueString("SaleBadgeDesign") != "none" ? true : false; 122 bool newBadgeEnabled = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("NewBadgeDesign")) && Model.Item.GetRawValueString("NewBadgeDesign") != "none" ? true : false; 123 DateTime createdDate = product.Created.Value; 124 bool showBadges = saleBadgeEnabled && product.Discount.Price != 0 ? true : false; 125 showBadges = (newBadgeEnabled && Model.Item.GetInt32("NewPublicationDays") == 0) || (newBadgeEnabled && (createdDate.AddDays(Model.Item.GetInt32("NewPublicationDays")) > DateTime.Now)) ? true : showBadges; 126 showBadges = !string.IsNullOrEmpty(Model.Item.GetRawValueString("CampaignBadges")) ? true : showBadges; 127 int assetNumber = 0; 128 int thumbnailNumber = 0; 129 int modalAssetNumber = 0; 130 var index = 0; 131 var mobileIndex = 0; 132 var value = totalAssets >= 5 ? 5 : totalAssets >= 2 ? 2 : 1; 133134 @* Get assets from selected categories or get all assets *@ 135136 if (totalAssets != 0) 137 { 138 renderHeader(totalAssets, value, assetsList, index, mobileIndex, theme, modalAssetNumber, product); 139 } 140 else if (Pageview.IsVisualEditorMode) 141 { 142 RatioSettings ratioSettings = GetRatioSettings("desktop"); 143144 <div class="h-100 @theme"> 145 <div class="d-block @(ratioSettings.CssClass)@(ratioSettings.Fill)" style="@(ratioSettings.CssVariable)"> 146 <img loading="lazy" src="/Files/Images/missing_image.jpg" loading="lazy" decoding="async" class="mh-100 mw-100" style="object-fit: cover;"> 147 </div> 148 </div> 149 } 150 else 151 { 152 assetsList = new List<MediaViewModel>{ 153 new MediaViewModel { Value = product.GetCustomDefaultImage(Pageview.AreaID) } 154 }; 155156 renderHeader(totalAssets, value, assetsList, index, mobileIndex, theme, modalAssetNumber, product); 157 } 158 } 159 else if (Pageview.IsVisualEditorMode) 160 { 161 <div class="alert alert-dark m-0">@Translate("No products available")</div> 162 } 163164 @{ 165 void renderHeader(int totalAssets, int value, IEnumerable<dynamic> assetsList, int index, int mobileIndex, string theme, int modalAssetNumber, CustomProductViewModel product) 166 { 167 var bcFields = product.ProductCategories.Where(x => x.Key == "specifications_bc").FirstOrDefault().Value.Fields; 168169 string classification = bcFields.FirstOrDefault(x => x.Key == "M_0010500").Value.ToString(); 170 bool hasClassification = !string.IsNullOrWhiteSpace(classification); 171172 if (Pageview.AreaID == 6) 173 { 174 hasClassification = false; 175 } 176177 <div class="h-100@(theme) position-relative d-flex flex-wrap justify-content-between align-items-center overflow-hidden item_@Model.Item.SystemName.ToLower()"> 178179 @if (product.HasDiscount && product.RelevantDiscountCampaign != null && product.Price != null && product.Price.Price > 0) 180 { 181 bool useCampaignImage = !string.IsNullOrEmpty(product.RelevantDiscountCampaign.CampaignImage.Value); 182 if (useCampaignImage) 183 { 184 <span class="campaign-container"> 185 @{ 186 string imageUrlUnformatted = "/Admin/Public/GetImage.ashx?width={0}&image={1}&format=webp&quality=99"; 187 var campaignImage = string.Format(imageUrlUnformatted, 600, Uri.EscapeDataString(product.RelevantDiscountCampaign.CampaignImage.Value)); 188 } 189 <img class="campaign-container--image" src="@campaignImage" /> 190 </span> 191 } 192 } 193194 <div id="image-grid" class="grid-container-@value position-relative"> 195 @if (totalAssets > value) 196 { 197 <div class="image-grid-more toggle-modal"> 198 <img loading="lazy" src="/Files/Icons/modal.svg" alt="Modal icon" class="product-specs__item-value" /> 199 @Translate("Show more photos") 200 </div> 201 } 202203 @if (!product.HasImages) 204 { 205 <div class="item1 item toggle-modal go-to-image"> 206 <img loading="lazy" src="@product.GetCustomDefaultImage(Pageview.AreaID)" /> 207 </div> 208209 <div class="product-header__image-fallback-overlay"> 210 <svg width="50" height="46" viewBox="0 0 50 46" fill="none" xmlns="http://www.w3.org/2000/svg"> 211 <path d="M7.6375 1.1141C7.47284 0.928488 7.27298 0.777405 7.0495 0.669606C6.82602 0.561807 6.58337 0.499435 6.33561 0.486106C6.08784 0.472777 5.8399 0.508755 5.60615 0.591956C5.37239 0.675157 5.15747 0.803926 4.97385 0.970799C4.79023 1.13767 4.64156 1.33933 4.53644 1.56409C4.43133 1.78884 4.37187 2.03222 4.36151 2.28013C4.35116 2.52803 4.39011 2.77553 4.4761 3.00827C4.5621 3.24101 4.69344 3.45436 4.8625 3.63597L7.12422 6.12504H6.25C4.75816 6.12504 3.32742 6.71767 2.27252 7.77256C1.21763 8.82745 0.625 10.2582 0.625 11.75V38C0.625 39.4919 1.21763 40.9226 2.27252 41.9775C3.32742 43.0324 4.75816 43.625 6.25 43.625H41.2164L42.3625 44.886C42.5272 45.0716 42.727 45.2227 42.9505 45.3305C43.174 45.4383 43.4166 45.5006 43.6644 45.514C43.9122 45.5273 44.1601 45.4913 44.3939 45.4081C44.6276 45.3249 44.8425 45.1961 45.0261 45.0293C45.2098 44.8624 45.3584 44.6607 45.4636 44.436C45.5687 44.2112 45.6281 43.9678 45.6385 43.7199C45.6488 43.472 45.6099 43.2245 45.5239 42.9918C45.4379 42.7591 45.3066 42.5457 45.1375 42.3641L7.6375 1.1141ZM19.7453 20.0071L28.4172 29.5438C27.389 30.1736 26.2057 30.5047 25 30.5C23.7821 30.4999 22.5882 30.1609 21.552 29.5209C20.5158 28.8808 19.6781 27.9651 19.1327 26.876C18.5874 25.787 18.3558 24.5677 18.464 23.3546C18.5722 22.1415 19.0159 20.9824 19.7453 20.0071ZM6.25 39.875C5.75272 39.875 5.27581 39.6775 4.92418 39.3259C4.57254 38.9742 4.375 38.4973 4.375 38V11.75C4.375 11.2528 4.57254 10.7758 4.92418 10.4242C5.27581 10.0726 5.75272 9.87504 6.25 9.87504H10.5344L17.193 17.2016C15.903 18.697 15.0696 20.5313 14.7917 22.4865C14.5138 24.4417 14.8032 26.4356 15.6255 28.2312C16.4477 30.0267 17.7682 31.5484 19.43 32.6154C21.0919 33.6824 23.0251 34.2497 25 34.25C27.1362 34.2454 29.2187 33.5807 30.9625 32.3469L37.8063 39.875H6.25ZM49.375 11.75V36.5938C49.375 37.0911 49.1775 37.568 48.8258 37.9196C48.4742 38.2712 47.9973 38.4688 47.5 38.4688C47.0027 38.4688 46.5258 38.2712 46.1742 37.9196C45.8225 37.568 45.625 37.0911 45.625 36.5938V11.75C45.625 11.2528 45.4275 10.7758 45.0758 10.4242C44.7242 10.0726 44.2473 9.87504 43.75 9.87504H36.25C35.9416 9.87485 35.6381 9.79861 35.3662 9.65307C35.0943 9.50753 34.8626 9.29718 34.6914 9.04066L31.4945 4.25004H18.4937C18.1914 4.62495 17.7564 4.86916 17.2789 4.93203C16.8014 4.9949 16.318 4.87162 15.929 4.58773C15.5399 4.30384 15.275 3.88113 15.1892 3.40721C15.1033 2.9333 15.2032 2.44453 15.468 2.04222L15.9367 1.3391C16.1078 1.08105 16.3401 0.869372 16.6128 0.722961C16.8856 0.57655 17.1904 0.499962 17.5 0.500035H32.5C32.8088 0.499835 33.1128 0.575891 33.3851 0.721449C33.6574 0.867007 33.8896 1.07756 34.0609 1.33441L37.2531 6.12504H43.75C45.2418 6.12504 46.6726 6.71767 47.7275 7.77256C48.7824 8.82745 49.375 10.2582 49.375 11.75Z" fill="white" /> 212 </svg> 213214 <span>@Translate("Image coming soon")</span> 215 </div> 216 } 217 else 218 { 219 foreach (var asset in assetsList) 220 { 221 index++; 222 var assetValue = !string.IsNullOrEmpty(asset.Value) ? asset.Value : product.DefaultImage.Value; 223224 foreach (string format in supportedImageFormats.Concat(supportedVideoFormats).ToArray()) 225 { 226227228 if (assetValue.ToLower().Contains(format)) 229 { 230 var imagePath = assetValue; 231 var activeSlide = modalAssetNumber == 0 ? "active" : ""; 232233 var parms = new Dictionary<string, object>(); 234 parms.Add("cssClass", "d-block mw-100 mh-100 m-auto"); 235 parms.Add("fullwidth", true); 236 parms.Add("columns", Model.GridRowColumnCount); 237238 foreach (var imageFormat in supportedImageFormats) 239 { //Images 240 if (assetValue.Contains(imageFormat)) 241 { 242243 string itemClass = index == 1 ? "item1 item" : "item"; 244 string galleryClass = product.HasImages && totalAssets > 1 ? "toggle-modal go-to-image" : ""; 245 if (index < value + 1) 246 { 247 <div class="@itemClass @galleryClass"> 248 <img src="@imagePath" /> 249 </div> 250 } 251 } 252 } 253254 } 255 } 256 } 257 } 258 </div> 259260 <div class="mobile-slide"> 261 <div class="swiper mobileSwiper swiper-product-gallery"> 262 <div class="swiper-wrapper" id="swiper-wrapper"> 263 @foreach (var asset in assetsList) 264 { 265 mobileIndex++; 266 var assetValue = !string.IsNullOrEmpty(asset.Value) ? asset.Value : product.DefaultImage.Value; 267 foreach (string format in supportedImageFormats.Concat(supportedVideoFormats).ToArray()) 268 { 269 if (assetValue.Contains(format)) 270 { 271 var imagePath = assetValue; 272 var activeSlide = modalAssetNumber == 0 ? "active" : ""; 273274 var parms = new Dictionary<string, object>(); 275 parms.Add("cssClass", "d-block mw-100 mh-100 m-auto"); 276 parms.Add("fullwidth", true); 277 parms.Add("columns", Model.GridRowColumnCount); 278279 foreach (var imageFormat in supportedImageFormats) 280 { //Images 281 if (assetValue.Contains(imageFormat)) 282 { 283 string itemClass = index == 1 ? "item1 item" : "item"; 284285 <div class="swiper-slide"> 286 <div class="swiper-zoom-container"> 287 <img loading="lazy" src="@imagePath" class="swiper-slide--img" /> 288 </div> 289 </div> 290 } 291 } 292293 } 294 } 295 } 296 @if (!product.HasImages) 297 { 298 <div class="swiper-slide"> 299 <div class="swiper-zoom-container"> 300 <div class="item1 item toggle-modal go-to-image"> 301 <img loading="lazy" src="@product.GetCustomDefaultImage(Pageview.AreaID)" /> 302 </div> 303304 <div class="product-header__image-fallback-overlay"> 305 <svg width="50" height="46" viewBox="0 0 50 46" fill="none" xmlns="http://www.w3.org/2000/svg"> 306 <path d="M7.6375 1.1141C7.47284 0.928488 7.27298 0.777405 7.0495 0.669606C6.82602 0.561807 6.58337 0.499435 6.33561 0.486106C6.08784 0.472777 5.8399 0.508755 5.60615 0.591956C5.37239 0.675157 5.15747 0.803926 4.97385 0.970799C4.79023 1.13767 4.64156 1.33933 4.53644 1.56409C4.43133 1.78884 4.37187 2.03222 4.36151 2.28013C4.35116 2.52803 4.39011 2.77553 4.4761 3.00827C4.5621 3.24101 4.69344 3.45436 4.8625 3.63597L7.12422 6.12504H6.25C4.75816 6.12504 3.32742 6.71767 2.27252 7.77256C1.21763 8.82745 0.625 10.2582 0.625 11.75V38C0.625 39.4919 1.21763 40.9226 2.27252 41.9775C3.32742 43.0324 4.75816 43.625 6.25 43.625H41.2164L42.3625 44.886C42.5272 45.0716 42.727 45.2227 42.9505 45.3305C43.174 45.4383 43.4166 45.5006 43.6644 45.514C43.9122 45.5273 44.1601 45.4913 44.3939 45.4081C44.6276 45.3249 44.8425 45.1961 45.0261 45.0293C45.2098 44.8624 45.3584 44.6607 45.4636 44.436C45.5687 44.2112 45.6281 43.9678 45.6385 43.7199C45.6488 43.472 45.6099 43.2245 45.5239 42.9918C45.4379 42.7591 45.3066 42.5457 45.1375 42.3641L7.6375 1.1141ZM19.7453 20.0071L28.4172 29.5438C27.389 30.1736 26.2057 30.5047 25 30.5C23.7821 30.4999 22.5882 30.1609 21.552 29.5209C20.5158 28.8808 19.6781 27.9651 19.1327 26.876C18.5874 25.787 18.3558 24.5677 18.464 23.3546C18.5722 22.1415 19.0159 20.9824 19.7453 20.0071ZM6.25 39.875C5.75272 39.875 5.27581 39.6775 4.92418 39.3259C4.57254 38.9742 4.375 38.4973 4.375 38V11.75C4.375 11.2528 4.57254 10.7758 4.92418 10.4242C5.27581 10.0726 5.75272 9.87504 6.25 9.87504H10.5344L17.193 17.2016C15.903 18.697 15.0696 20.5313 14.7917 22.4865C14.5138 24.4417 14.8032 26.4356 15.6255 28.2312C16.4477 30.0267 17.7682 31.5484 19.43 32.6154C21.0919 33.6824 23.0251 34.2497 25 34.25C27.1362 34.2454 29.2187 33.5807 30.9625 32.3469L37.8063 39.875H6.25ZM49.375 11.75V36.5938C49.375 37.0911 49.1775 37.568 48.8258 37.9196C48.4742 38.2712 47.9973 38.4688 47.5 38.4688C47.0027 38.4688 46.5258 38.2712 46.1742 37.9196C45.8225 37.568 45.625 37.0911 45.625 36.5938V11.75C45.625 11.2528 45.4275 10.7758 45.0758 10.4242C44.7242 10.0726 44.2473 9.87504 43.75 9.87504H36.25C35.9416 9.87485 35.6381 9.79861 35.3662 9.65307C35.0943 9.50753 34.8626 9.29718 34.6914 9.04066L31.4945 4.25004H18.4937C18.1914 4.62495 17.7564 4.86916 17.2789 4.93203C16.8014 4.9949 16.318 4.87162 15.929 4.58773C15.5399 4.30384 15.275 3.88113 15.1892 3.40721C15.1033 2.9333 15.2032 2.44453 15.468 2.04222L15.9367 1.3391C16.1078 1.08105 16.3401 0.869372 16.6128 0.722961C16.8856 0.57655 17.1904 0.499962 17.5 0.500035H32.5C32.8088 0.499835 33.1128 0.575891 33.3851 0.721449C33.6574 0.867007 33.8896 1.07756 34.0609 1.33441L37.2531 6.12504H43.75C45.2418 6.12504 46.6726 6.71767 47.7275 7.77256C48.7824 8.82745 49.375 10.2582 49.375 11.75Z" fill="white" /> 307 </svg> 308309 <span>@Translate("Image coming soon")</span> 310 </div> 311 </div> 312 </div> 313 } 314 </div> 315 <div class="swiper-menu"> 316 <div class="swiper-pagination"></div> 317 </div> 318 </div> 319 </div> 320 <ul class="product-header-nav"> 321322 <li class="product-header-nav--list"> 323 <ul class="product-header-nav--container"> 324325 @if (product != null && product.ProductFields != null && product.ProductFields.ContainsKey("CustomProductDelivery") && product.ProductFields["CustomProductDelivery"] != null && !string.IsNullOrWhiteSpace(product.ProductFields["CustomProductDelivery"].ToString()) && !string.IsNullOrWhiteSpace(product.ProductFields["CustomProductDelivery"].Value.ToString())) 326 { 327 var fieldValue = product.ProductFields["CustomProductDelivery"]; 328329 if (fieldValue != null) 330 { 331 <li class="product-header-nav--delivery--container"> 332 <span class="product-header-nav--delivery--icon"> 333 @ReadFile("/Files/Icons/DeliveryTimeIcon.svg") 334 </span> 335 <span class="product-header-nav--delivery--text"> 336 @fieldValue.Value 337 </span> 338 </li> 339 } 340 } 341342 @if (product.Price?.Price != null && product.Price?.Price > 0) 343 { 344 <li class="product-header-nav--price--container"> 345346 @if (product.HasDiscount && product.RelevantDiscountCampaign != null && !string.IsNullOrEmpty(product.RelevantDiscountCampaign.CampaignName) && !string.IsNullOrEmpty(product.RelevantDiscountCampaign.CampaignColor)) 347 { 348 <span class="product-header-nav--price--container--campaign" style="background-color:@product.RelevantDiscountCampaign.CampaignColor"> 349 @product.RelevantDiscountCampaign.CampaignName 350 </span> 351 } 352 @if (product.HasDiscount) 353 { 354 <span class="product-header-nav--price--container--discount"> 355 @product.PriceBeforeDiscount.PriceWithoutVat.ToString("N2") 356 </span> 357 } 358 <span class="product-header-nav--price--container--price"> 359 @product.Price.PriceWithoutVat.ToString("N2") @product.Price.CurrencyCode 360 </span> 361 @if (product.Price.Price > 0) 362 { 363 <span> 364 @Translate("Price excl. VAT") 365 </span> 366 } 367 </li> 368 } 369370 @if (product.Price?.Price != null && product.Price?.Price > 0 && product != null && product.ProductFields != null && product.ProductFields.ContainsKey("CustomProductDelivery")) 371 { 372 <li class="product-header-nav--divider"></li> 373 } 374375 @if (hasClassification) 376 { 377 <li class="product-header-nav--classification"> 378 <span class="classification-badge classification-badge--@classification.Replace("+", "_plus")"></span> 379 <a href="@Pageview.Area.Item["ClassificationLink"]?.ToString()" class="classification-link">@Translate("Classification")</a> 380 </li> 381382 } 383384 @if (product?.Premium ?? false) 385 { 386 <li class="tag-explanations"> 387 <div class="premium-explanation">@Translate("Premium Explanation") <a href="@Pageview.Area.Item["PremiumLink"]?.ToString()">@Translate("Read more")</a></div> 388 </li> 389 } 390391 @{ 392393 var hasCustomConfiguratorvisibleValue = product.ProductFields.TryGetValue("CustomConfiguratorIsVisible", out var configuratorVisbleFieldValue); 394395 if (hasCustomConfiguratorvisibleValue && configuratorVisbleFieldValue != null) 396 { 397 var canParseAsBool = bool.TryParse(configuratorVisbleFieldValue.Value.ToString(), out var hasConfigurationAvailable); 398 if (canParseAsBool && hasConfigurationAvailable) 399 { 400 <li class="product-header-nav--button--container--pointer"> 401 @{ 402 string machineConfiguratorLink = Pageview.Area.Item["MachineConfiguratorPage"] != null ? $"{Pageview.Area.Item["MachineConfiguratorPage"]}&ProductId={product.Id}" : "#"; 403 } 404 <a href="@machineConfiguratorLink" target="_blank" class="product-header-nav--offer"> 405 @Translate("Configurate product") 406 </a> 407 </li> 408 } 409 } 410 } 411412 @if (@product.Price?.Price != null && @product.Price?.Price > 0) 413 { 414 <li class="product-header-nav--button--container"> 415 <form method="post" action="/Default.aspx?ID=@(GetPageIdByNavigationTag("CartService"))&LayoutTemplate=Swift_MiniCart.cshtml" class="" style="z-index: 1" title="@Translate("Add to cart")"> 416 <input type="hidden" name="redirect" value="false"> 417 <input type="hidden" name="ProductId" value="@product.Id"> 418 <input type="hidden" name="ProductName" value="@product.Name"> 419 <input type="hidden" name="ProductVariantName" value=""> 420 <input type="hidden" name="ProductCurrency" value="@product.Price.CurrencyCode"> 421 <input type="hidden" name="ProductPrice" value="@product.Price.Price"> 422 <input type="hidden" name="ProductReferer" value="component_ProductAddToCart"> 423 <input type="hidden" name="Quantity" value="1"> 424 <input type="hidden" name="cartcmd" value="add"> 425426 <input type="hidden" name="OrderLineFields|TestCustomOrderlineField" value="Dette er en test for at se om Benjaminsen skylder kage" /> 427428 <button type="button" onclick="swift.Cart.Update(event)" class="product-header-nav--offer" style="white-space: nowrap" title="@Translate("Add to cart")"> 429 <span class="icon-2"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shopping-cart"><circle cx="9" cy="21" r="1"></circle><circle cx="20" cy="21" r="1"></circle><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"></path></svg></span> 430 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2">@Translate("Add to cart")</span> 431 </button> 432 </form> 433 </li> 434 } 435 else 436 { 437 <li class="product-header-nav--button--container--pointer"> 438 <div class="product-header-nav--offer" data-action="overlay-open"> 439 <span> 440 <svg width="24" height="28" viewBox="0 0 24 28" fill="none" xmlns="http://www.w3.org/2000/svg"> 441 <path d="M5.625 12.9375H18.375C18.6568 12.9375 18.927 12.8256 19.1263 12.6263C19.3256 12.427 19.4375 12.1568 19.4375 11.875V5.5C19.4375 5.21821 19.3256 4.94796 19.1263 4.7487C18.927 4.54944 18.6568 4.4375 18.375 4.4375H5.625C5.34321 4.4375 5.07296 4.54944 4.8737 4.7487C4.67444 4.94796 4.5625 5.21821 4.5625 5.5V11.875C4.5625 12.1568 4.67444 12.427 4.8737 12.6263C5.07296 12.8256 5.34321 12.9375 5.625 12.9375ZM6.6875 6.5625H17.3125V10.8125H6.6875V6.5625ZM21.5625 0.1875H2.4375C1.87391 0.1875 1.33341 0.411383 0.934898 0.809898C0.536383 1.20841 0.3125 1.74891 0.3125 2.3125V25.6875C0.3125 26.2511 0.536383 26.7916 0.934898 27.1901C1.33341 27.5886 1.87391 27.8125 2.4375 27.8125H21.5625C22.1261 27.8125 22.6666 27.5886 23.0651 27.1901C23.4636 26.7916 23.6875 26.2511 23.6875 25.6875V2.3125C23.6875 1.74891 23.4636 1.20841 23.0651 0.809898C22.6666 0.411383 22.1261 0.1875 21.5625 0.1875ZM21.5625 25.6875H2.4375V2.3125H21.5625V25.6875ZM8.28125 16.6562C8.28125 16.9715 8.18778 17.2796 8.01266 17.5417C7.83753 17.8038 7.58862 18.0081 7.2974 18.1287C7.00618 18.2493 6.68573 18.2809 6.37657 18.2194C6.06742 18.1579 5.78344 18.0061 5.56055 17.7832C5.33766 17.5603 5.18587 17.2763 5.12437 16.9672C5.06288 16.658 5.09444 16.3376 5.21507 16.0463C5.33569 15.7551 5.53997 15.5062 5.80206 15.3311C6.06415 15.156 6.37229 15.0625 6.6875 15.0625C7.11019 15.0625 7.51557 15.2304 7.81445 15.5293C8.11334 15.8282 8.28125 16.2336 8.28125 16.6562ZM13.5938 16.6562C13.5938 16.9715 13.5003 17.2796 13.3252 17.5417C13.15 17.8038 12.9011 18.0081 12.6099 18.1287C12.3187 18.2493 11.9982 18.2809 11.6891 18.2194C11.3799 18.1579 11.0959 18.0061 10.873 17.7832C10.6502 17.5603 10.4984 17.2763 10.4369 16.9672C10.3754 16.658 10.4069 16.3376 10.5276 16.0463C10.6482 15.7551 10.8525 15.5062 11.1146 15.3311C11.3767 15.156 11.6848 15.0625 12 15.0625C12.4227 15.0625 12.8281 15.2304 13.127 15.5293C13.4258 15.8282 13.5938 16.2336 13.5938 16.6562ZM18.9062 16.6562C18.9062 16.9715 18.8128 17.2796 18.6377 17.5417C18.4625 17.8038 18.2136 18.0081 17.9224 18.1287C17.6312 18.2493 17.3107 18.2809 17.0016 18.2194C16.6924 18.1579 16.4084 18.0061 16.1855 17.7832C15.9627 17.5603 15.8109 17.2763 15.7494 16.9672C15.6879 16.658 15.7194 16.3376 15.8401 16.0463C15.9607 15.7551 16.165 15.5062 16.4271 15.3311C16.6892 15.156 16.9973 15.0625 17.3125 15.0625C17.7352 15.0625 18.1406 15.2304 18.4395 15.5293C18.7383 15.8282 18.9062 16.2336 18.9062 16.6562ZM8.28125 21.9688C8.28125 22.284 8.18778 22.5921 8.01266 22.8542C7.83753 23.1163 7.58862 23.3206 7.2974 23.4412C7.00618 23.5618 6.68573 23.5934 6.37657 23.5319C6.06742 23.4704 5.78344 23.3186 5.56055 23.0957C5.33766 22.8728 5.18587 22.5888 5.12437 22.2797C5.06288 21.9705 5.09444 21.6501 5.21507 21.3588C5.33569 21.0676 5.53997 20.8187 5.80206 20.6436C6.06415 20.4685 6.37229 20.375 6.6875 20.375C7.11019 20.375 7.51557 20.5429 7.81445 20.8418C8.11334 21.1407 8.28125 21.5461 8.28125 21.9688ZM13.5938 21.9688C13.5938 22.284 13.5003 22.5921 13.3252 22.8542C13.15 23.1163 12.9011 23.3206 12.6099 23.4412C12.3187 23.5618 11.9982 23.5934 11.6891 23.5319C11.3799 23.4704 11.0959 23.3186 10.873 23.0957C10.6502 22.8728 10.4984 22.5888 10.4369 22.2797C10.3754 21.9705 10.4069 21.6501 10.5276 21.3588C10.6482 21.0676 10.8525 20.8187 11.1146 20.6436C11.3767 20.4685 11.6848 20.375 12 20.375C12.4227 20.375 12.8281 20.5429 13.127 20.8418C13.4258 21.1407 13.5938 21.5461 13.5938 21.9688ZM18.9062 21.9688C18.9062 22.284 18.8128 22.5921 18.6377 22.8542C18.4625 23.1163 18.2136 23.3206 17.9224 23.4412C17.6312 23.5618 17.3107 23.5934 17.0016 23.5319C16.6924 23.4704 16.4084 23.3186 16.1855 23.0957C15.9627 22.8728 15.8109 22.5888 15.7494 22.2797C15.6879 21.9705 15.7194 21.6501 15.8401 21.3588C15.9607 21.0676 16.165 20.8187 16.4271 20.6436C16.6892 20.4685 16.9973 20.375 17.3125 20.375C17.7352 20.375 18.1406 20.5429 18.4395 20.8418C18.7383 21.1407 18.9062 21.5461 18.9062 21.9688Z" fill="white" /> 442 </svg> 443444 </span> 445 @Translate("Price inquiry") 446 </div> 447 </li> 448 } 449 </ul> 450 </ul> 451 @if (product?.Premium ?? false) 452 { 453 <div class="product-header-badge product-header-badge--premium">@Translate("ProductBadge:Premium")</div> 454 } 455 </div> 456457 <div class="product-header-modal modal-container--close toggle-modal" id="product-header-modal"> 458 <div class="modal-container" onclick="event.stopPropagation();"> 459 <div class="swiper mySwiper swiper-product-gallery"> 460 <div class="swiper-wrapper" id="swiper-wrapper"> 461 @{ 462 bool hasRenderedDefaultImage = false; 463 } 464465 @foreach (var asset in assetsList) 466 { 467 index++; 468 var assetValue = !string.IsNullOrEmpty(asset.Value) ? asset.Value : product.DefaultImage.Value; 469470 // Skip rendering the default image in the loop if it has already been rendered. 471 if (hasRenderedDefaultImage && assetValue == product.DefaultImage.Value && index == 1) 472 { 473 continue; 474 } 475476 foreach (string format in supportedImageFormats.Concat(supportedVideoFormats).ToArray()) 477 { 478 if (assetValue.Contains(format)) 479 { 480 var imagePath = assetValue; 481482 // Logic to render swiper-slide 483 <div class="swiper-slide"> 484 <div class="swiper-image-container"> 485 <img loading="lazy" src="@imagePath" class="swiper-slide--img" /> 486 </div> 487 </div> 488 } 489 } 490 } 491492 </div> 493 @if (totalAssets > 1) 494 { 495 <div class="swiper-button-next"> 496 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 497 <path d="M4 13L16.17 13L10.58 18.59L12 20L20 12L12 4L10.59 5.41L16.17 11L4 11L4 13Z" fill="white" /> 498 </svg> 499 </div> 500 <div class="swiper-button-prev"> 501 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 502 <path d="M20 11L7.83 11L13.42 5.41L12 4L4 12L12 20L13.41 18.59L7.83 13L20 13L20 11Z" fill="white" /> 503 </svg> 504 </div> 505 } 506 <div class="swiper-menu"> 507 <div class="swiper-pagination"></div> 508 </div> 509 </div> 510 <div class="modal-container--close-button toggle-modal"> 511 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="23" viewBox="0 0 24 23" fill="none"> 512 <line x1="2.26777" y1="1.71289" x2="21.7132" y2="21.1583" stroke="white" stroke-width="2.5" stroke-linecap="round" /> 513 <line x1="2.5" y1="20.9451" x2="21.9454" y2="1.49969" stroke="white" stroke-width="2.5" stroke-linecap="round" /> 514 </svg> 515 </div> 516 </div> 517 </div> 518 } 519 }
Info om maskinen
- Specifikationer
Nummer
VMB-TANG-M



