Error executing template "Designs/Swift/eCom/ProductCatalog/ProductViewDetail.cshtml" System.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 92) 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.Dynamicweb.Ecommerce.Products.IProductRepository.GetProductKeysByGroupId(String groupId, Boolean useOrderBy, Boolean includeVariants, String productLanguageId, Boolean doRefactoring, Boolean useAssortments) 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() at System.Lazy`1.LazyInitValue() at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__46() 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.ProductCatalog.ViewEngine.GetPrice(PriceViewModelSettings settings, IList`1 products, Boolean& pricesHasBeenPrepared, Object lock, Lazy`1 priceInfo) at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__51() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at CompiledRazorTemplates.Dynamic.RazorEngine_103cbe4da3d841759e127915f11802c7.Execute() in D:\dynamicweb.net\Solutions\brdklee.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\Swift_ProductDetailsImage.cshtml:line 185 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:0ef709ef-766e-4142-a380-dcd6da8ac281 Error Number:1205,State:52,Class:13
1 @inherits ViewModelTemplate<ProductViewModel> 2 @using Dynamicweb.Rendering 3 @using Dynamicweb.Ecommerce.ProductCatalog 4 @using Dynamicweb.Core 5 6 @{ 7 string metaDescription = string.IsNullOrEmpty(Model.MetaDescription) ? Model.Name : Model.MetaDescription; 8 9 Pageview.Meta.AddTag($"<meta property=\"og:image\" content=\"{Dynamicweb.Context.Current.Request.Url.Scheme}://{Dynamicweb.Context.Current.Request.Url.Host}{Model.DefaultImage.Value}\">"); 10 Pageview.Meta.AddTag($"<meta property=\"og:image:alt\" content=\"{Model.Name}\">"); 11 Pageview.Meta.AddTag($"<meta property=\"og:description\" content=\"{metaDescription}\">"); 12 13 Pageview.Meta.AddTag("twitter:image", Model.DefaultImage.Value); 14 Pageview.Meta.AddTag("twitter:image:alt", Model.Name); 15 Pageview.Meta.AddTag("twitter:description", metaDescription); 16 } 17 18 @{ 19 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 20 { 21 Dynamicweb.Context.Current.Items["ProductDetails"] = Model; 22 } 23 else 24 { 25 Dynamicweb.Context.Current.Items.Add("ProductDetails", Model); 26 } 27 28 bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); 29 if (isLazyLoadingForProductInfoEnabled) 30 { 31 string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); 32 bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); 33 bool hasVariantId = !string.IsNullOrEmpty(Model.VariantId); 34 string variantIdParam = hasVariantId ? $"/{Model.VariantId}" : ""; 35 string priceFilledProperties = $"Price,PriceFormatted{(showPricesWithVat == "false" && !neverShowVat ? ",PriceWithVat,PriceWithVatFormatted" : "")}"; 36 string productInfoFeed = $@"/dwapi/ecommerce/products/{Model.Id}{variantIdParam} 37 ?UserId={Converter.ToString(Pageview.User?.ID)} 38 &LanguageId={Pageview.Area.EcomLanguageId}&CurrencyCode={Pageview.Area.EcomCurrencyId}&CountryCode={Pageview.Area.EcomCountryCode}&ShopId={Pageview.Area.EcomShopId} 39 &FilledProperties=Id,Price,PriceBeforeDiscount,StockLevel,VariantInfo,NeverOutOfstock,Prices 40 &PriceSettings.ShowPricesWithVat={Pageview.Area.EcomPricesWithVat} 41 &PriceSettings.FilledProperties={priceFilledProperties} 42 &getproductinfo=true"; 43 Dynamicweb.Context.Current.Items["ProductInfoFeed"] = productInfoFeed; 44 45 <script type="module"> 46 swift.LiveProductInfo.init(); 47 </script> 48 } 49 } 50 51 <script> 52 gtag("event", "view_item", { 53 currency: "@Model.Price.CurrencyCode", 54 value: @Model.Price.ToStringInvariant(), 55 items: [ 56 { 57 item_id: "@Model.Number", 58 item_name: "@Dynamicweb.Core.Encoders.HtmlEncoder.JavaScriptStringEncode(Model.Name)", 59 currency: "@Model.Price.CurrencyCode", 60 price: @Model.Price.ToStringInvariant(), 61 discount: @Model.Discount.ToStringInvariant() 62 } 63 ] 64 }); 65 </script> 66 67 <script> 68 window.addEventListener('load', function (event) { 69 swift.Video.init(); 70 }); 71 </script> 72
191CSS50013
KLEE Rustfast Kabelstrips AISI 316 Type CSS50013
- 520 x 12mm pose á 100 stk.
Ikke på lager
Error executing template "/Designs/Swift/Paragraph/Swift_ProductPrice_Custom.cshtml" System.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 92) 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.Dynamicweb.Ecommerce.Products.IProductRepository.GetProductKeysByGroupId(String groupId, Boolean useOrderBy, Boolean includeVariants, String productLanguageId, Boolean doRefactoring, Boolean useAssortments) 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() at System.Lazy`1.LazyInitValue() at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.GetPrice(PriceViewModelSettings settings, IList`1 products, Boolean& pricesHasBeenPrepared, Object lock, Lazy`1 priceInfo) at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__49() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__46() 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.LazyInitValue() 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__48() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at System.Lazy`1.LazyInitValue() at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__46() at System.Lazy`1.CreateValue() at CompiledRazorTemplates.Dynamic.RazorEngine_01f979d9ffd7494c9c529d27ceeb08cf.Execute() in D:\dynamicweb.net\Solutions\brdklee.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewDetail.cshtml:line 53 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 System.Lazy`1.CreateValue() at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) at System.Lazy`1.LazyInitValue() at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.GetPrice(PriceViewModelSettings settings, IList`1 products, Boolean& pricesHasBeenPrepared, Object lock, Lazy`1 priceInfo) at System.Lazy`1.LazyInitValue() at System.Lazy`1.CreateValue() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at CompiledRazorTemplates.Dynamic.RazorEngine_01f979d9ffd7494c9c529d27ceeb08cf.Execute() in D:\dynamicweb.net\Solutions\brdklee.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewDetail.cshtml:line 53 at System.Lazy`1.CreateValue() 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 Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.GetPrice(PriceViewModelSettings settings, IList`1 products, Boolean& pricesHasBeenPrepared, Object lock, Lazy`1 priceInfo) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__49() at System.Lazy`1.CreateValue() at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) at Dynamicweb.Rendering.Template.RenderRazorTemplate() --- 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_8247cce976b842d69b870918cbd58c54.Execute() in D:\dynamicweb.net\Solutions\brdklee.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\Swift_ProductPrice_Custom.cshtml:line 107 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:0ef709ef-766e-4142-a380-dcd6da8ac281 Error Number:1205,State:52,Class:13
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog; 3 @using System.Linq; 4 @using Dynamicweb.Environment; 5 @using Dynamicweb.Core; 6 @using CustomCode.Models; 7 @using CustomCode.Helpers; 8 9 @{ 10 ProductViewModel product = null; 11 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 12 { 13 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 14 } 15 else if (Pageview.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) 16 { 17 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 18 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 19 20 if (productList?.Products is object) 21 { 22 product = productList.Products[0]; 23 } 24 } 25 string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); 26 bool anonymousUser = Pageview.User == null; 27 bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); 28 bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser || Pageview.AreaSettings.GetBoolean("ErpDownHidePrices") && isErpConnectionDown; 29 30 bool productIsDiscontinued = product is object && product.Discontinued; 31 bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); 32 var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; 33 } 34 @if (!hidePrice && product != null && product.Id != null && !isDiscontinued) 35 { 36 bool showInformativePrice = Model.Item.GetBoolean("ShowInformativePrice"); 37 string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : string.Empty; 38 39 string priceFontSize = Model.Item.GetRawValueString("PriceSize", "fs-2"); 40 int priceFontSizeNumber = int.Parse(string.Concat(priceFontSize.Where(Char.IsDigit))); 41 string priceTextFontSize = "fs-" + (priceFontSizeNumber + 2).ToString(); 42 string badgeFontSize = "fs-" + (priceFontSizeNumber > 3 ? priceFontSizeNumber - 2 : 1).ToString(); 43 44 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 45 string layout = Model.Item.GetRawValueString("Layout", "horizontal"); 46 string textAlign = horizontalAlign == "center" ? "text-center" : string.Empty; 47 textAlign = horizontalAlign == "end" ? "text-end" : textAlign; 48 49 horizontalAlign = horizontalAlign == "center" && layout == "horizontal" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" && layout == "horizontal" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "center" && layout == "vertical" ? "align-items-center" : horizontalAlign; 52 horizontalAlign = horizontalAlign == "end" && layout == "vertical" ? "align-items-end" : horizontalAlign; 53 54 string flexDirection = layout == "horizontal" ? string.Empty : "flex-column"; 55 string flexGap = layout == "horizontal" ? "gap-3" : "gap-2"; 56 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? "theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 57 theme = GetViewParameter("theme") != null ? GetViewParameterString("theme") : theme; 58 59 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 60 contentPadding = contentPadding == "none" ? "p-0" : contentPadding; 61 contentPadding = contentPadding == "small" ? "p-1 px-md-2 py-md-1" : contentPadding; 62 contentPadding = contentPadding == "large" ? "p-2 px-md-3 py-md-2" : contentPadding; 63 64 var user = Dynamicweb.Security.UserManagement.User.GetCurrentFrontendUser(); 65 66 string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); 67 bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); 68 69 string priceMin; 70 string priceMax; 71 double minQty = (product.PurchaseMinimumQuantity ?? 1) == 0 ? 1 : (double)product.PurchaseMinimumQuantity; 72 73 string liveInfoClass = ""; 74 string productInfoFeed = ""; 75 76 List<SalesAgreement> salesAgreements = SalesAgreementHelper.GetSalesAgreements(); 77 List<string> ItemNumbers = new List<string>(); 78 bool containsSaleAgreement = false; 79 80 foreach (SalesAgreement salesAgreement in salesAgreements) 81 { 82 foreach (SalesAgreementLine item in salesAgreement.Items) 83 { 84 ItemNumbers.Add(item.ItemNumber); 85 } 86 } 87 if (ItemNumbers.Contains(product.Number)) 88 { 89 containsSaleAgreement = true; 90 } 91 92 bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); 93 if (isLazyLoadingForProductInfoEnabled) 94 { 95 if (Dynamicweb.Context.Current.Items.Contains("ProductInfoFeed")) 96 { 97 productInfoFeed = Dynamicweb.Context.Current.Items["ProductInfoFeed"]?.ToString(); 98 if (!string.IsNullOrEmpty(productInfoFeed)) 99 { 100 productInfoFeed = $"data-product-info-feed=\"{productInfoFeed}\""; 101 } 102 } 103 liveInfoClass = "js-live-info"; 104 } 105 106 <div class="@textAlign @liveInfoClass item_@Model.Item.SystemName.ToLower()" data-product-id="@product.Id" data-variant-id="@product.VariantId" @productInfoFeed> 107 @if (product.Price.Price == 0) 108 { 109 <div class="@priceFontSize m-0 d-flex @flexDirection @flexGap @horizontalAlign @theme justify-content-end" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> 110 <span itemprop="priceCurrency" content="@product.Price.CurrencyCode" class="d-none"></span> 111 <span class="@theme @contentPadding"> 112 <span class="text-price">@Translate("Unknown Price")</span> 113 </span> 114 </div> 115 } 116 else if (containsSaleAgreement == true) 117 { 118 <div class="@priceFontSize m-0 d-flex @flexDirection @flexGap @horizontalAlign @theme justify-content-end" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> 119 <span itemprop="priceCurrency" content="@product.Price.CurrencyCode" class="d-none"></span> 120 <span class="@theme @contentPadding"> 121 <span class="text-price">@Translate("Price for sales agreement")</span> 122 </span> 123 </div> 124 } 125 else 126 { 127 128 if (showInformativePrice && product.PriceInformative.Price != 0) 129 { 130 <div class="opacity-50"> 131 <span>@Translate("RRP") </span> 132 <span class="text-decoration-line-through text-price">@product.PriceInformative.PriceFormatted</span> 133 </div> 134 } 135 136 137 <div class="@priceTextFontSize m-0 d-flex @flexDirection @flexGap @horizontalAlign @theme justify-content-end" itemprop="offers" itemscope itemtype="https://schema.org/Offer"> 138 <span itemprop="priceCurrency" content="@product.Price.CurrencyCode" class="d-none"></span> 139 140 @* Price *@ 141 @if (showPricesWithVat == "false" && !neverShowVat) 142 { 143 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) 144 { 145 <span itemprop="price" content="" class="d-none"></span> 146 <span class="text-decoration-line-through js-text-decoration-line-through opacity-75 me-3 text-price js-text-price d-none" data-show-if="LiveProductInfo.product.Price.Price != LiveProductInfo.product.PriceBeforeDiscount.Price"></span> 147 148 } 149 else 150 { 151 string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceWithoutVatFormatted : product.PriceBeforeDiscount.PriceWithoutVatFormatted; 152 string standardPrice = !string.IsNullOrEmpty(unitId) ? product.PriceInformative.PriceWithoutVatFormatted : product.PriceInformative.PriceWithoutVatFormatted; 153 <span itemprop="price" content="@product.Price.PriceWithoutVat.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)" class="d-none"></span> 154 155 <div class="order-1 @contentPadding"> 156 <div class="PersonalPriceToggle"> 157 <span class="custom-price"> 158 @Translate("Pris per") 1 @Translate("stk.") 159 </span> 160 <span class="custom-price @priceFontSize ">@beforePrice</span> 161 <span class="custom-price">@Translate("ekskl. moms")</span> 162 @if (product.Price.Price == product.PriceBeforeDiscount.Price) 163 { 164 <span class="custom-price">@Translate("Mindstekøb:") @minQty @Translate("stk.")</span> 165 } 166 </div> 167 168 <div class="StandardPriceToggle" hidden> 169 @if (!string.IsNullOrWhiteSpace(standardPrice)) 170 { 171 <span class="custom-price"> 172 @Translate("Pris per") 1 @Translate("stk.") 173 </span> 174 <span class="custom-price @priceFontSize">@standardPrice</span> 175 <span class="custom-price">@Translate("ekskl. moms")</span> 176 if (product.Price.Price == product.PriceBeforeDiscount.Price) 177 { 178 <span class="custom-price">@Translate("Mindstekøb:") @minQty @Translate("stk.")</span> 179 } 180 } 181 else 182 { 183 <div class="@priceFontSize m-0 d-flex @flexDirection @flexGap @horizontalAlign @theme justify-content-end" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> 184 <span itemprop="priceCurrency" content="@product.Price.CurrencyCode" class="d-none"></span> 185 <span class="@theme @contentPadding"> 186 <span class="text-price">@Translate("Unknown Price")</span> 187 </span> 188 </div> 189 } 190 </div> 191 </div> 192 } 193 } 194 else 195 { 196 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) 197 { 198 <span itemprop="price" content="" class="d-none"></span> 199 <span class="text-decoration-line-through js-text-decoration-line-through opacity-75 me-3 text-price js-text-price d-none" data-show-if="LiveProductInfo.product.Price.Price != LiveProductInfo.product.PriceBeforeDiscount.Price"></span> 200 } 201 else 202 { 203 string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceWithVatFormatted : product.PriceBeforeDiscount.PriceWithVatFormatted; 204 string standardPrice = !string.IsNullOrEmpty(unitId) ? product.PriceInformative.PriceWithVatFormatted : product.PriceInformative.PriceWithVatFormatted; 205 <span itemprop="price" content="@product.Price.PriceWithVat.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)" class="d-none"></span> 206 207 <div class="order-1 @contentPadding "> 208 <div class="PersonalPriceToggle"> 209 <span class="custom-price"> 210 @Translate("Pris per") 1 @Translate("stk.") 211 </span> 212 <span class="custom-price @priceFontSize ">@beforePrice</span> 213 <span class="custom-price">@Translate("inkl. moms")</span> 214 @if (product.Price.Price == product.PriceBeforeDiscount.Price) 215 { 216 <span class="custom-price">@Translate("Mindstekøb:") @minQty @Translate("stk.")</span> 217 } 218 </div> 219 220 <div class="StandardPriceToggle" hidden> 221 @if (!string.IsNullOrWhiteSpace(standardPrice)) 222 { 223 <span class="custom-price"> 224 @Translate("Pris per") 1 @Translate("stk.") 225 </span> 226 <span class="custom-price @priceFontSize">@standardPrice</span> 227 <span class="custom-price">@Translate("ekskl. moms")</span> 228 if (product.Price.Price == product.PriceBeforeDiscount.Price) 229 { 230 <span class="custom-price">@Translate("Mindstekøb:") @minQty @Translate("stk.")</span> 231 } 232 } 233 else 234 { 235 <div class="@priceFontSize m-0 d-flex @flexDirection @flexGap @horizontalAlign @theme justify-content-end" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> 236 <span itemprop="priceCurrency" content="@product.Price.CurrencyCode" class="d-none"></span> 237 <span class="@theme @contentPadding"> 238 <span class="text-price">@Translate("Unknown Price")</span> 239 </span> 240 </div> 241 242 } 243 </div> 244 </div> 245 } 246 } 247 248 @* Total price *@ 249 @if (product.Price.Price != product.PriceBeforeDiscount.Price) 250 { 251 if (showPricesWithVat == "false" && !neverShowVat) 252 { 253 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) 254 { 255 <span class="text-price js-text-price"> 256 <span class="spinner-border" role="status"></span> 257 </span> 258 } 259 else 260 { 261 string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithoutVatFormatted : product.Price.PriceWithoutVatFormatted; 262 263 var badgeParms = new Dictionary<string, object>(); 264 badgeParms.Add("saleBadgeType", Model.Item.GetRawValue("SaleBadgeType")); 265 badgeParms.Add("saleBadgeCssClassName", Model.Item.GetRawValue("SaleBadgeDesign")); 266 badgeParms.Add("newBadgeCssClassName", Model.Item.GetRawValue("NewBadgeDesign")); 267 badgeParms.Add("newPublicationDays", Model.Item.GetInt32("NewPublicationDays")); 268 badgeParms.Add("campaignBadgesValues", Model.Item.GetRawValueString("CampaignBadges")); 269 270 if (product?.VariantInfo?.VariantInfo != null) 271 { 272 priceMin = product?.VariantInfo?.PriceMin?.PriceWithoutVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithoutVatFormatted : "0"; 273 priceMax = product?.VariantInfo?.PriceMax?.PriceWithoutVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithoutVatFormatted : "0"; 274 if (priceMin != priceMax) 275 { 276 price = priceMin + " - " + priceMax; 277 } 278 } 279 280 <div class="order-2 @contentPadding DiscountWithBadgeToggle"> 281 @if (layout == "horizontal") 282 { 283 284 <span class="custom-price">@Translate("Rabat")</span> 285 <span class="custom-price @priceFontSize">@RenderPartial("Components/EcommerceBadge_Custom.cshtml", product, badgeParms)</span> 286 } 287 else 288 { 289 <span class="custom-price @priceFontSize">@Translate("Rabat")@RenderPartial("Components/EcommerceBadge_Custom.cshtml", product, badgeParms)</span> 290 } 291 </div> 292 <div class="order-3 @contentPadding TotalPriceToggle"> 293 <span class="custom-price"><br></span> 294 <span class="custom-price @priceFontSize fw-bold"> @price</span> 295 <span class="custom-price">@Translate("ekskl. moms")</span> 296 <span class="custom-price">@Translate("Mindstekøb:") @minQty @Translate("stk.")</span> 297 </div> 298 } 299 } 300 else 301 { 302 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) 303 { 304 <span class="text-price js-text-price"> 305 <span class="spinner-border" role="status"></span> 306 </span> 307 } 308 else 309 { 310 string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithVatFormatted : product.Price.PriceWithVatFormatted; 311 312 var badgeParms = new Dictionary<string, object>(); 313 badgeParms.Add("saleBadgeType", Model.Item.GetRawValue("SaleBadgeType")); 314 badgeParms.Add("saleBadgeCssClassName", Model.Item.GetRawValue("SaleBadgeDesign")); 315 badgeParms.Add("newBadgeCssClassName", Model.Item.GetRawValue("NewBadgeDesign")); 316 badgeParms.Add("newPublicationDays", Model.Item.GetInt32("NewPublicationDays")); 317 badgeParms.Add("campaignBadgesValues", Model.Item.GetRawValueString("CampaignBadges")); 318 319 if (product?.VariantInfo?.VariantInfo != null) 320 { 321 priceMin = product?.VariantInfo?.PriceMin?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithVatFormatted : "0"; 322 priceMax = product?.VariantInfo?.PriceMax?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithVatFormatted : "0"; 323 if (priceMin != priceMax) 324 { 325 price = priceMin + " - " + priceMax; 326 } 327 } 328 329 if (product.Price.Price != product.PriceBeforeDiscount.Price) 330 { 331 <div class="order-2 @contentPadding DiscountWithBadgeToggle"> 332 @if (layout == "horizontal") 333 { 334 335 <span class="custom-price">@Translate("Rabat")</span> 336 <span class="custom-price @priceFontSize">@RenderPartial("Components/EcommerceBadge_Custom.cshtml", product, badgeParms)</span> 337 } 338 else 339 { 340 <span class="custom-price @priceFontSize">@Translate("Rabat")@RenderPartial("Components/EcommerceBadge_Custom.cshtml", product, badgeParms)</span> 341 } 342 </div> 343 } 344 <div class="order-3 @contentPadding TotalPriceToggle"> 345 <span class="custom-price"><br /></span> 346 <span class="custom-price @priceFontSize fw-bolder">@price</span> 347 <span class="custom-price">@Translate("inkl. moms")</span> 348 <span class="custom-price">@Translate("Mindstekøb:") @minQty @Translate("stk.")</span> 349 </div> 350 } 351 } 352 } 353 @*</div>*@ 354 @* Stock state for Schema.org, start *@ 355 @{ 356 Uri url = Dynamicweb.Context.Current.Request.Url; 357 } 358 359 <link itemprop="url" href="@url"> 360 361 @{ 362 bool IsNeverOutOfStock = product.NeverOutOfstock; 363 } 364 365 @if (IsNeverOutOfStock) 366 { 367 <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> 368 } 369 else 370 { 371 if (product.StockLevel > 0) 372 { 373 <span itemprop="availability" class="d-none">InStock</span> 374 } 375 else 376 { 377 <span itemprop="availability" class="d-none">OutOfStock</span> 378 } 379 } 380 @* Stock state for Schema.org, stop *@ 381 382 </div> 383 384 //Outcommented do to not want to show prices including VAT 385 @*if (showPricesWithVat == "false" && !neverShowVat) 386 { 387 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) 388 { 389 <small class="opacity-85 fst-normal js-text-price-with-vat d-none" data-suffix="@Translate("Incl. VAT")"></small> 390 } 391 else 392 { 393 string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithVatFormatted : product.Price.PriceWithVatFormatted; 394 395 if (product?.VariantInfo?.VariantInfo != null) 396 { 397 priceMin = product?.VariantInfo?.PriceMin?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithVatFormatted : ""; 398 priceMax = product?.VariantInfo?.PriceMax?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithVatFormatted : ""; 399 } 400 if (priceMin != priceMax) 401 { 402 price = priceMin + " - " + priceMax; 403 } 404 <small class="opacity-85 fst-normal">@price @Translate("Incl. VAT")</small> 405 } 406 }*@ 407 } 408 </div> 409 } 410 else if (Pageview.IsVisualEditorMode) 411 { 412 <div class="alert alert-dark m-0" role="alert"> 413 <span>@Translate("No products available")</span> 414 </div> 415 } 416
Error executing template "Designs/Swift/Paragraph/Swift_ProductAddToCart.cshtml" System.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 92) 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.Dynamicweb.Ecommerce.Products.IProductRepository.GetProductKeysByGroupId(String groupId, Boolean useOrderBy, Boolean includeVariants, String productLanguageId, Boolean doRefactoring, Boolean useAssortments) 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() at System.Lazy`1.LazyInitValue() at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.GetPrice(PriceViewModelSettings settings, IList`1 products, Boolean& pricesHasBeenPrepared, Object lock, Lazy`1 priceInfo) at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__49() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__46() 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.LazyInitValue() 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__48() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at System.Lazy`1.LazyInitValue() at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__46() at System.Lazy`1.CreateValue() at CompiledRazorTemplates.Dynamic.RazorEngine_01f979d9ffd7494c9c529d27ceeb08cf.Execute() in D:\dynamicweb.net\Solutions\brdklee.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewDetail.cshtml:line 53 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 System.Lazy`1.CreateValue() at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) at System.Lazy`1.LazyInitValue() at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.GetPrice(PriceViewModelSettings settings, IList`1 products, Boolean& pricesHasBeenPrepared, Object lock, Lazy`1 priceInfo) at System.Lazy`1.LazyInitValue() at System.Lazy`1.CreateValue() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at CompiledRazorTemplates.Dynamic.RazorEngine_01f979d9ffd7494c9c529d27ceeb08cf.Execute() in D:\dynamicweb.net\Solutions\brdklee.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\eCom\ProductCatalog\ProductViewDetail.cshtml:line 53 at System.Lazy`1.CreateValue() 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 Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.GetPrice(PriceViewModelSettings settings, IList`1 products, Boolean& pricesHasBeenPrepared, Object lock, Lazy`1 priceInfo) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__49() at System.Lazy`1.CreateValue() at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) at Dynamicweb.Rendering.Template.RenderRazorTemplate() --- 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_d2e50ea14b21489a98abac8490e69a4f.Execute() in D:\dynamicweb.net\Solutions\brdklee.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\Swift_ProductAddToCart.cshtml:line 129 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:0ef709ef-766e-4142-a380-dcd6da8ac281 Error Number:1205,State:52,Class:13
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Core.Encoders 4 @using System.Globalization 5 6 @functions { 7 string DoubleToString(double? value) 8 { 9 if (value.HasValue) 10 { 11 return value.Value.ToString(CultureInfo.InvariantCulture); 12 } 13 return null; 14 } 15 } 16 17 @{ 18 ProductViewModel product = null; 19 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 20 { 21 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 22 } 23 else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) 24 { 25 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 26 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 27 28 if (productList?.Products is object) 29 { 30 product = productList.Products[0]; 31 } 32 } 33 34 string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); 35 bool anonymousUser = Pageview.User == null; 36 bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); 37 bool hideAddToCart = anonymousUsersLimitations.Contains("cart") && anonymousUser || Pageview.AreaSettings.GetBoolean("ErpDownHideAddToCart") && isErpConnectionDown; 38 hideAddToCart = Pageview.IsVisualEditorMode ? false : hideAddToCart; 39 } 40 41 @if (product is object && !hideAddToCart) 42 { 43 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 44 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 45 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 46 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 47 48 bool favoritesSelector = !string.IsNullOrEmpty(Model.Item.GetString("ShowAddToFavorites")) ? Model.Item.GetBoolean("ShowAddToFavorites") : false; 49 bool quantitySelector = !string.IsNullOrEmpty(Model.Item.GetString("ShowQuantitySelector")) ? Model.Item.GetBoolean("ShowQuantitySelector") : false; 50 bool unitsSelector = !string.IsNullOrEmpty(Model.Item.GetString("ShowUnitsSelector")) ? Model.Item.GetBoolean("ShowUnitsSelector") : false; 51 bool hideInventory = !string.IsNullOrEmpty(Model.Item.GetString("HideInventory")) ? Model.Item.GetBoolean("HideInventory") : false; 52 bool hideStockState = !string.IsNullOrEmpty(Model.Item.GetString("HideStockState")) ? Model.Item.GetBoolean("HideStockState") : false; 53 54 string buttonSize = Model.Item.GetRawValueString("ButtonSize", "regular"); 55 string inputSize = string.Empty; 56 57 switch (buttonSize) 58 { 59 case "small": 60 inputSize = " input-group-sm"; 61 buttonSize = " btn-sm"; 62 break; 63 case "regular": 64 buttonSize = string.Empty; 65 break; 66 case "large": 67 inputSize = " input-group-lg"; 68 buttonSize = " btn-lg"; 69 break; 70 } 71 72 string iconPath = "/Files/icons/"; 73 string url = "/Default.aspx?ID=" + (GetPageIdByNavigationTag("CartService")); 74 if (!url.Contains("LayoutTemplate")) 75 { 76 url += url.Contains("?") ? "&LayoutTemplate=Swift_MiniCart.cshtml" : "?LayoutTemplate=Swift_MiniCart.cshtml"; 77 } 78 79 string whenVariantsExist = Model.Item.GetRawValueString("WhenVariantsExist", "hide"); 80 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 81 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 82 string addToCartIcon = Model.Item.GetRawValueString("Icon", iconPath + "shopping-cart.svg"); 83 string addToCartLabel = !addToCartIcon.Contains("_none") ? $"<span class=\"icon-2\">{ReadFile(addToCartIcon)}</span>" : ""; 84 addToCartLabel += !addToCartIcon.Contains("_none") && !Model.Item.GetBoolean("HideButtonText") ? " " : ""; 85 addToCartLabel += !Model.Item.GetBoolean("HideButtonText") ? $"<span class=\"d-none d-md-inline\">{Translate("Add to cart")}</span><span class=\"d-inline d-md-none\">{Translate("Add")}</span>" : ""; 86 bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); 87 88 bool userHasPendingQuote = Dynamicweb.Ecommerce.Common.Context.Cart != null && Dynamicweb.Ecommerce.Common.Context.Cart.IsQuote; 89 90 if (product.VariantInfo.VariantInfo == null || whenVariantsExist == "disable") 91 { 92 string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : product.DefaultUnitId; 93 if (string.IsNullOrEmpty(unitId) && product?.UnitOptions != null) 94 { 95 if (product.UnitOptions.FirstOrDefault<UnitOptionViewModel>() != null) 96 { 97 unitId = product.UnitOptions.FirstOrDefault<UnitOptionViewModel>().Id; 98 } 99 } 100 101 double? stepQty = product.PurchaseQuantityStep > 0 ? product.PurchaseQuantityStep : 1; 102 double? minQty = product.PurchaseMinimumQuantity > 0 ? product.PurchaseMinimumQuantity : 1; 103 double? valueQty = minQty > stepQty ? minQty : stepQty; 104 string disableAddToCart = null; 105 double? maxQty = null; 106 107 if (product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock && !product.NeverOutOfstock) 108 { 109 disableAddToCart = (product.StockLevel <= 0) || (!product.NeverOutOfstock && isLazyLoadingForProductInfoEnabled) ? "disabled" : disableAddToCart; 110 maxQty = product.StockLevel; 111 } 112 113 disableAddToCart = whenVariantsExist == "disable" && product.VariantInfo.VariantInfo != null && string.IsNullOrEmpty(product.VariantId) ? "disabled" : disableAddToCart; 114 disableAddToCart = product.Discontinued ? "disabled" : disableAddToCart; 115 116 if (unitsSelector && product.UnitOptions.Count > 0) 117 { 118 <form method="post" action="/Default.aspx?ID=@(Pageview.Page.ID)&ProductId=@product.Id" id="UnitSelectorForm_@(product.Id)_@(product.VariantId.Replace(".", "_"))_@Model.ID"> 119 <input type="hidden" name="redirect" value="false"> 120 <input type="hidden" name="VariantID" value="@product.VariantId"> 121 <input type="hidden" name="UnitID" class="js-unit-id" value="@unitId"> 122 </form> 123 } 124 125 <div class="d-flex @horizontalAlign @fullWidth js-input-group item_@Model.Item.SystemName.ToLower()"> 126 @if (!anonymousUser && favoritesSelector) 127 { 128 @RenderPartial("Components/ToggleFavorite.cshtml", product) 129 } 130 131 <form method="post" action="@url" class="@fullWidth" style="z-index: 1"> 132 <input type="hidden" name="redirect" value="false"> 133 <input type="hidden" name="ProductId" value="@product.Id"> 134 <input type="hidden" name="ProductName" value="@HtmlEncoder.HtmlEncode(product.Name)"> 135 <input type="hidden" name="ProductVariantName" value="@product.VariantName"> 136 <input type="hidden" name="ProductCurrency" value="@Dynamicweb.Ecommerce.Common.Context.Currency.Code"> 137 <input type="hidden" name="ProductPrice" value="@product.Price.ToStringInvariant()"> 138 <input type="hidden" name="ProductDiscount" value="@product.Discount.ToStringInvariant()"> 139 <input type="hidden" name="ProductReferer" value="component_ProductAddToCart"> 140 <input type="hidden" name="cartcmd" value="add"> 141 <input type="submit" class="d-none" onclick="event.preventDefault(); swift.Cart.Update(event)"> @* Fix for enterKey should not redirect to minicart page *@ 142 143 @if (!string.IsNullOrEmpty(product.VariantId)) 144 { 145 <input type="hidden" name="VariantId" value="@product.VariantId"> 146 } 147 148 <template class="js-step-quantity-warning"> 149 <div class="modal-header"> 150 <h1 class="modal-title fs-5">@Translate("The quantity is not valid")</h1> 151 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> 152 </div> 153 <div class="modal-body"> 154 @Translate("Please select a quantity that is dividable by") @stepQty 155 </div> 156 </template> 157 158 159 <template class="js-min-quantity-warning"> 160 <div class="modal-header"> 161 <h1 class="modal-title fs-5">@Translate("The product could not be added to the cart")</h1> 162 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> 163 </div> 164 <div class="modal-body"> 165 @Translate("The quantity is not valid. You must buy at least") @product.PurchaseMinimumQuantity 166 </div> 167 </template> 168 169 <template class="js-value-missing-warning"> 170 <div class="modal-header"> 171 <h1 class="modal-title fs-5">@Translate("No amount specified")</h1> 172 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> 173 </div> 174 <div class="modal-body"> 175 @Translate("Specify an amount to add to the cart") 176 </div> 177 </template> 178 179 180 @if (userHasPendingQuote) 181 { 182 <input type="hidden" name="PendingQuote" value="true"> 183 184 <template class="js-pending-quote-notice"> 185 <div class="modal-header"> 186 <h1 class="modal-title fs-5">@Translate("Pending Quote")</h1> 187 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 188 </div> 189 <div class="modal-body"> 190 @Translate("You need to complete your current quote or empty the cart before adding this product to cart.") 191 </div> 192 </template> 193 } 194 195 @if (quantitySelector || (!anonymousUser && product.VariantInfo.VariantInfo != null) || (!anonymousUser && favoritesSelector)) 196 { 197 <input type="hidden" id="Unit_@(product.Id)_@product.VariantId.Replace(".", "_")" name="UnitID" value="@unitId" /> 198 } 199 200 <div class="d-flex flex-row w-100"> 201 @if (!quantitySelector) 202 { 203 <input id="Quantity_@(product.Id)_@product.VariantId.Replace(".", "_")" class="swift_quantity_field" name="Quantity" value="@valueQty" type="hidden" @disableAddToCart> 204 } 205 206 @if (unitsSelector && product.UnitOptions.Count > 0) 207 { 208 string selectedUnitName = !string.IsNullOrEmpty(unitId) && product?.UnitOptions != null ? unitId : product.UnitOptions.FirstOrDefault<UnitOptionViewModel>().Name; 209 210 foreach (var unitOption in product.UnitOptions) 211 { 212 if (unitOption.Id == unitId) 213 { 214 selectedUnitName = unitOption.Name; 215 } 216 } 217 218 <div class="d-flex flex-column gap-2 w-100"> 219 <div class="input-group input-primary-button-group flex-nowrap@(inputSize)"> 220 221 @if (quantitySelector) 222 { 223 <input id="Quantity_@(product.Id)_@product.VariantId.Replace(".", "_")" name="Quantity" value="@DoubleToString(valueQty)" step="@DoubleToString(stepQty)" min="@DoubleToString(minQty)" max="@DoubleToString(maxQty)" class="form-control swift_quantity-field" style="min-width: 60px; max-width: 100px; z-index: 1" type="number" @disableAddToCart> 224 } 225 226 <button class="btn btn-secondary @flexFill dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> 227 @selectedUnitName 228 </button> 229 230 <ul class="dropdown-menu swift_unit-field"> 231 @foreach (var unitOption in product.UnitOptions) 232 { 233 var selectedUnit = unitOption.Id == unitId ? "selected" : ""; 234 235 <li> 236 <button type="button" class="btn dropdown-item" data-value="@unitOption.Id" onclick="document.querySelector('#UnitSelectorForm_@(product.Id)_@(product.VariantId.Replace(".", "_"))_@Model.ID').querySelector('.js-unit-id').value = this.getAttribute('data-value'); 237 document.querySelector('#Unit_@(product.Id)_@product.VariantId.Replace(".", "_")').value = this.getAttribute('data-value'); 238 swift.PageUpdater.Update(document.querySelector('#UnitSelectorForm_@(product.Id)_@(product.VariantId.Replace(".", "_"))_@Model.ID'))"> 239 <span>@unitOption.Name</span> 240 <span> 241 @if (unitOption.StockLevel > 0 || unitOption.NeverOutOfStock) 242 { 243 if (!Model.Item.GetBoolean("HideInventory") && !unitOption.NeverOutOfStock) 244 { 245 <span class="small text-success">@unitOption.StockLevel @Translate("In stock")</span> 246 } 247 else 248 { 249 <span class="small text-success">@Translate("In stock")</span> 250 } 251 } 252 else 253 { 254 <span class="small text-danger">@Translate("Out of Stock")</span> 255 } 256 </span> 257 </button> 258 </li> 259 } 260 </ul> 261 </div> 262 <button type="button" onclick="swift.Cart.Update(event)" class="btn btn-primary @(buttonSize) js-add-to-cart-button" style="white-space: nowrap" @disableAddToCart title="@Translate("Add to cart")" id="AddToCartButton@(product.Id)_@Pageview.CurrentParagraph.ID"> 263 @if (!Model.Item.GetBoolean("HideButtonText")) 264 { 265 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 266 @addToCartLabel 267 </span> 268 } 269 else 270 { 271 @addToCartLabel 272 } 273 </button> 274 </div> 275 } 276 else 277 { 278 <div class="input-group input-primary-button-group flex-nowrap@(inputSize)"> 279 @if (quantitySelector) 280 { 281 <input id="Quantity_@(product.Id)_@product.VariantId.Replace(".", "_")" name="Quantity" value="@DoubleToString(valueQty)" step="@DoubleToString(stepQty)" min="@DoubleToString(minQty)" max="@DoubleToString(maxQty)" class="form-control swift_quantity-field" style="min-width: 60px; max-width: 100px; z-index: 1" type="number" @disableAddToCart> 282 } 283 284 <button type="button" onclick="swift.Cart.Update(event)" class="btn btn-primary @(buttonSize) @flexFill js-add-to-cart-button" style="white-space: nowrap" @disableAddToCart title="@Translate("Add to cart")" id="AddToCartButton@(product.Id)_@Pageview.CurrentParagraph.ID"> 285 @if (!Model.Item.GetBoolean("HideButtonText")) 286 { 287 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 288 @addToCartLabel 289 </span> 290 } 291 else 292 { 293 @addToCartLabel 294 } 295 </button> 296 </div> 297 } 298 </div> 299 </form> 300 </div> 301 } 302 else if (whenVariantsExist == "modal") 303 { 304 string ButtonShape = Model.Item.GetRawValueString("VariantButtonShape", "square"); 305 string buttonAspectRatio = Model.Item.GetRawValueString("VariantImageAspectRatio", "56%"); 306 307 string buttonText = Translate("Select"); 308 string variantId = !string.IsNullOrWhiteSpace(product.VariantId) ? product.VariantId : product.DefaultVariantId; 309 310 string variantSelectorServicePageId = !string.IsNullOrEmpty(Model.Item.GetString("VariantSelectorServicePageId")) ? Model.Item.GetLink("VariantSelectorServicePageId").PageId.ToString() : ""; 311 variantSelectorServicePageId = variantSelectorServicePageId != "" ? variantSelectorServicePageId : GetPageIdByNavigationTag("VariantSelectorService").ToString(); 312 313 <div class="d-flex @horizontalAlign w-100 item_@Model.Item.SystemName.ToLower()"> 314 @if (!anonymousUser && favoritesSelector) 315 { 316 @RenderPartial("Components/ToggleFavorite.cshtml", product) 317 } 318 <form action="/Default.aspx?ID=@variantSelectorServicePageId" data-response-target-element="DynamicModalContent" data-preloader="inline" style="z-index: 1" class="@fullWidth"> 319 <input type="hidden" name="ProductID" value="@product.Id"> 320 <input type="hidden" name="VariantID" value="@variantId"> 321 <input type="hidden" name="QuantitySelector" value="@quantitySelector.ToString()"> 322 <input type="hidden" name="HideInventory" value="@hideInventory.ToString()"> 323 <input type="hidden" name="HideStockState" value="@hideStockState.ToString()"> 324 <input type="hidden" name="ButtonLayout" value="@ButtonShape"> 325 <input type="hidden" name="ButtonAspectRatio" value="@buttonAspectRatio"> 326 <input type="hidden" name="VariantSelectorServicePage" value="@variantSelectorServicePageId"> 327 <input type="hidden" name="ViewType" value="ModalContent"> 328 @if (isLazyLoadingForProductInfoEnabled) 329 { 330 @* If lazy loading is enabled, bypass it because we're loading a modal window, so render everything as if it was server-side *@ 331 <input type="hidden" name="getproductinfo" value="true"> 332 } 333 <button type="button" onclick="swift.PageUpdater.Update(event)" class="btn btn-primary@(buttonSize) @fullWidth" title="@Translate("Select")" data-bs-toggle="modal" data-bs-target="#DynamicModal" id="OpenVariantSelectorModal@(product.Id)_@Pageview.CurrentParagraph.ID">@buttonText</button> 334 </form> 335 </div> 336 } 337 } 338 else if (Pageview.IsVisualEditorMode) 339 { 340 <div class="alert alert-dark m-0">@Translate("No products available")</div> 341 } 342
- HS-kode
- 39269097
- Oprindelsesland
- Storbritannien
- Vægt, kg
- 0
- Nummer
- 191CSS50013
Datablade og dokumenter
Navn | Download | Fil type | |
---|---|---|---|
|
Kabelstrips brochure 2022.pdf | 3543 KB |