Se flere billeder

Variant: Conifer
  • Størrelse 90x250/370 cm
  • Vægt (kg) 51,33
18.195,00 kr. Available in stock
Ikke på lager
Error executing template "/Designs/Swift/Paragraph/Swift_ProductSpecification_Custom.cshtml"
System.IO.IOException: The process cannot access the file 'D:\dynamicweb.net\Solutions\twodayco3\evasolo.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\Translations.xml' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Dynamicweb.Rendering.Translation.Source.WriteDocument(XmlDocument document)
   at Dynamicweb.Rendering.Translation.Source.Save()
   at Dynamicweb.Rendering.Translation.Source.UpdateTranslationSource(Source source, IEnumerable`1 newKeys, String designName, IEnumerable`1 cultures)
   at Dynamicweb.Rendering.Template.TranslateText(String text, String defaultValue, String cultureName)
   at Dynamicweb.Rendering.TemplateBase`1.Translate(String text, String defaultValue)
   at CompiledRazorTemplates.Dynamic.RazorEngine_0d08c5b46efc47c59ea83c95be3c89c4.<>c__DisplayClass2_0.<RenderFieldValue>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\twodayco3\evasolo.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\Paragraph\Swift_ProductSpecification_Custom.cshtml:line 577
   at CompiledRazorTemplates.Dynamic.RazorEngine_0d08c5b46efc47c59ea83c95be3c89c4.<>c__DisplayClass1_0.<RenderField>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\twodayco3\evasolo.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\Paragraph\Swift_ProductSpecification_Custom.cshtml:line 485
   at CompiledRazorTemplates.Dynamic.RazorEngine_0d08c5b46efc47c59ea83c95be3c89c4.<>c__DisplayClass0_0.<RenderFieldsFromList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\twodayco3\evasolo.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\Paragraph\Swift_ProductSpecification_Custom.cshtml:line 344
   at CompiledRazorTemplates.Dynamic.RazorEngine_0d08c5b46efc47c59ea83c95be3c89c4.Execute() in D:\dynamicweb.net\Solutions\twodayco3\evasolo.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\Paragraph\Swift_ProductSpecification_Custom.cshtml:line 253
   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 @*//CUSTOM*@ 3 @using Dynamicweb.Ecommerce.ProductCatalog 4 5 @* CUSTOM TEMPLATE SUPPORTED BY SWIFT (v1.20.0) - NOTE: THIS TEMPLATE IS NOT SUPPORTED IN DW10 *@ 6 @* STANDARD TEMPLATE IS DEPRECATED IN SWIFT (1.25.0) *@ 7 8 @{ 9 bool isVisualEditor = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("VisualEdit")) ? Convert.ToBoolean(Dynamicweb.Context.Current.Request.QueryString.Get("VisualEdit")) : false; 10 11 ProductViewModel product = new ProductViewModel(); 12 13 ProductViewModelSettings productSetting = new ProductViewModelSettings 14 { 15 LanguageId = Dynamicweb.Ecommerce.Common.Context.LanguageID, 16 CurrencyCode = Dynamicweb.Ecommerce.Common.Context.Currency.Code, 17 CountryCode = Dynamicweb.Ecommerce.Common.Context.Country.Code2, 18 ShopId = Pageview.Area.EcomShopId 19 }; 20 21 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 22 { 23 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 24 } 25 else if (Pageview.Item["DummyProduct"] != null) 26 { 27 28 string dummyProductId = ""; 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 if (productList.Products != null) 32 { 33 foreach (var p in productList.Products) { dummyProductId = p.Id; } 34 ProductViewModel dummyProduct = dummyProductId != "" ? ViewModelFactory.CreateView(productSetting, dummyProductId) : new ProductViewModel(); 35 product = dummyProduct; 36 } 37 else 38 { 39 product = ViewModelFactory.CreateView(productSetting, Dynamicweb.Ecommerce.Services.Products.GetLastActiveProducts(1, Dynamicweb.Ecommerce.Common.Context.LanguageID, false).FirstOrDefault().Id); 40 } 41 } 42 else if (Pageview.Item["DummyProduct"] == null) 43 { 44 product = ViewModelFactory.CreateView(productSetting, Dynamicweb.Ecommerce.Services.Products.GetLastActiveProducts(1, Dynamicweb.Ecommerce.Common.Context.LanguageID, false).FirstOrDefault().Id); 45 } 46 } 47 48 @if (product?.Id != null) 49 { 50 IEnumerable<string> selectedDisplayGroupIds = Model.Item.GetRawValueString("DisplayGroups").Split(',').ToList(); 51 List<CategoryFieldViewModel> displayGroups = new List<CategoryFieldViewModel>(); 52 53 foreach (var selection in selectedDisplayGroupIds) 54 { 55 foreach (CategoryFieldViewModel group in product.FieldDisplayGroups.Values) 56 { 57 if (selection == group.Id) 58 { 59 displayGroups.Add(group); 60 } 61 } 62 } 63 64 bool showProductFields = Model.Item.GetBoolean("ProductFields"); 65 66 bool hideTitle = Model.Item.GetBoolean("HideTitle"); 67 68 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 69 70 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-4"); 71 72 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 73 contentPadding = contentPadding == "small" ? "p-2 p-md-3" : contentPadding; 74 contentPadding = contentPadding == "large" ? "p-4 p-md-5" : contentPadding; 75 76 string layout = Model.Item.GetRawValueString("Layout", "list"); 77 string size = Model.Item.GetRawValueString("Size", "full"); 78 79 if (Pageview.IsVisualEditorMode && displayGroups.Count() == 0) 80 { 81 product.ProductFields.Clear(); 82 product.ProductFields.Add(Translate("Width"), new FieldValueViewModel { Name = Translate("Width"), Value = "99cm" }); 83 product.ProductFields.Add(Translate("Height"), new FieldValueViewModel { Name = Translate("Height"), Value = "195cm" }); 84 showProductFields = true; 85 } 86 87 <div class="@(theme) h-100 item_@Model.Item.SystemName.ToLower()" id="specifications"> 88 <div class="@contentPadding"> 89 @if ((product.ProductFields != null && Model.Item.GetBoolean("ProductFields")) || (product.ProductCategories != null && Model.Item.GetBoolean("CategoryFields")) || (displayGroups.Count != 0)) 90 { 91 if (!hideTitle) 92 { 93 <div class="text-start pb-2 pb-lg-4"> 94 <h2 class="@titleFontSize">@Model.Item.GetString("Title")</h2> 95 </div> 96 } 97 } 98 99 @if (displayGroups.Count != 0) 100 { 101 <div class="accordion-specifications-container col-12 col-lg-10 mx-auto"> 102 <div class="accordion accordion-flush" id="accordionSpecifications"> 103 104 @*//CUSTOM*@ 105 @if (product.LongDescription.IsNotNullOrEmpty()) 106 { 107 <div class="accordion-item"> 108 <div class="accordion-header" id="specifications-heading-longdescription"> 109 <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#specifications-collapse-longdescription" aria-expanded="false" aria-controls="specifications-collapse-longdescription"> 110 <h4 class="h4 mb-0">@Translate("Custom:ProductSpecification.Description.Heading", "Beskrivelse")</h4> 111 </button> 112 </div> 113 <div id="specifications-collapse-longdescription" class="accordion-collapse collapse small show" aria-labelledby="specifications-heading-longdescription" data-bs-parent="#accordionSpecifications"> 114 <div class="grid"> 115 <div class="g-col-12 g-col-lg-8 mb-3 js-custom-ellipsis-readmore custom-ellipsis-readmore" data-ellipsis-readmore="5"> 116 <div class="custom-ellipsis-readmore__content">@product.LongDescription</div> 117 <div class="custom-ellipsis-readmore__readmore" onclick="this.parentNode.classList.add('show');"><u>@Translate("Custom:ProductSpecification.Description.ReadMore", "Læs mere")</u></div> 118 </div> 119 </div> 120 </div> 121 </div> 122 } 123 @*//--CUSTOM*@ 124 125 @*//CUSTOM*@ 126 @if (product.ProductCategories != null) 127 { 128 var productCategoryGroups = product.ProductCategories.Values 129 .SelectMany(category => category.Fields?.Where(i => i.Key == "Custom_DesignerArticles" || i.Key == "Custom_CaseArticles") ?? Enumerable.Empty<KeyValuePair<string, FieldValueViewModel>>()) 130 .GroupBy(i => i.Key) 131 .Select(g => new 132 { 133 Key = g.Key, 134 PageIds = g.SelectMany(j => j.Value.ToString().Split(',')).Select(j => int.TryParse(j, out int k) ? k : (int?)null).Where(j => j.HasValue).Select(j => j.Value).ToArray() 135 }) 136 .Where(g => g.PageIds.Any()) 137 .ToDictionary( 138 g => g.Key, 139 g => Dynamicweb.Content.Services.Pages.GetPages(g.PageIds).Select(p => Dynamicweb.Content.Services.Pages.GetPageOrLanguage(p.ID, Pageview.Area.ID)).Where(p => p != null && p.ItemType == "Swift_Article").ToList() 140 ); 141 142 foreach (var productCategoryGroup in productCategoryGroups) 143 { 144 if (productCategoryGroup.Value.Any()) 145 { 146 string groupId = productCategoryGroup.Key.Replace("_", "").ToLower(); 147 string groupKey = productCategoryGroup.Key.Replace("_", ""); 148 string groupName = productCategoryGroup.Key.Replace("Custom_", ""); 149 150 <div class="accordion-item"> 151 <div class="accordion-header" id="specifications-heading-@(groupId)"> 152 <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#specifications-collapse-@(groupId)" aria-expanded="false" aria-controls="specifications-collapse-@(groupId)"> 153 <h4 class="h4 mb-0">@Translate($"Custom:ProductSpecification.{groupKey}.Heading", groupName)</h4> 154 </button> 155 </div> 156 <div id="specifications-collapse-@(groupId)" class="accordion-collapse collapse small" aria-labelledby="specifications-heading-@(groupId)" data-bs-parent="#accordionSpecifications"> 157 <div class="mb-4"> 158 @foreach (Dynamicweb.Content.Page page in productCategoryGroup.Value) 159 { 160 <div class="grid mb-3"> 161 <div class="g-col-12 g-col-lg-5 g-col-xl-4 g-col-xxl-3"> 162 @if (page.Item.TryGetValue("CoverImage", out object coverImage)) 163 { 164 var coverImageUri = new Uri("http://dummy.com" + coverImage.ToString()); 165 var coverImagePathParams = System.Web.HttpUtility.ParseQueryString(coverImageUri.Query); 166 167 <figure class="overflow-hidden m-0 mx-auto ratio" style="--bs-aspect-ratio: 75%"> 168 @RenderPartial("Components/Image.cshtml", 169 new Dynamicweb.Frontend.FileViewModel 170 { 171 Path = System.Web.HttpUtility.UrlDecode(coverImageUri.AbsolutePath), 172 FocalX = Converter.ToInt32(coverImagePathParams["X"]), 173 FocalY = Converter.ToInt32(coverImagePathParams["Y"]) 174 }, 175 new Dictionary<string, object> 176 { 177 { "loading", "lazy" }, 178 { "alt", Converter.ToString(page.Item["Title"]) } 179 }) 180 </figure> 181 } 182 </div> 183 <div class="g-col-12 g-col-lg-7 g-col-xl-4 g-col-xxl-3"> 184 <div class="d-flex flex-column gap-2"> 185 @if (page.Item.TryGetValue("Title", out object title)) 186 { 187 <h2 class="h6 text-inherit opacity-100 mw-75ch m-0">@title</h2> 188 } 189 @if (page.Item.TryGetValue("Summary", out object summary)) 190 { 191 <div class="text-inherit opacity-100 mw-75ch"> 192 <p class="m-0">@summary</p> 193 </div> 194 } 195 <div class="d-flex flex-wrap gap-3"> 196 <a href="Default.aspx?ID=@(page.ID)" class="link">@Translate($"Custom:ProductSpecification.{groupKey}.ReadMore", "Read more »")</a> 197 </div> 198 </div> 199 </div> 200 </div> 201 } 202 </div> 203 </div> 204 </div> 205 } 206 } 207 } 208 @*//--CUSTOM*@ 209 210 @foreach (var group in displayGroups) 211 { 212 bool hideHeader = Model.Item.GetBoolean("HideGroupHeaders"); 213 string groupId = group.Id; 214 string buttonCollapsedState = Model.Item.GetBoolean("OpenDetailsAccordion") ? "" : "collapsed"; 215 string accordionShow = Model.Item.GetBoolean("OpenDetailsAccordion") ? "show" : ""; 216 217 @*//CUSTOM*@ 218 if (product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Bom && group.Id == "Product_details") 219 { 220 var apiProduct = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId, false); 221 var productNumbers = new List<string>(); 222 223 foreach (Dynamicweb.Ecommerce.Products.ProductItem item in apiProduct.Items) 224 { 225 foreach (Dynamicweb.Ecommerce.Products.Product productitem in item.Products) 226 { 227 productNumbers.Add(productitem.Number); 228 } 229 } 230 if (productNumbers.Any()) 231 { 232 string commaSeparatedNumbers = string.Join(", ", productNumbers); 233 FieldValueViewModel productNumberInBOM = new FieldValueViewModel(); 234 productNumberInBOM.Name = Translate("Custom:ProductSpecification.ProductNumbersInBOM", "Product numbers in BOM"); 235 productNumberInBOM.Value = commaSeparatedNumbers; 236 productNumberInBOM.Type = "Text"; 237 productNumberInBOM.SystemName = "ProductNumbersInBOM"; 238 group.Fields.Add("Product numbers in BOM", productNumberInBOM); 239 } 240 } 241 @*//--CUSTOM*@ 242 243 <div class="accordion-item"> 244 <div class="accordion-header" id="specifications-heading-@groupId"> 245 <button class="accordion-button @buttonCollapsedState" type="button" data-bs-toggle="collapse" data-bs-target="#specifications-collapse-@groupId" aria-expanded="false" aria-controls="specifications-collapse-@groupId"> 246 @if (!hideHeader) 247 { 248 <h4 class="h4 mb-0">@group.Name</h4> 249 } 250 </button> 251 </div> 252 <div id="specifications-collapse-@groupId" class="accordion-collapse collapse small @accordionShow" aria-labelledby="specifications-heading-@groupId" data-bs-parent="#accordionSpecifications"> 253 <div>@RenderFieldsFromList(group.Fields, layout)</div> 254 </div> 255 </div> 256 } 257 258 @if (!string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("CustomSettings").GetString("FreightAndDeliveryText"))) 259 { 260 <div class="accordion-item"> 261 <div class="accordion-header" id="specifications-heading-DeliveryInfo"> 262 <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#specifications-collapse-DeliveryInfo" aria-expanded="false" aria-controls="specifications-collapse-DeliveryInfo"> 263 <h4 class="h4 mb-0">@Pageview.AreaSettings.GetItem("CustomSettings").GetString("FreightAndDeliveryHeading")</h4> 264 </button> 265 </div> 266 <div id="specifications-collapse-DeliveryInfo" class="accordion-collapse collapse small" aria-labelledby="specifications-heading-DeliveryInfo" data-bs-parent="#accordionSpecifications"> 267 <div class="mb-4">@Pageview.AreaSettings.GetItem("CustomSettings").GetString("FreightAndDeliveryText")</div> 268 </div> 269 </div> 270 } 271 272 </div> 273 </div> 274 } 275 276 @if (product.ProductFields != null && showProductFields) 277 { 278 if (product.ProductFields.Count > 0) 279 { 280 @RenderFieldsFromList(product.ProductFields, layout); 281 } 282 } 283 284 @if (product.ProductCategories != null && Model.Item.GetBoolean("CategoryFields")) 285 { 286 if (product.ProductCategories.Count > 0) 287 { 288 foreach (var group in product.ProductCategories) 289 { 290 CategoryFieldViewModel category = group.Value; 291 bool hideHeader = Model.Item.GetBoolean("HideGroupHeaders"); 292 293 if (!hideHeader) 294 { 295 <h4 class="h4 mb-4">@group.Value.Name</h4> 296 } 297 298 @RenderFieldsFromList(category.Fields, layout); 299 } 300 } 301 } 302 </div> 303 </div> 304 } 305 else if (Pageview.IsVisualEditorMode) 306 { 307 <div class="alert alert-warning m-0">@Translate("No products available")</div> 308 } 309 310 @helper RenderFieldsFromList(Dictionary<string, FieldValueViewModel> fields, string layout) 311 { 312 string size = Model.Item.GetRawValueString("Size", "full"); 313 string extraMargin = size == "full" ? "mb-3" : ""; 314 bool hideFieldLabels = Model.Item.GetBoolean("HideFieldLabels"); 315 316 <div class="@extraMargin"> 317 @if (layout == "columns") 318 { 319 string gaps = size == "full" ? "gap-0" : "gap-2"; 320 321 <div class="grid @gaps"> 322 @foreach (var field in fields) 323 { 324 @RenderField(field.Value, layout) 325 } 326 </div> 327 } 328 @if (layout == "list") 329 { 330 <dl class="grid gap-0"> 331 @foreach (var field in fields) 332 { 333 @RenderField(field.Value, layout) 334 } 335 </dl> 336 } 337 @if (layout == "table") 338 { 339 string tableSize = size == "full" ? "" : "table-sm"; 340 341 <table class="table table-striped @tableSize"> 342 @foreach (var field in fields) 343 { 344 @RenderField(field.Value, layout) 345 } 346 </table> 347 } 348 @if (layout == "bullets") 349 { 350 string listSize = size == "full" ? "" : "m-0 p-0 lh-1 fs-7 opacity-75"; 351 string listStyle = size == "full" ? "" : "style=\"list-style-position: inside\""; 352 353 <ul class="@listSize" @listStyle> 354 @foreach (var field in fields) 355 { 356 @RenderField(field.Value, layout) 357 } 358 </ul> 359 } 360 @if (layout == "commas") 361 { 362 List<string> featuresList = new List<string>(); 363 364 foreach (var field in fields) 365 { 366 if (field.Value.Value.GetType() == typeof(System.Collections.Generic.List<FieldOptionValueViewModel>)) 367 { 368 List<string> options = new List<string>(); 369 foreach (FieldOptionValueViewModel option in field.Value.Value as System.Collections.Generic.List<FieldOptionValueViewModel>) 370 { 371 if (!string.IsNullOrWhiteSpace(option.Value)) 372 { 373 if (option.Value.ToString().Contains("#") && (Translate(field.Value.Name) == Translate("Color") || Translate(field.Value.Name) == Translate("Colour"))) 374 { 375 string colorSpan = "<span class=\"colorbox-sm\" style=\"background-color: " + option.Value + "\"></span>"; 376 options.Add(colorSpan); 377 } 378 else if (!string.IsNullOrEmpty(option.Value)) 379 { 380 options.Add(option.Name); 381 } 382 } 383 } 384 string optionsString = (string.Join(", ", options.Select(x => x.ToString()).ToArray())); 385 if ((Translate(field.Value.Name) == Translate("Color") || Translate(field.Value.Name) == Translate("Colour"))) 386 { 387 optionsString = (string.Join(" ", options.Select(x => x.ToString()).ToArray())); 388 } 389 390 if (!hideFieldLabels) 391 { 392 featuresList.Add(field.Value.Name + ": " + optionsString); 393 } 394 else 395 { 396 featuresList.Add(optionsString); 397 } 398 } 399 else 400 { 401 if (!string.IsNullOrWhiteSpace(field.Value.Value.ToString())) 402 { 403 if (field.Value.Value.ToString().Contains("#") && (Translate(field.Value.Name) == Translate("Color") || Translate(field.Value.Name) == Translate("Colour"))) 404 { 405 string colorSpan = "<span class=\"colorbox-sm\" style=\"background-color: " + field.Value.Value + "\"></span>"; 406 407 if (!hideFieldLabels) 408 { 409 featuresList.Add(field.Value.Name + ": " + colorSpan); 410 } 411 else 412 { 413 featuresList.Add(colorSpan); 414 } 415 } 416 else 417 { 418 if (!hideFieldLabels) 419 { 420 featuresList.Add(field.Value.Name + ": " + field.Value.Value.ToString()); 421 } 422 else 423 { 424 featuresList.Add(field.Value.Value.ToString()); 425 } 426 } 427 } 428 } 429 } 430 431 string featuresString = (string.Join(", ", featuresList.Select(x => x.ToString()).ToArray())); 432 433 <div class="opacity-75 fs-7">@featuresString</div> 434 } 435 </div> 436 } 437 438 @helper RenderField(FieldValueViewModel field, string layout) 439 { 440 string size = Model.Item.GetRawValueString("Size", "full"); 441 string fieldValue = field?.Value != null ? field.Value.ToString() : ""; 442 bool hideFieldLabels = Model.Item.GetBoolean("HideFieldLabels"); 443 bool noValues = false; 444 445 if (!string.IsNullOrEmpty(fieldValue)) 446 { 447 if (field.Value.GetType() == typeof(System.Collections.Generic.List<FieldOptionValueViewModel>)) 448 { 449 System.Collections.Generic.List<FieldOptionValueViewModel> values = field.Value as System.Collections.Generic.List<FieldOptionValueViewModel>; 450 noValues = values.Count > 0 ? false : true; 451 } 452 } 453 454 if (!string.IsNullOrEmpty(fieldValue) && noValues == false) 455 { 456 if (layout == "columns") 457 { 458 <div class="grid g-col-6 g-col-lg-4"> 459 @if (!hideFieldLabels) 460 { 461 <dt class="g-col-4 py-2 fw-bold">@field.Name</dt> 462 } 463 <dd class="g-col-8 py-2 mb-0">@RenderFieldValue(field)</dd> 464 </div> 465 } 466 if (layout == "list") 467 { 468 string extraPadding = size == "full" ? "py-2" : ""; 469 470 if (!hideFieldLabels) 471 { 472 <dt class="g-col-4 @extraPadding fw-bold">@field.Name</dt> 473 } 474 <dd class="g-col-8 @extraPadding mb-0"> 475 @RenderFieldValue(field) 476 </dd> 477 } 478 if (layout == "table") 479 { 480 <tr> 481 @if (!hideFieldLabels) 482 { 483 <th class="fw-bold" scope="row">@field.Name</th> 484 } 485 <td>@RenderFieldValue(field)</td> 486 </tr> 487 } 488 if (layout == "bullets") 489 { 490 <li> 491 @if (!hideFieldLabels) 492 { 493 <strong>@field.Name</strong> 494 } 495 <span>@RenderFieldValue(field)</span> 496 </li> 497 } 498 } 499 } 500 501 @helper RenderFieldValue(FieldValueViewModel field) 502 { 503 string fieldValue = field?.Value != null ? field.Value.ToString() : ""; 504 505 bool isLink = field?.Type == "Link"; 506 bool isColor = false; 507 bool isBrandName = field?.SystemName == "Brand_name"; 508 509 fieldValue = fieldValue == "False" ? Translate("No") : fieldValue; 510 fieldValue = fieldValue == "True" ? Translate("Yes") : fieldValue; 511 512 513 if (field.Value.GetType() == typeof(System.Collections.Generic.List<Dynamicweb.Ecommerce.ProductCatalog.FieldOptionValueViewModel>)) 514 { 515 int valueCount = 0; 516 System.Collections.Generic.List<FieldOptionValueViewModel> values = field.Value as System.Collections.Generic.List<FieldOptionValueViewModel>; 517 int totalValues = values.Count; 518 519 foreach (FieldOptionValueViewModel option in values) 520 { 521 if (option.Value.Substring(0, 1) == "#") 522 { 523 isColor = true; 524 } 525 526 if (!isColor) 527 { 528 @option.Name 529 } 530 else 531 { 532 <span class="colorbox-sm" style="background-color: @option.Value" title="@option.Name"></span> 533 } 534 535 if (valueCount != totalValues && valueCount < (totalValues - 1)) 536 { 537 if (isColor) 538 { 539 <text> </text> 540 } 541 else 542 { 543 <text>, </text> 544 } 545 } 546 valueCount++; 547 } 548 } 549 else 550 { 551 if (fieldValue.Substring(0, 1) == "#") 552 { 553 isColor = true; 554 } 555 556 if (!isColor) 557 { 558 if (isLink) 559 { 560 string linktTitle = !fieldValue.Contains("aspx") ? fieldValue : Translate("Go to link"); 561 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && fieldValue.Contains("http") ? "target=\"_blank\"" : string.Empty; 562 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && fieldValue.Contains("http") ? "rel=\"noopener\"" : string.Empty; 563 564 <a href="@field.Value" title="@field.Name" @target @rel>@linktTitle</a> 565 } 566 else if (isBrandName) 567 { 568 <span itemprop="brand" itemtype="https://schema.org/Brand" itemscope> 569 <span itemprop="name">@fieldValue</span> 570 </span> 571 } 572 else 573 { 574 //CUSTOM 575 if (!new string[] { "ProductNumber", "ProductEAN" }.Contains(field.SystemName)) 576 { 577 @Translate("Custom:FacetOption." + fieldValue, fieldValue) 578 } 579 else 580 { 581 @fieldValue 582 } 583 //--CUSTOM 584 } 585 } 586 else 587 { 588 <span class="colorbox-sm" style="background-color: @fieldValue" title="@fieldValue"></span> 589 } 590 } 591 } 592

EXPLORE OTHER PRODUCTS