Produkter

16 produkter

Sortering

Stand

Pris (Inkl. moms)

Farve

Materiale overflade

Mærke

Produkttype

Mål L cm

Error executing template "Designs/Swift/Paragraph/Swift_ProductListGridView_Custom.cshtml"
System.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 157) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
   at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
   at System.Data.SqlClient.SqlDataReader.Read()
   at Dynamicweb.Ecommerce.Products.ProductRepository.GetAllProductKeys(String productLanguageId)
   at Dynamicweb.Ecommerce.Orders.Discounts.Discount.ProcessProductSelections(HashSet`1& productKeys, HashSet`1& includedQueries, HashSet`1& excludedQueries)
   at Dynamicweb.Ecommerce.Orders.Discounts.Discount.GetRelevantProductKeys()
   at Dynamicweb.Ecommerce.Orders.Discounts.DiscountService.StatelessSetLookup(Discount discount, ConcurrentDictionary`2 lookup)
   at Dynamicweb.Ecommerce.Orders.Discounts.DiscountService.InitializeLookup()
   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 Dynamicweb.Ecommerce.Orders.Discounts.DiscountService.GetDiscounts(DiscountApplyType[] discountTypes, String[] productKeys, User user)
   at Dynamicweb.Ecommerce.Orders.Discounts.DiscountInfoCollection.LoadDiscounts()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.GetDiscountInfo(PriceViewModelSettings settings, Product product)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__37()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__42()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_65a4c4ca84e74d6ea5778f3b2a882717.<RenderProductList>b__0_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\Jkoffice.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\Paragraph\Swift_ProductListGridView_Custom.cshtml:line 166
   at CompiledRazorTemplates.Dynamic.RazorEngine_65a4c4ca84e74d6ea5778f3b2a882717.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\Jkoffice.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\Paragraph\Swift_ProductListGridView_Custom.cshtml:line 16
   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()
ClientConnectionId:81f35474-2381-4b54-afb3-a35b5415ba37
Error Number:1205,State:52,Class:13

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Ecommerce.CustomerExperienceCenter.Favorites 4 @using System.IO 5 @using Dynamicweb.Environment 6 7 @{ 8 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 9 string themePadding = theme != string.Empty ? "p-3" : string.Empty; 10 11 } 12 13 @if (!string.IsNullOrEmpty(theme)) 14 { 15 <div class="h-100@(theme) @themePadding"> 16 @RenderProductList() 17 </div> 18 } 19 else 20 { 21 <div class="pt-3"> 22 @RenderProductList() 23 </div> 24 } 25 26 @helper RenderProductList() 27 { 28 29 ProductListViewModel productList = new ProductListViewModel(); 30 31 if (Dynamicweb.Context.Current.Items.Contains("ProductList")) 32 { 33 productList = (ProductListViewModel)Dynamicweb.Context.Current.Items["ProductList"]; 34 } 35 36 string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); 37 //bool isAnonymousB2BUser = System.Web.HttpContext.Current.Request.Cookies["userType"] != null ? System.Web.HttpContext.Current.Request.Cookies["userType"].Value == "B2B" : false; 38 bool isB2BUser = CustomCode.CustomUserHelpers.IsB2BUser(); 39 bool anonymousUser = Pageview.User == null; 40 bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; 41 42 string detailsPageLink = Dynamicweb.Context.Current.Items["DetailsPageLink"] != null ? Dynamicweb.Context.Current.Items["DetailsPageLink"].ToString() : ""; 43 string productTheme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("ProductTheme")) ? " theme " + Model.Item.GetRawValueString("ProductTheme").Replace(" ", "").Trim().ToLower() : ""; 44 string productThemePadding = productTheme != string.Empty ? "p-3" : string.Empty; 45 46 string url = Dynamicweb.Context.Current.Request.RawUrl; 47 bool hideFavoritesSelector = !string.IsNullOrEmpty(Model.Item.GetString("HideFavoritesSelector")) ? Model.Item.GetBoolean("HideFavoritesSelector") : false; 48 string staticVariantsLayout = Model.Item.GetRawValueString("StaticVariantsLayout", "hide"); 49 50 string groupId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("GroupID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("GroupID") : ""; 51 52 var badgeParms = new Dictionary<string, object>(); 53 badgeParms.Add("saleBadgeType", Model.Item.GetRawValue("SaleBadgeType")); 54 badgeParms.Add("saleBadgeCssClassName", Model.Item.GetRawValue("SaleBadgeDesign")); 55 badgeParms.Add("newBadgeCssClassName", Model.Item.GetRawValue("NewBadgeDesign")); 56 badgeParms.Add("newPublicationDays", Model.Item.GetInt32("NewPublicationDays")); 57 badgeParms.Add("campaignBadgesValues", Model.Item.GetRawValueString("CampaignBadges")); 58 59 bool saleBadgeEnabled = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("SaleBadgeDesign")) && Model.Item.GetRawValueString("SaleBadgeDesign") != "none" ? true : false; 60 bool newBadgeEnabled = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("NewBadgeDesign")) && Model.Item.GetRawValueString("NewBadgeDesign") != "none" ? true : false; 61 62 string googleAnalyticsTrackingID = Pageview.AreaSettings.GetString("GoogleAnalyticsTrackingID"); 63 string googleAnalyticsMeasurementID = Pageview.AreaSettings.GetString("GoogleAnalyticsMeasurementID"); 64 var cookieOptInLevel = CookieManager.GetCookieOptInLevel(); 65 bool allowTracking = cookieOptInLevel == CookieOptInLevel.All || (cookieOptInLevel == CookieOptInLevel.Functional && CookieManager.GetCookieOptInCategories().Contains("Statistical")); 66 67 var favoriteParameters = new Dictionary<string, object>(); 68 if (!anonymousUser && !hideFavoritesSelector) 69 { 70 int defaultFavoriteListId = 0; 71 72 IEnumerable<FavoriteList> favoreiteLists = Pageview.User.GetFavoriteLists(); 73 if (favoreiteLists.Count() == 1) 74 { 75 foreach (FavoriteList list in favoreiteLists) 76 { 77 defaultFavoriteListId = list.ListId; 78 } 79 } 80 81 favoriteParameters.Add("ListId", defaultFavoriteListId); 82 } 83 84 if (productList.TotalProductsCount > 0) 85 { 86 int pageSizeSetting = 30; 87 int pageSize = productList.PageSize; 88 pageSize += pageSizeSetting; 89 90 int loadedProducts = productList.PageSize > productList.TotalProductsCount ? productList.TotalProductsCount : productList.PageSize; 91 92 <div class="grid grid-1 grid-lg-3"> 93 94 @if (!string.IsNullOrWhiteSpace(googleAnalyticsMeasurementID) && allowTracking) 95 { 96 <script> 97 gtag("event", "view_item_list", { 98 item_list_id: "product_list_gridview", 99 item_list_name: "Product list (Gridview)", 100 items: [ 101 @foreach (ProductViewModel product in productList.Products) 102 { 103 <text>{ 104 item_id: "@product.Number", 105 item_name: "@product.Name", 106 currency: "@product.Price.CurrencyCode", 107 price: @product.Price.PriceWithVat.ToString(System.Globalization.CultureInfo.InvariantCulture) 108 },</text> 109 } 110 ] 111 }); 112 </script> 113 } 114 115 116 @foreach (ProductViewModel product in productList.Products) 117 { 118 string link = "Default.aspx?ID=" + GetPageIdByNavigationTag("Shop"); 119 link += $"&GroupID={product.PrimaryOrDefaultGroup.Id}"; 120 link += $"&ProductID={product.Id}"; 121 link += !string.IsNullOrEmpty(product.VariantId) ? $"&VariantID={product.VariantId}" : ""; 122 link = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(link); 123 124 string imageTheme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("ImageTheme")) ? " theme " + Model.Item.GetRawValueString("ImageTheme").Replace(" ", "").Trim().ToLower() : ""; 125 string imageThemePadding = imageTheme != string.Empty ? "p-3" : string.Empty; 126 string imageOutlineStyle = imageTheme == string.Empty ? "style=\"border: 1px solid transparent\"" : string.Empty; 127 128 string imageId = "ProductImage_" + product.Id + product.VariantId; 129 string priceId = "ProductPrice_" + product.Id + product.VariantId; 130 131 string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); 132 bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); 133 134 @* Alternative image *@ 135 string defaultImage = CustomCode.ImageHelper.GetImagePath(product); 136 var alternativeImagesList = CustomCode.ImageHelper.GetAssetsList(product); 137 138 if (alternativeImagesList.FirstOrDefault() != null) 139 { 140 alternativeImagesList = alternativeImagesList.OrderByDescending(x => x.Value.Equals(defaultImage)).ToList(); 141 142 defaultImage = alternativeImagesList.First().Value; 143 144 if (alternativeImagesList.First().Value == defaultImage) 145 { 146 alternativeImagesList = alternativeImagesList.Skip(1).ToList(); 147 } 148 } 149 150 var imagePath = Dynamicweb.Context.Current.Server.UrlEncode(defaultImage); 151 152 string ratio = Model.Item.GetRawValueString("ImageAspectRatio", ""); 153 ratio = ratio != "0" ? ratio : ""; 154 string ratioCssClass = ratio != "" ? " ratio" : ""; 155 string ratioVariable = ratio != "" ? "--bs-aspect-ratio: " + ratio : ""; 156 157 string imagePathXs = "/Admin/Public/GetImage.ashx?width=" + 480 + "&image=" + imagePath + "&format=webp"; 158 string imagePathS = "/Admin/Public/GetImage.ashx?width=" + 640 + "&image=" + imagePath + "&format=webp"; 159 string imagePathFallBack = "/Admin/Public/GetImage.ashx?width=" + 640 + "&image=" + imagePath + "&format=webp"; 160 161 string alternativeImage = alternativeImagesList.FirstOrDefault() != null ? alternativeImagesList.FirstOrDefault().Value : ""; 162 alternativeImage = !string.IsNullOrEmpty(alternativeImage) ? "/Admin/Public/GetImage.ashx?width=" + 640 + "&image=" + alternativeImage + "&format=webp" : ""; 163 164 @* Badges *@ 165 DateTime createdDate = product.Created.Value; 166 bool showBadges = saleBadgeEnabled && product.Discount.Price != 0 ? true : false; 167 showBadges = (newBadgeEnabled && Model.Item.GetInt32("NewPublicationDays") == 0) || (newBadgeEnabled && (createdDate.AddDays(Model.Item.GetInt32("NewPublicationDays")) > DateTime.Now)) ? true : showBadges; 168 showBadges = !string.IsNullOrEmpty(Model.Item.GetRawValueString("CampaignBadges")) ? true : showBadges; 169 170 @* Main features *@ 171 IEnumerable<string> selectedDisplayGroups = Model.Item.GetRawValueString("MainFeatures").Split(',').ToList(); 172 List<CategoryFieldViewModel> mainFeatures = new List<CategoryFieldViewModel>(); 173 174 foreach (var selection in selectedDisplayGroups) 175 { 176 foreach (CategoryFieldViewModel group in product.FieldDisplayGroups.Values) 177 { 178 if (selection == group.Id) 179 { 180 mainFeatures.Add(group); 181 } 182 } 183 } 184 185 <article class="position-relative@(productTheme) product-list-item" itemscope itemtype="https://schema.org/Product"> 186 @if (!anonymousUser && !hideFavoritesSelector && product.VariantInfo.VariantInfo == null) 187 { 188 <div class="position-absolute top-0 end-0 my-3" style="z-index: 2"> 189 @RenderPartial("Components/ToggleFavorite.cshtml", product, favoriteParameters) 190 </div> 191 } 192 193 @if (showBadges) 194 { 195 <div class="position-absolute top-0 left-0 p-1 p-lg-2 ps-0 ps-lg-0" style="z-index: 2"> 196 @RenderPartial("Components/EcommerceBadge.cshtml", product, badgeParms) 197 </div> 198 } 199 200 <a href="@link" class="d-flex flex-column d-block h-100 text-decoration-none"> 201 <div class="overflow-hidden@(imageTheme)" @imageOutlineStyle> 202 <div class="ratio" style="@(ratioVariable)"> 203 <div class="d-flex justify-content-center align-items-center"> 204 @if (string.IsNullOrEmpty(alternativeImage)) 205 { 206 <img id="@imageId" 207 srcset=" 208 @imagePathXs 480w, 209 @imagePathS 640w" 210 sizes="(min-width: 992px) 33vw, 50vw" 211 src="@imagePathFallBack" 212 loading="lazy" 213 decoding="async" 214 class="mw-100 mh-100 @imageThemePadding" 215 alt="@product.Name"> 216 } 217 else 218 { 219 <img id="@imageId" 220 src="@imagePathFallBack" 221 loading="lazy" 222 decoding="async" 223 class="mw-100 mh-100 @imageThemePadding" 224 alt="@product.Name" 225 onmouseover="this.src='@alternativeImage'" 226 onmouseout="this.src='@imagePathFallBack'"> 227 } 228 </div> 229 </div> 230 231 232 <div class="position-relative"> 233 @{ 234 var partslist_Display_Group = product.ProductFields.Values.FirstOrDefault(x => x.SystemName == "Partslist_Display_Group").Value.ToString(); 235 } 236 @if ((product.VariantInfo.VariantInfo != null || partslist_Display_Group == "Variant_attributes") && staticVariantsLayout == "images") 237 { 238 239 var productVariantTheme = productTheme != "" ? productTheme : "bg-white"; 240 241 <div class="static-variants w-100 d-none d-lg-block position-absolute left-0 bottom-0 @productTheme" style="pointer-events: none;"> 242 <div class="d-flex gap-2 mb-2"> 243 <article title="@product.Name" style="pointer-events: initial;"> 244 <div class="d-flex align-items-center justify-content-center"> 245 <h5>@Translate("More variants")</h5> 246 </div> 247 </article> 248 </div> 249 </div> 250 } 251 </div> 252 </div> 253 <div class="@productThemePadding"> 254 <div class="flex-grow-1"> 255 <div class=""> 256 @if (product.NeverOutOfstock && product.StockLevel <= 0 && !product.VariantGroups().Any()) 257 { 258 var productDB = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, product.VariantId, false); 259 var productState = productDB.GetCategoryValue("ImportedNAVItemAttributes", "ImportedNAVItemAttributes_1")?.ToString(); 260 var deliveryTime = productDB.ProductFieldValues.GetProductFieldValue("DeliveryTime").Value.ToString(); 261 262 <div> 263 @RenderIcon("/Files/Templates/Designs/Swift/Assets/icons/check-circle.svg", "icon-2 text-success fw-bold") 264 <span class="fs-7 opacity-85 mb-2"> 265 @(deliveryTime != "0" ? @Translate("[] days").Replace("[]", deliveryTime) : "") 266 </span> 267 </div> 268 } 269 else if (product.StockLevel > 0 && !product.VariantGroups().Any()) 270 { 271 string defaultUnitID = product.DefaultUnitId; 272 var variantService = new Dynamicweb.Ecommerce.VariantOptionService(); 273 string productLanguageID = product.LanguageId; 274 var defaultUnit = variantService.GetVariantOption(defaultUnitID, productLanguageID); 275 string defaultUnitName = defaultUnit.Name; 276 277 <div> 278 @RenderIcon("/Files/Templates/Designs/Swift/Assets/icons/check-circle.svg", "icon-2 text-success fw-bold") 279 <span class="fs-7 opacity-85 mb-2">@product.StockLevel @Translate(defaultUnitName)</span> 280 </div> 281 } 282 else if (product.VariantGroups().Any()) 283 { 284 285 <div> 286 @RenderIcon("/Files/Templates/Designs/Swift/Assets/icons/check-circle.svg", "icon-2 text-success fw-bold") 287 </div> 288 } 289 else 290 { 291 292 var productDB = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, product.VariantId, false); 293 var productState = productDB.GetCategoryValue("ImportedNAVItemAttributes", "ImportedNAVItemAttributes_1")?.ToString(); 294 var deliveryTime = productDB.ProductFieldValues.GetProductFieldValue("DeliveryTime").Value.ToString(); 295 296 <div> 297 @if (productState != null && productState == "3") 298 { 299 @RenderIcon("/Files/Templates/Designs/Swift/Assets/icons/check-circle.svg", "icon-2 text-success fw-bold") 300 301 } 302 else 303 { 304 305 @RenderIcon("/Files/Templates/Designs/Swift/Assets/icons/minus-circle.svg", "icon-2 text-danger fw-bolder") 306 } 307 @(!string.IsNullOrEmpty(deliveryTime) && deliveryTime != "0" ? @Translate("[] days").Replace("[]", deliveryTime) : "") 308 </div> 309 } 310 </div> 311 <h3 class="h6 mb-0 text-break"> 312 @product.Name 313 </h3> 314 @if (!Model.Item.GetBoolean("HideProductNumber")) 315 { 316 <p class="fs-7 opacity-85 mb-2">@product.Number</p> 317 } 318 @if (mainFeatures.Count > 0) 319 { 320 <ul class="p-0 lh-sm opacity-75" style="list-style-position: inside"> 321 @foreach (CategoryFieldViewModel mainFeatureGroup in mainFeatures) 322 { 323 foreach (var field in mainFeatureGroup.Fields) 324 { 325 @RenderField(field.Value) 326 } 327 } 328 </ul> 329 } 330 </div> 331 332 @if (!hidePrice) 333 { 334 string priceMin = ""; 335 string priceMax = ""; 336 337 <div> 338 <div> 339 <span itemprop="priceCurrency" content="@product.Price.CurrencyCode" class="d-none"></span> 340 341 @if (showPricesWithVat == "false" && !neverShowVat) 342 { 343 string beforePrice = isB2BUser ? product.PriceBeforeDiscount.PriceWithoutVatFormatted : product.PriceBeforeDiscount.PriceWithVatFormatted; 344 345 <span itemprop="price" content="@product.Price.PriceWithoutVat" class="d-none"></span> 346 if (product.Price.Price != product.PriceBeforeDiscount.Price) 347 { 348 <span class="text-decoration-line-through opacity-75 me-3 text-price">@beforePrice</span> 349 } 350 } 351 else 352 { 353 string beforePrice = product.PriceBeforeDiscount.PriceFormatted; 354 355 <span itemprop="price" content="@product.Price.Price" class="d-none"></span> 356 if (product.Price.Price != product.PriceBeforeDiscount.Price) 357 { 358 <span class="text-decoration-line-through opacity-75 me-3 text-price">@beforePrice</span> 359 } 360 } 361 @if (isB2BUser) 362 { 363 <div> 364 @{ FieldValueViewModel rentalPrice = new FieldValueViewModel(); 365 if (product.ProductFields.TryGetValue("ProductRentalPrice", out rentalPrice)) 366 { 367 if (rentalPrice.Value?.ToString() != "0") 368 { 369 <span>@Translate("Rental Price:") @(rentalPrice.Value?.ToString()) @Dynamicweb.Ecommerce.Common.Context.Currency.Symbol</span> 370 } 371 } 372 } 373 </div> 374 } 375 376 @if (showPricesWithVat == "false" && !neverShowVat) 377 { 378 string price = ""; 379 if (isB2BUser) 380 { 381 price = product.Price.PriceFormatted; 382 if (product?.VariantInfo?.VariantInfo != null) 383 { 384 priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted != null ? product.VariantInfo.PriceMin.PriceFormatted : ""; 385 priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted != null ? product.VariantInfo.PriceMax.PriceFormatted : ""; 386 } 387 if (priceMin != priceMax) 388 { 389 price = priceMin + " - " + priceMax; 390 } 391 } 392 393 else 394 { 395 price = product.Price.PriceWithVatFormatted; 396 if (product?.VariantInfo?.VariantInfo != null) 397 { 398 priceMin = product?.VariantInfo?.PriceMin?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithVatFormatted : ""; 399 priceMax = product?.VariantInfo?.PriceMax?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithVatFormatted : ""; 400 } 401 if (priceMin != priceMax) 402 { 403 price = priceMin + " - " + priceMax; 404 } 405 406 } 407 408 409 410 <span class="text-price fw-bold fs-5">@price <small class="fs-8 fw-normal">(@(isB2BUser ? Translate("Excl. VAT") : Translate("Incl. VAT")))</small></span> 411 } 412 else 413 { 414 string price = product.Price.PriceFormatted; 415 if (product?.VariantInfo?.VariantInfo != null) 416 { 417 priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted != null ? product.VariantInfo.PriceMin.PriceFormatted : ""; 418 priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted != null ? product.VariantInfo.PriceMax.PriceFormatted : ""; 419 } 420 if (priceMin != priceMax) 421 { 422 price = priceMin + " - " + priceMax; 423 } 424 <span class="text-price">@price</span> 425 @* 04/07/2022 commented out - because of this task 112135 - only need to be shown if its b2b of any kind 426 if (!anonymousUser) 427 { 428 FieldValueViewModel rentalPrice = new FieldValueViewModel(); 429 if (product.ProductFields.TryGetValue("ProductRentalPrice", out rentalPrice)) 430 { 431 var rentalprice = new Dynamicweb.Ecommerce.Prices.PriceInfo { PriceWithoutVAT = Convert.ToDouble(rentalPrice.Value) }.PriceWithoutVATFormatted; 432 433 <span class="rental-price">@Translate("Rental Price:") @rentalprice</span> 434 } 435 } 436 *@ 437 438 } 439 </div> 440 @*@if (showPricesWithVat == "false" && !neverShowVat) 441 { 442 string price = product.Price.PriceWithVatFormatted; 443 if (product?.VariantInfo?.VariantInfo != null) 444 { 445 priceMin = product?.VariantInfo?.PriceMin?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithVatFormatted : ""; 446 priceMax = product?.VariantInfo?.PriceMax?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithVatFormatted : ""; 447 } 448 if (priceMin != priceMax) 449 { 450 price = priceMin + " - " + priceMax; 451 } 452 <div class="fs-7 opacity-85 text-price">@price @Translate("Incl. VAT")</div> 453 }*@ 454 </div> 455 } 456 457 @if (product.VariantInfo.VariantInfo != null && staticVariantsLayout == "swatches") 458 { 459 var optionCount = product.VariantInfo.VariantInfo.Count(); 460 var showMaxVariants = 5; 461 462 <div class="d-flex flex-row gap-1 align-items-center"> 463 @foreach (VariantInfoViewModel variant in product.VariantInfo.VariantInfo.Take(showMaxVariants)) 464 { 465 <span class="colorbox colorbox-sm rounded-circle me-1" style="background-color: @variant.OptionColor"></span> 466 } 467 @if (optionCount > showMaxVariants) 468 { 469 int left = optionCount - showMaxVariants; 470 <span class="ms-2">+@left</span> 471 } 472 </div> 473 } 474 </div> 475 </a> 476 </article> 477 } 478 </div> 479 480 <div class="my-3"> 481 <div class="text-center d-flex flex-column gap-3"> 482 <div class="opacity-85">@loadedProducts @Translate("out of") @productList.TotalProductsCount @Translate("products")</div> 483 @if (productList.PageCount != 1) 484 { 485 string sortBySelection = Dynamicweb.Context.Current.Request?.Form["SortBy"] ?? ""; 486 sortBySelection = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("SortBy")) ? Dynamicweb.Context.Current.Request.QueryString.Get("SortBy") : sortBySelection; 487 488 string searchQuery = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("q")) ? Dynamicweb.Context.Current.Request.QueryString.Get("q") : ""; 489 string searchLayout = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("SearchLayout")) ? Dynamicweb.Context.Current.Request.QueryString.Get("SearchLayout") : ""; 490 491 <form method="get" action="@url" data-response-target-element="content" class="w-100"> 492 @foreach (FacetGroupViewModel facetGroup in productList.FacetGroups) 493 { 494 foreach (FacetViewModel facetItem in facetGroup.Facets) 495 { 496 foreach (FacetOptionViewModel facetOption in facetItem.Options) 497 { 498 if (facetOption.Selected) 499 { 500 <input type="hidden" name="@facetItem.QueryParameter" value="[@facetOption.Value]" /> 501 } 502 } 503 } 504 } 505 506 @if (productList?.Group?.Id != null) 507 { 508 <input type="hidden" name="GroupId" value="@productList.Group.Id" /> 509 } 510 511 <input type="hidden" name="PageSize" value="@pageSize" /> 512 <input type="hidden" name="SortBy" value="@sortBySelection" /> 513 <input type="hidden" name="RequestType" value="UpdateList" /> 514 515 @if (!string.IsNullOrEmpty(searchQuery)) 516 { 517 <input type="hidden" name="q" value="@searchQuery"> 518 <input type="hidden" name="SearchLayout" value="@searchLayout"> 519 } 520 521 @{ 522 string nextPageLink = "/Default.aspx?ID=" + Pageview.Page.ID + "&PageSize=" + pageSize + "&SortBy=" + sortBySelection; 523 524 foreach (FacetGroupViewModel facetGroup in productList.FacetGroups) 525 { 526 foreach (FacetViewModel facetItem in facetGroup.Facets) 527 { 528 foreach (FacetOptionViewModel facetOption in facetItem.Options) 529 { 530 if (facetOption.Selected) 531 { 532 nextPageLink += "&" + facetItem.QueryParameter + "=[" + facetOption.Value + "]"; 533 } 534 } 535 } 536 } 537 538 nextPageLink += !string.IsNullOrEmpty(searchQuery) ? "&q=" + searchQuery : ""; 539 } 540 541 <a href="@nextPageLink" class="btn btn-primary" onclick="swift.ProductList.Update(event)" id="LoadMoreButton_@Model.ID">@Translate("Load more products")</a> 542 </form> 543 } 544 </div> 545 </div> 546 547 <script> 548 function switchVariantProduct(id, price, imagesrc) { 549 var productImageElement = document.querySelector("#ProductImage_" + id); 550 var productPriceElement = document.querySelector("#ProductPrice_" + id + " .text-price"); 551 552 if (productPriceElement) { 553 productPriceElement.innerText = price; 554 } 555 556 if (productImageElement) { 557 productImageElement.src = imagesrc; 558 559 var imageSrcset = productImageElement.srcset; 560 imageSrcset = imageSrcset.replace(/image=.*?&/g, 'image=' + imagesrc + "&"); 561 562 productImageElement.srcset = imageSrcset; 563 } 564 } 565 </script> 566 } 567 else 568 { 569 if (!Pageview.IsVisualEditorMode) 570 { 571 <div class="alert alert-dark m-0"> 572 @Translate("We did not find anything matching your search result") 573 </div> 574 } 575 else 576 { 577 <div class="alert alert-dark m-0" role="alert"> 578 <span>@Translate("Product list: The list will be shown here, if any")</span> 579 </div> 580 } 581 } 582 } 583 584 @helper RenderField(FieldValueViewModel field) 585 { 586 string fieldValue = field?.Value != null ? field.Value.ToString() : ""; 587 588 if (fieldValue != "") 589 { 590 fieldValue = fieldValue == "False" ? Translate("No") : fieldValue; 591 fieldValue = fieldValue == "True" ? Translate("Yes") : fieldValue; 592 593 if (field.Value.GetType() == typeof(System.Collections.Generic.List<FieldOptionValueViewModel>)) 594 { 595 fieldValue = ""; 596 597 foreach (FieldOptionValueViewModel option in field.Value as System.Collections.Generic.List<FieldOptionValueViewModel>) 598 { 599 fieldValue = option.Name; 600 } 601 } 602 603 bool isColor = false; 604 if (fieldValue.Contains("#") && (Translate(field.Name) == Translate("Color") || Translate(field.Name) == Translate("Colour"))) 605 { 606 isColor = true; 607 } 608 609 if (!string.IsNullOrEmpty(fieldValue)) 610 { 611 if (!isColor) 612 { 613 <li>@(field.Name): @fieldValue</li> 614 } 615 else 616 { 617 <li class="position-relative"> 618 <span class="colorbox-sm" style="background-color: @fieldValue"></span> 619 </li> 620 } 621 } 622 } 623 } 624 625 @helper RenderIcon(string icon, string iconSize) 626 { 627 if (Path.GetExtension(icon).ToLower() == ".svg" && !icon.ToLower().Contains("none")) 628 { 629 string iconPath = Dynamicweb.Context.Current.Server.MapPath(icon); 630 631 <span class="@iconSize"> 632 @ReadFile(iconPath) 633 </span> 634 } 635 } 636
Ved at klikke 'Acceptér Alle' så giver til tiladelse til at vi må indsamle information om dig til forskellige formål, hvilket inkluderer: Funktionalitet, Statestik og Marketing