Cravat CROATA Clasicum

010115-000031
Error executing template "/Designs/Swift/Paragraph/DS_ProductPrice.cshtml"
System.IO.IOException: The process cannot access the file 'C:\inetpub\wwwroot\DWShop2023\Solutions\Swift_v1.21.0\Files\System\Log\LiveIntegration\Potomac Live Integration_1.log' 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, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding)
   at Dynamicweb.Core.Helpers.TextFileHelper.WriteTextFile(String value, String path, Boolean appendToFile, Encoding encoding)
   at Potomac.LiveIntegration.Logging.Logger.Log(ErrorLevel errorLevel, String logline)
   at Potomac.LiveIntegration.Providers.CustomPriceProvider.InternalFindPrice(Product product, Double quantity, String variantId, Country country, Currency currency, String unitId, User user, Boolean informative)
   at Potomac.LiveIntegration.Providers.CustomPriceProvider.Dynamicweb.Ecommerce.Prices.IPriceInfoProvider.FindPriceInfo(PriceContext context, PriceProductSelection selection)
   at Dynamicweb.Ecommerce.Prices.PriceManager.FindPriceInternal(PriceProvider provider, PriceContext context, PriceProductSelection selection, Boolean isInformative)
   at Dynamicweb.Ecommerce.Prices.PriceManager.FindPrice(PriceContext context, PriceProductSelection selection, Boolean isInformative)
   at Dynamicweb.Ecommerce.Prices.PriceManager.GetPrice(PriceContext context, Product product, String unitId, Int64 stockLocationId)
   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 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__43()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_d06d8ca8af1d4a5d8517c411e380a331.Execute() in C:\inetpub\wwwroot\DWShop2023\Solutions\Swift_v1.21.0\Files\Templates\Designs\Swift\Paragraph\DS_ProductPrice.cshtml:line 82
   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.Ecommerce.ProductCatalog 3 4 @{ 5 ProductViewModel product = null; 6 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 7 { 8 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 9 } 10 else if (Pageview.Item["DummyProduct"] != null) 11 { 12 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 13 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 14 15 if (productList?.Products is object) 16 { 17 product = productList.Products[0]; 18 } 19 } 20 21 string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); 22 bool anonymousUser = Pageview.User == null; 23 bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); 24 bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser || Pageview.AreaSettings.GetBoolean("ErpDownHidePrices") && isErpConnectionDown; 25 } 26 27 @if (product is object && !hidePrice) { 28 bool showInformativePrice = Model.Item.GetBoolean("ShowInformativePrice"); 29 string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : string.Empty; 30 31 string priceFontSize = Model.Item.GetRawValueString("PriceSize", "fs-2"); 32 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 33 string layout = Model.Item.GetRawValueString("Layout", "horizontal"); 34 string textAlign = horizontalAlign == "center" ? "text-center" : string.Empty; 35 textAlign = horizontalAlign == "end" ? "text-end" : textAlign; 36 37 horizontalAlign = horizontalAlign == "center" && layout == "horizontal" ? "justify-content-center" : horizontalAlign; 38 horizontalAlign = horizontalAlign == "end" && layout == "horizontal" ? "justify-content-end" : horizontalAlign; 39 horizontalAlign = horizontalAlign == "center" && layout == "vertical" ? "align-items-center" : horizontalAlign; 40 horizontalAlign = horizontalAlign == "end" && layout == "vertical" ? "align-items-end" : horizontalAlign; 41 42 string flexDirection = layout == "horizontal" ? string.Empty : "flex-column"; 43 string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; 44 string order = layout == "horizontal" ? string.Empty : "order-2"; 45 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? "theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 46 theme = GetViewParameter("theme") != null ? GetViewParameterString("theme") : theme; 47 48 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 49 contentPadding = contentPadding == "none" ? "p-0" : contentPadding; 50 contentPadding = contentPadding == "small" ? "p-1 px-md-2 py-md-1" : contentPadding; 51 contentPadding = contentPadding == "large" ? "p-2 px-md-3 py-md-2" : contentPadding; 52 53 string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); 54 bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); 55 56 string priceMin = ""; 57 string priceMax = ""; 58 59 string liveInfoClass = ""; 60 string productInfoFeed = ""; 61 bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); 62 if (isLazyLoadingForProductInfoEnabled) 63 { 64 if (Dynamicweb.Context.Current.Items.Contains("ProductInfoFeed")) 65 { 66 productInfoFeed = Dynamicweb.Context.Current.Items["ProductInfoFeed"]?.ToString(); 67 if (!string.IsNullOrEmpty(productInfoFeed)) 68 { 69 productInfoFeed = $"data-product-info-feed=\"{productInfoFeed}\""; 70 } 71 } 72 liveInfoClass = "js-live-info"; 73 } 74 75 <div class="@textAlign @liveInfoClass item_@Model.Item.SystemName.ToLower()" data-product-id="@product.Id" data-variant-id="@product.VariantId" @productInfoFeed> 76 @if (showInformativePrice && product.PriceInformative.Price != 0) 77 { 78 <div class="opacity-50"> 79 <span>@Translate("RRP") </span> 80 <span class="text-decoration-line-through text-price">@product.PriceInformative.PriceFormatted</span> 81 </div> 82 } 83 <div class="@priceFontSize m-0 d-flex @flexDirection @flexGap @horizontalAlign" itemprop="offers" itemscope itemtype="https://schema.org/Offer"> 84 <span itemprop="priceCurrency" content="@product.Price.CurrencyCode" class="d-none"></span> 85 86 87 @if (showPricesWithVat == "false" && !neverShowVat) 88 { 89 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) 90 { 91 <span itemprop="price" content="" class="d-none"></span> 92 <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> 93 } 94 else 95 { 96 string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceWithoutVatFormatted : product.PriceBeforeDiscount.PriceWithoutVatFormatted; 97 98 <span itemprop="price" content="@product.Price.PriceWithoutVat" class="d-none"></span> 99 if (product.Price.Price != product.PriceBeforeDiscount.Price) 100 { 101 <span class="text-decoration-line-through opacity-75 @order">@beforePrice</span> 102 } 103 } 104 } 105 else 106 { 107 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) 108 { 109 <span itemprop="price" content="" class="d-none"></span> 110 <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> 111 } 112 else 113 { 114 string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product.PriceBeforeDiscount.PriceFormatted; 115 116 <span itemprop="price" content="@product.Price.Price" class="d-none"></span> 117 118 if (product.Price.Price != product.PriceBeforeDiscount.Price) 119 { 120 <span class="text-decoration-line-through opacity-75 @order"> 121 <span class="text-price">@beforePrice</span> 122 </span> 123 } 124 } 125 } 126 127 @if (showPricesWithVat == "false" && !neverShowVat) 128 { 129 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) 130 { 131 <span class="text-price js-text-price"> 132 <span class="spinner-border" role="status"></span> 133 </span> 134 } 135 else 136 { 137 string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithoutVatFormatted : product.Price.PriceWithoutVatFormatted; 138 139 if (product?.VariantInfo?.VariantInfo != null) 140 { 141 priceMin = product?.VariantInfo?.PriceMin?.PriceWithoutVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithoutVatFormatted : ""; 142 priceMax = product?.VariantInfo?.PriceMax?.PriceWithoutVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithoutVatFormatted : ""; 143 } 144 if (priceMin != priceMax) 145 { 146 price = priceMin + " - " + priceMax; 147 } 148 <span class="@theme @contentPadding"> 149 <span class="text-price">@price</span> 150 </span> 151 } 152 } 153 else 154 { 155 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) 156 { 157 <span class="text-price js-text-price"> 158 <span class="spinner-border" role="status"></span> 159 </span> 160 } 161 else 162 { 163 string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product.Price.PriceFormatted; 164 var priceinKN = product.Price.Price * 7.53450; 165 166 if (product?.VariantInfo?.VariantInfo != null) 167 { 168 priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted != null ? product.VariantInfo.PriceMin.PriceFormatted : ""; 169 priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted != null ? product.VariantInfo.PriceMax.PriceFormatted : ""; 170 } 171 if (priceMin != priceMax) 172 { 173 price = priceMin + " - " + priceMax; 174 } 175 <span class="@theme @contentPadding"> 176 <span class="text-price">@price</span> 177 @* @if(Pageview.Area.Culture.ToString() == "hr-HR") {<span class="priceinKN">(@priceinKN.ToString("N2") kn)</span> }*@ 178 </span> 179 } 180 } 181 182 @* Stock state for Schema.org, start *@ 183 @{ 184 Uri url = Dynamicweb.Context.Current.Request.Url; 185 } 186 187 <link itemprop="url" href="@url"> 188 189 @{ 190 bool IsNeverOutOfStock = product.NeverOutOfstock; 191 } 192 193 @if (IsNeverOutOfStock) 194 { 195 <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> 196 } 197 else 198 { 199 if (product.StockLevel > 0) 200 { 201 <span itemprop="availability" class="d-none">InStock</span> 202 } 203 else 204 { 205 <span itemprop="availability" class="d-none">OutOfStock</span> 206 } 207 } 208 @* Stock state for Schema.org, stop *@ 209 210 </div> 211 212 @if (showPricesWithVat == "false" && !neverShowVat) 213 { 214 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) 215 { 216 <small class="opacity-85 fst-normal js-text-price-with-vat d-none" data-suffix="@Translate("Incl. VAT")"></small> 217 } 218 else 219 { 220 string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithVatFormatted : product.Price.PriceWithVatFormatted; 221 222 if (product?.VariantInfo?.VariantInfo != null) 223 { 224 priceMin = product?.VariantInfo?.PriceMin?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithVatFormatted : ""; 225 priceMax = product?.VariantInfo?.PriceMax?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithVatFormatted : ""; 226 } 227 if (priceMin != priceMax) 228 { 229 price = priceMin + " - " + priceMax; 230 } 231 <small class="opacity-85 fst-normal">@price @Translate("Incl. VAT")</small> 232 } 233 } 234 </div> 235 } 236 else if (Pageview.IsVisualEditorMode) 237 { 238 <div class="alert alert-dark m-0" role="alert"> 239 <span>@Translate("No products available")</span> 240 </div> 241 } 242
Error executing template "/Designs/Swift/Paragraph/DS_ProductAddToCart.cshtml"
System.IO.IOException: The process cannot access the file 'C:\inetpub\wwwroot\DWShop2023\Solutions\Swift_v1.21.0\Files\System\Log\LiveIntegration\Potomac Live Integration_1.log' 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, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding)
   at Dynamicweb.Core.Helpers.TextFileHelper.WriteTextFile(String value, String path, Boolean appendToFile, Encoding encoding)
   at Potomac.LiveIntegration.Logging.Logger.Log(ErrorLevel errorLevel, String logline)
   at Potomac.LiveIntegration.Providers.CustomPriceProvider.InternalFindPrice(Product product, Double quantity, String variantId, Country country, Currency currency, String unitId, User user, Boolean informative)
   at Potomac.LiveIntegration.Providers.CustomPriceProvider.Dynamicweb.Ecommerce.Prices.IPriceInfoProvider.FindPriceInfo(PriceContext context, PriceProductSelection selection)
   at Dynamicweb.Ecommerce.Prices.PriceManager.FindPriceInternal(PriceProvider provider, PriceContext context, PriceProductSelection selection, Boolean isInformative)
   at Dynamicweb.Ecommerce.Prices.PriceManager.FindPrice(PriceContext context, PriceProductSelection selection, Boolean isInformative)
   at Dynamicweb.Ecommerce.Prices.PriceManager.GetPrice(PriceContext context, Product product, String unitId, Int64 stockLocationId)
   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 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__43()
   at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Lazy`1.get_Value()
   at CompiledRazorTemplates.Dynamic.RazorEngine_9e6f3d92085045289b0f70f8bfe49132.Execute() in C:\inetpub\wwwroot\DWShop2023\Solutions\Swift_v1.21.0\Files\Templates\Designs\Swift\Paragraph\DS_ProductAddToCart.cshtml:line 140
   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.Ecommerce.ProductCatalog 3 @using Dynamicweb.Ecommerce.CustomerExperienceCenter.Favorites 4 5 6 @{ 7 ProductViewModel product = null; 8 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 9 { 10 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 11 } 12 else if (Pageview.Item["DummyProduct"] != null) 13 { 14 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 15 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 16 17 if (productList?.Products is object) 18 { 19 product = productList.Products[0]; 20 } 21 } 22 23 string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); 24 bool anonymousUser = Pageview.User == null; 25 bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); 26 bool hideAddToCart = anonymousUsersLimitations.Contains("cart") && anonymousUser || Pageview.AreaSettings.GetBoolean("ErpDownHideAddToCart") && isErpConnectionDown; 27 hideAddToCart = Pageview.IsVisualEditorMode ? false : hideAddToCart; 28 29 } 30 31 @if (product is object && !hideAddToCart) { 32 33 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 34 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 35 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 36 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 37 38 bool favoritesSelector = !string.IsNullOrEmpty(Model.Item.GetString("ShowAddToFavorites")) ? Model.Item.GetBoolean("ShowAddToFavorites") : false; 39 bool quantitySelector = !string.IsNullOrEmpty(Model.Item.GetString("ShowQuantitySelector")) ? Model.Item.GetBoolean("ShowQuantitySelector") : false; 40 bool unitsSelector = !string.IsNullOrEmpty(Model.Item.GetString("ShowUnitsSelector")) ? Model.Item.GetBoolean("ShowUnitsSelector") : false; 41 bool hideInventory = !string.IsNullOrEmpty(Model.Item.GetString("HideInventory")) ? Model.Item.GetBoolean("HideInventory") : false; 42 bool hideStockState = !string.IsNullOrEmpty(Model.Item.GetString("HideStockState")) ? Model.Item.GetBoolean("HideStockState") : false; 43 44 string buttonSize = Model.Item.GetRawValueString("ButtonSize", "regular"); 45 string inputSize = string.Empty; 46 47 switch (buttonSize) 48 { 49 case "small": 50 inputSize = " input-group-sm"; 51 buttonSize = " btn-sm"; 52 break; 53 case "regular": 54 buttonSize = string.Empty; 55 break; 56 case "large": 57 inputSize = " input-group-lg"; 58 buttonSize = " btn-lg"; 59 break; 60 } 61 62 string iconPath = "/Files/icons/"; 63 string url = "/Default.aspx?ID=" + (GetPageIdByNavigationTag("CartService")); 64 if (!url.Contains("LayoutTemplate")) 65 { 66 url += url.Contains("?") ? "&LayoutTemplate=Swift_MiniCart.cshtml" : "?LayoutTemplate=Swift_MiniCart.cshtml"; 67 } 68 69 string disableAddToCart = (product.StockLevel <= 0) ? "disabled" : ""; 70 bool isNeverOutOfStock = product.NeverOutOfstock; 71 disableAddToCart = isNeverOutOfStock ? "" : disableAddToCart; 72 73 string whenVariantsExist = Model.Item.GetRawValueString("WhenVariantsExist", "hide"); 74 75 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 76 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 77 string addToCartIcon = Model.Item.GetRawValueString("Icon", iconPath + "shopping-cart.svg"); 78 string addToCartLabel = !addToCartIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(addToCartIcon) + "</span>" : ""; 79 addToCartLabel += !addToCartIcon.Contains("_none") && !Model.Item.GetBoolean("HideButtonText") ? " " : ""; 80 addToCartLabel += !Model.Item.GetBoolean("HideButtonText") ? Translate("Add to cart") : ""; 81 string imagePath = product?.DefaultImage?.Value ?? ""; 82 imagePath = Dynamicweb.Context.Current.Server.UrlEncode(imagePath); 83 string ratio = Model.Item.GetRawValueString("ImageAspectRatio", ""); 84 ratio = ratio != "0" ? ratio : ""; 85 string ratioCssClass = ratio != "" ? " ratio" : ""; 86 string ratioVariable = ratio != "" ? "--bs-aspect-ratio: " + ratio : ""; 87 88 string width = Model.Item.GetRawValueString("Width", "auto"); 89 int smallImageSize = 640; 90 int largeImageSize = width == "auto" ? 1280 : Convert.ToInt32(width); 91 string imagePathXs = "/Admin/Public/GetImage.ashx?width=" + smallImageSize + "&image=" + imagePath + "&format=webp"; 92 string imagePathS = "/Admin/Public/GetImage.ashx?width=" + largeImageSize + "&image=" + imagePath + "&format=webp"; 93 string imagePathFallBack = "/Admin/Public/GetImage.ashx?width=" + largeImageSize + "&image=" + imagePath + "&format=webp"; 94 95 96 if (product.VariantInfo.VariantInfo == null || whenVariantsExist == "disable") { 97 string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : product.DefaultUnitId; 98 if (string.IsNullOrEmpty(unitId) && product?.UnitOptions != null) { 99 if (product.UnitOptions.FirstOrDefault<UnitOptionViewModel>() != null) { 100 unitId = product.UnitOptions.FirstOrDefault<UnitOptionViewModel>().Id; 101 } 102 } 103 104 string minQty = product.PurchaseMinimumQuantity != 1 ? "min=\"" + product.PurchaseMinimumQuantity.ToString() + "\"" : "min=\"1\""; 105 string stepQty = product.PurchaseQuantityStep > 1 ? product.PurchaseQuantityStep.ToString() : "1"; 106 string valueQty = product.PurchaseMinimumQuantity > product.PurchaseQuantityStep ? product.PurchaseMinimumQuantity.ToString() : stepQty; 107 disableAddToCart = product.VariantInfo.VariantInfo != null && string.IsNullOrEmpty(product.VariantId) ? "disabled" : disableAddToCart; 108 109 var reserveMode = Dynamicweb.Ecommerce.Frontend.Cart.ProductReserve.Mode; 110 111 112 //IvanM 15.04.2024. - Adding default box to cart setup field 113 //------------------------------------------------------------------ 114 string DefaultBoxProductId = null; 115 Dynamicweb.Ecommerce.Products.Product boxProduct = null; 116 117 118 if (product.ProductFields.ContainsKey("DefaultBox")) 119 { 120 if (product.ProductFields["DefaultBox"] != null) 121 { 122 DefaultBoxProductId = product.ProductFields["DefaultBox"].Value.ToString(); 123 if (DefaultBoxProductId != null) 124 { 125 var dwProductServices = Dynamicweb.Ecommerce.Services.Products; 126 boxProduct = dwProductServices.GetProductById(DefaultBoxProductId, product.VariantId, product.LanguageId); 127 } 128 129 } 130 } 131 //------------------------------------------------------------------ 132 //IvanM 15.04.2024. - Adding default box to cart setup field -- end 133 134 if (unitsSelector && product.UnitOptions.Count > 0) { 135 <form method="post" action="/Default.aspx?ID=@(Pageview.Page.ID)&ProductId=@product.Id" id="UnitSelectorForm_@(product.Id)_@(product.VariantId)_@Model.ID"> 136 <input type="hidden" name="redirect" value="false"> 137 <input type="hidden" name="VariantID" value="@product.VariantId"> 138 <input type="hidden" name="UnitID" class="js-unit-id" value="@unitId"> 139 </form> 140 } 141 142 <div class="@DefaultBoxProductId d-flex @horizontalAlign @fullWidth js-input-group item_@Model.Item.SystemName.ToLower()"> 143 <form method="post" action="@url" class="@fullWidth" style="z-index: 1"> 144 <input type="hidden" name="redirect" value="false"> 145 <input type="hidden" name="ProductId" value="@product.Id"> 146 <input type="hidden" name="ProductName" value="@product.Name"> 147 <input type="hidden" name="ProductVariantName" value="@product.VariantName"> 148 <input type="hidden" name="ProductCurrency" value="@Dynamicweb.Ecommerce.Common.Context.Currency.Code"> 149 <input type="hidden" name="ProductPrice" value="@PriceViewModelExtensions.ToStringInvariant(product.Price)"> 150 <input type="hidden" name="ProductReferer" value="component_ProductAddToCart"> 151 <input type="hidden" name="cartcmd" value="add"> 152 @if(boxProduct!=null){ 153 <input type="hidden" name="EcomOrderLineFieldInput_LinkedItem" value="@boxProduct.Id"> 154 } 155 156 @if (reserveMode == Dynamicweb.Ecommerce.Frontend.Cart.ProductReserveMode.AddToCart) 157 { 158 <input type="hidden" name="GetReservedAmount" value="true"> 159 } 160 161 @if (!string.IsNullOrEmpty(product.VariantId)) 162 { 163 <input type="hidden" name="VariantId" value="@product.VariantId"> 164 } 165 166 @if (!product.NeverOutOfstock) 167 { 168 <input type="hidden" name="Stock" value="@product.StockLevel"> 169 170 <template class="js-out-of-stock-notice"> 171 <div class="modal-header"> 172 <h1 class="modal-title fs-5">@Translate("Stock limit")</h1> 173 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> 174 </div> 175 <div class="modal-body"> 176 @Translate("There are not enough products in stock. The product might be sold out or discontinued. Please adjust the quantity.") 177 </div> 178 </template> 179 } 180 181 @if (stepQty != "1") 182 { 183 <template class="js-step-quantity-warning"> 184 <div class="modal-header"> 185 <h1 class="modal-title fs-5">@Translate("The quantity is not valid")</h1> 186 </div> 187 <div class="modal-body"> 188 @Translate("Please select a quantity that is dividable by") @stepQty 189 </div> 190 </template> 191 } 192 @if (product.PurchaseMinimumQuantity != 1) 193 { 194 <template class="js-min-quantity-warning"> 195 <div class="modal-header"> 196 <h1 class="modal-title fs-5">@Translate("The product could not be added to the cart")</h1> 197 </div> 198 <div class="modal-body"> 199 @Translate("The quantity is not valid. You must buy at least") @product.PurchaseMinimumQuantity 200 </div> 201 </template> 202 } 203 204 @if (quantitySelector || (!anonymousUser && product.VariantInfo.VariantInfo != null) || (!anonymousUser && favoritesSelector)) 205 { 206 <input type="hidden" id="Unit_@(product.Id)_@product.VariantId" name="UnitID" value="@unitId" /> 207 } 208 209 <div class="d-flex flex-row w-100"> 210 @if (!anonymousUser && favoritesSelector) 211 { 212 @RenderPartial("Components/ToggleFavorite.cshtml", product) 213 } 214 215 @if (!quantitySelector) 216 { 217 <input id="Quantity_@(product.Id)_@product.VariantId" name="Quantity" value="@valueQty" type="hidden" @disableAddToCart> 218 } 219 220 <div class="input-group input-primary-button-group flex-nowrap@(inputSize)"> 221 @if(product.StockLevel>0){ 222 if (quantitySelector) 223 { 224 <input id="Quantity_@(product.Id)_@product.VariantId" name="Quantity" value="@valueQty" step="@stepQty" @minQty class="form-control swift_quantity-field AddToCardButton" style="min-width: 60px; max-width: 100px; z-index: 1" type="number" onchange="swift.Cart.UpdateOnEnterKey(event)" onkeyup="swift.Cart.UpdateOnEnterKey(event)" @disableAddToCart> 225 } 226 227 if (unitsSelector && product.UnitOptions.Count > 0) 228 { 229 string selectedUnitName = !string.IsNullOrEmpty(unitId) && product?.UnitOptions != null ? unitId : product.UnitOptions.FirstOrDefault<UnitOptionViewModel>().Name; 230 231 foreach (var unitOption in product.UnitOptions) 232 { 233 if (unitOption.Id == unitId) 234 { 235 selectedUnitName = unitOption.Name; 236 } 237 } 238 239 <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> 240 @selectedUnitName 241 </button> 242 <ul class="dropdown-menu swift_unit-field"> 243 @foreach (var unitOption in product.UnitOptions) 244 { 245 var selectedUnit = unitOption.Id == unitId ? "selected" : ""; 246 247 <li> 248 <button type="button" class="btn dropdown-item" data-value="@unitOption.Id" onclick="document.querySelector('#UnitSelectorForm_@(product.Id)_@(product.VariantId)_@Model.ID').querySelector('.js-unit-id').value = this.getAttribute('data-value'); 249 document.querySelector('#Unit_@(product.Id)_@product.VariantId').value = this.getAttribute('data-value'); 250 swift.PageUpdater.Update(document.querySelector('#UnitSelectorForm_@(product.Id)_@(product.VariantId)_@Model.ID'))"> 251 <span>@unitOption.Name</span> 252 <span> 253 @if (unitOption.StockLevel > 0) 254 { 255 if (!Model.Item.GetBoolean("HideInventory")) 256 { 257 <span class="small text-success">@unitOption.StockLevel @Translate("In stock")</span> 258 } 259 else 260 { 261 <span class="small text-success">@Translate("In stock")</span> 262 } 263 } 264 else 265 { 266 <span class="small text-danger">@Translate("Out of Stock")</span> 267 } 268 </span> 269 </button> 270 </li> 271 } 272 </ul> 273 } 274 275 <button type="button" onclick="swift.Cart.Update(event); AddToCartInfo()" class="btn btn-secondary @(buttonSize) @flexFill js-add-to-cart-button" style="white-space: nowrap" @disableAddToCart title="@Translate("Add to cart")" id="AddToCartButton@(product.Id)_@Pageview.CurrentParagraph.ID"> 276 @if (!Model.Item.GetBoolean("HideButtonText")) 277 { 278 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 279 @addToCartLabel 280 </span> 281 } 282 else 283 { 284 @addToCartLabel 285 } 286 </button> 287 <div aria-live="polite" aria-atomic="true"> 288 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11"> 289 <div id="AddToCartInfo" class="toast hide" role="alert" aria-live="assertive" aria-atomic="true" autohide="true"> 290 <div class="toast-header"> 291 <strong class="me-auto">@Translate("Product is added to the cart")</strong> 292 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> 293 </div> 294 <div class="toast-body d-flex gap-3"> 295 <div id="AddToCartInfoNotificationToast_Image"><img src="@imagePathXs" style="width:100px;"></div> 296 <div id="AddToCartInfoNotificationToast_Text" >@(product.Name)<br> 297 @(product.Id)</div> 298 </div> 299 </div> 300 </div> 301 </div> 302 <script> 303 function AddToCartInfo() { 304 document.getElementById("AddToCartInfo").classList.add("show"); 305 setTimeout(function() { 306 document.getElementById("AddToCartInfo").classList.remove("show"); 307 }, 3000); 308 } 309 </script> 310 311 312 313 314 315 } else { 316 317 <div class="productNotAvailable text-nowrap d-flex align-items-center justify-content-center gap-2">@Translate("This product is currently not available.")</div> 318 319 } 320 </div> 321 </div> 322 </form> 323 </div> 324 } else if (whenVariantsExist == "modal") { 325 string buttonText = Translate("Select"); 326 327 string variantSelectorServicePageId = !string.IsNullOrEmpty(Model.Item.GetString("VariantSelectorServicePageId")) ? Model.Item.GetLink("VariantSelectorServicePageId").PageId.ToString() : ""; 328 variantSelectorServicePageId = variantSelectorServicePageId != "" ? variantSelectorServicePageId : GetPageIdByNavigationTag("VariantSelectorService").ToString(); 329 330 <div class="d-flex @horizontalAlign w-100 item_@Model.Item.SystemName.ToLower()"> 331 @if (!anonymousUser && favoritesSelector) 332 { 333 @RenderPartial("Components/ToggleFavorite.cshtml", product) 334 } 335 <form action="/Default.aspx?ID=@variantSelectorServicePageId" data-response-target-element="DynamicModalContent" data-preloader="inline" style="z-index: 1" class="@fullWidth"> 336 <input type="hidden" name="ProductID" value="@product.Id"> 337 <input type="hidden" name="QuantitySelector" value="@quantitySelector.ToString()"> 338 <input type="hidden" name="HideInventory" value="@hideInventory.ToString()"> 339 <input type="hidden" name="HideStockState" value="@hideStockState.ToString()"> 340 <input type="hidden" name="VariantSelectorServicePage" value="@variantSelectorServicePageId"> 341 <input type="hidden" name="ViewType" value="ModalContent"> 342 <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> 343 </form> 344 </div> 345 } 346 } else if (Pageview.IsVisualEditorMode) { 347 <div class="alert alert-dark m-0">@Translate("No products available")</div> 348 }

+ PRODUCT INFO

Design: Thematic
Model: Large
Motif: Lynx
Colour: Blue
Product: Cravat
Size: Narrow 7 cm
Brand: CROATA
Material composition : Silk 100%

+ FABRIC AND CARE

Finishing: Regular
Maintenance: Do not wash in washing machine
Producer: Potomac Grupa d.o.o., Trg kralja Tomislava 4, 10000 Zagreb, RH
Production technique: Jacquard
Pattern: Directioned
Material composition : Silk 100%
Material type: Jacquard fabric
By clicking 'Accept All' you consent that we may collect information about you for various purposes, including: Functionality, Statistics and Marketing