TEST PAGE

Kravata CROATA

010100-004082
Error executing template "/Designs/Swift/Paragraph/DS_ProductPrice.cshtml"
System.IO.IOException: The process cannot access the file 'C:\inetpub\wwwroot\DWCroata2023_Test\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_0c54d5789b8c432eb8e8e4f05d7234a2.Execute() in C:\inetpub\wwwroot\DWCroata2023_Test\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 <section> 152 <p> 153 Stranica je trenutno nedostupna i neće biti dostupna neko vrijeme radi 154 održavanja. Molimo Vas pokušajte kasnije. 155 </p> 156 <p> 157 Site is currently under maintenance and will not be available for some 158 time. Please try again later. 159 </p> 160 </section> 161 } 162 } 163 else 164 { 165 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) 166 { 167 <span class="text-price js-text-price"> 168 <span class="spinner-border" role="status"></span> 169 </span> 170 } 171 else 172 { 173 string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product.Price.PriceFormatted; 174 var priceinKN = product.Price.Price * 7.53450; 175 176 if (product?.VariantInfo?.VariantInfo != null) 177 { 178 priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted != null ? product.VariantInfo.PriceMin.PriceFormatted : ""; 179 priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted != null ? product.VariantInfo.PriceMax.PriceFormatted : ""; 180 } 181 if (priceMin != priceMax) 182 { 183 price = priceMin + " - " + priceMax; 184 } 185 <span class="@theme @contentPadding"> 186 <span class="text-price">@price</span> 187 @* @if(Pageview.Area.Culture.ToString() == "hr-HR") {<span class="priceinKN">(@priceinKN.ToString("N2") kn)</span> }*@ 188 </span> 189 } 190 } 191 192 @* Stock state for Schema.org, start *@ 193 @{ 194 Uri url = Dynamicweb.Context.Current.Request.Url; 195 } 196 197 <link itemprop="url" href="@url"> 198 199 @{ 200 bool IsNeverOutOfStock = product.NeverOutOfstock; 201 } 202 203 @if (IsNeverOutOfStock) 204 { 205 <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> 206 } 207 else 208 { 209 if (product.StockLevel > 0) 210 { 211 <span itemprop="availability" class="d-none">InStock</span> 212 } 213 else 214 { 215 <span itemprop="availability" class="d-none">OutOfStock</span> 216 } 217 } 218 @* Stock state for Schema.org, stop *@ 219 220 </div> 221 222 @if (showPricesWithVat == "false" && !neverShowVat) 223 { 224 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) 225 { 226 <small class="opacity-85 fst-normal js-text-price-with-vat d-none" data-suffix="@Translate("Incl. VAT")"></small> 227 } 228 else 229 { 230 string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithVatFormatted : product.Price.PriceWithVatFormatted; 231 232 if (product?.VariantInfo?.VariantInfo != null) 233 { 234 priceMin = product?.VariantInfo?.PriceMin?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithVatFormatted : ""; 235 priceMax = product?.VariantInfo?.PriceMax?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithVatFormatted : ""; 236 } 237 if (priceMin != priceMax) 238 { 239 price = priceMin + " - " + priceMax; 240 } 241 <small class="opacity-85 fst-normal">@price @Translate("Incl. VAT")</small> 242 } 243 } 244 </div> 245 } 246 else if (Pageview.IsVisualEditorMode) 247 { 248 <div class="alert alert-dark m-0" role="alert"> 249 <span>@Translate("No products available")</span> 250 </div> 251 } 252
Error executing template "/Designs/Swift/Paragraph/DS_ProductAddToCart.cshtml"
System.IO.IOException: The process cannot access the file 'C:\inetpub\wwwroot\DWCroata2023_Test\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_123a162903fb4700a273b23f027914d1.Execute() in C:\inetpub\wwwroot\DWCroata2023_Test\Solutions\Swift_v1.21.0\Files\Templates\Designs\Swift\Paragraph\DS_ProductAddToCart.cshtml:line 138
   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 @if (product is object && !hideAddToCart) { 31 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 32 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 33 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 34 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 35 36 bool favoritesSelector = !string.IsNullOrEmpty(Model.Item.GetString("ShowAddToFavorites")) ? Model.Item.GetBoolean("ShowAddToFavorites") : false; 37 bool quantitySelector = !string.IsNullOrEmpty(Model.Item.GetString("ShowQuantitySelector")) ? Model.Item.GetBoolean("ShowQuantitySelector") : false; 38 bool unitsSelector = !string.IsNullOrEmpty(Model.Item.GetString("ShowUnitsSelector")) ? Model.Item.GetBoolean("ShowUnitsSelector") : false; 39 bool hideInventory = !string.IsNullOrEmpty(Model.Item.GetString("HideInventory")) ? Model.Item.GetBoolean("HideInventory") : false; 40 bool hideStockState = !string.IsNullOrEmpty(Model.Item.GetString("HideStockState")) ? Model.Item.GetBoolean("HideStockState") : false; 41 42 string buttonSize = Model.Item.GetRawValueString("ButtonSize", "regular"); 43 string inputSize = string.Empty; 44 45 switch (buttonSize) 46 { 47 case "small": 48 inputSize = " input-group-sm"; 49 buttonSize = " btn-sm"; 50 break; 51 case "regular": 52 buttonSize = string.Empty; 53 break; 54 case "large": 55 inputSize = " input-group-lg"; 56 buttonSize = " btn-lg"; 57 break; 58 } 59 60 string iconPath = "/Files/icons/"; 61 string url = "/Default.aspx?ID=" + (GetPageIdByNavigationTag("CartService")); 62 if (!url.Contains("LayoutTemplate")) 63 { 64 url += url.Contains("?") ? "&LayoutTemplate=Swift_MiniCart.cshtml" : "?LayoutTemplate=Swift_MiniCart.cshtml"; 65 } 66 67 string disableAddToCart = (product.StockLevel <= 0) ? "disabled" : ""; 68 bool isNeverOutOfStock = product.NeverOutOfstock; 69 disableAddToCart = isNeverOutOfStock ? "" : disableAddToCart; 70 71 string whenVariantsExist = Model.Item.GetRawValueString("WhenVariantsExist", "hide"); 72 73 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 74 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 75 string addToCartIcon = Model.Item.GetRawValueString("Icon", iconPath + "shopping-cart.svg"); 76 string addToCartLabel = !addToCartIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(addToCartIcon) + "</span>" : ""; 77 addToCartLabel += !addToCartIcon.Contains("_none") && !Model.Item.GetBoolean("HideButtonText") ? " " : ""; 78 addToCartLabel += !Model.Item.GetBoolean("HideButtonText") ? Translate("Add to cart") : ""; 79 string imagePath = product?.DefaultImage?.Value ?? ""; 80 imagePath = Dynamicweb.Context.Current.Server.UrlEncode(imagePath); 81 string ratio = Model.Item.GetRawValueString("ImageAspectRatio", ""); 82 ratio = ratio != "0" ? ratio : ""; 83 string ratioCssClass = ratio != "" ? " ratio" : ""; 84 string ratioVariable = ratio != "" ? "--bs-aspect-ratio: " + ratio : ""; 85 86 string width = Model.Item.GetRawValueString("Width", "auto"); 87 int smallImageSize = 640; 88 int largeImageSize = width == "auto" ? 1280 : Convert.ToInt32(width); 89 string imagePathXs = "/Admin/Public/GetImage.ashx?width=" + smallImageSize + "&image=" + imagePath + "&format=webp"; 90 string imagePathS = "/Admin/Public/GetImage.ashx?width=" + largeImageSize + "&image=" + imagePath + "&format=webp"; 91 string imagePathFallBack = "/Admin/Public/GetImage.ashx?width=" + largeImageSize + "&image=" + imagePath + "&format=webp"; 92 93 94 if (product.VariantInfo.VariantInfo == null || whenVariantsExist == "disable") { 95 string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : product.DefaultUnitId; 96 if (string.IsNullOrEmpty(unitId) && product?.UnitOptions != null) { 97 if (product.UnitOptions.FirstOrDefault<UnitOptionViewModel>() != null) { 98 unitId = product.UnitOptions.FirstOrDefault<UnitOptionViewModel>().Id; 99 } 100 } 101 102 string minQty = product.PurchaseMinimumQuantity != 1 ? "min=\"" + product.PurchaseMinimumQuantity.ToString() + "\"" : "min=\"1\""; 103 string stepQty = product.PurchaseQuantityStep > 1 ? product.PurchaseQuantityStep.ToString() : "1"; 104 string valueQty = product.PurchaseMinimumQuantity > product.PurchaseQuantityStep ? product.PurchaseMinimumQuantity.ToString() : stepQty; 105 disableAddToCart = product.VariantInfo.VariantInfo != null && string.IsNullOrEmpty(product.VariantId) ? "disabled" : disableAddToCart; 106 107 var reserveMode = Dynamicweb.Ecommerce.Frontend.Cart.ProductReserve.Mode; 108 109 110 //IvanM 15.04.2024. - Adding default box to cart setup field 111 //------------------------------------------------------------------ 112 string DefaultBoxProductId = null; 113 Dynamicweb.Ecommerce.Products.Product boxProduct = null; 114 115 116 if (product.ProductFields.ContainsKey("DefaultBox")) 117 { 118 if (product.ProductFields["DefaultBox"] != null) 119 { 120 DefaultBoxProductId = product.ProductFields["DefaultBox"].Value.ToString(); 121 if (DefaultBoxProductId != null) 122 { 123 var dwProductServices = Dynamicweb.Ecommerce.Services.Products; 124 boxProduct = dwProductServices.GetProductById(DefaultBoxProductId, product.VariantId, product.LanguageId); 125 } 126 127 } 128 } 129 //------------------------------------------------------------------ 130 //IvanM 15.04.2024. - Adding default box to cart setup field -- end 131 132 if (unitsSelector && product.UnitOptions.Count > 0) { 133 <form method="post" action="/Default.aspx?ID=@(Pageview.Page.ID)&ProductId=@product.Id" id="UnitSelectorForm_@(product.Id)_@(product.VariantId)_@Model.ID"> 134 <input type="hidden" name="redirect" value="false"> 135 <input type="hidden" name="VariantID" value="@product.VariantId"> 136 <input type="hidden" name="UnitID" class="js-unit-id" value="@unitId"> 137 </form> 138 } 139 140 <div class="@DefaultBoxProductId d-flex @horizontalAlign @fullWidth js-input-group item_@Model.Item.SystemName.ToLower()"> 141 <form method="post" action="@url" class="@fullWidth" style="z-index: 1"> 142 <input type="hidden" name="redirect" value="false"> 143 <input type="hidden" name="ProductId" value="@product.Id"> 144 <input type="hidden" name="ProductName" value="@product.Name"> 145 <input type="hidden" name="ProductVariantName" value="@product.VariantName"> 146 <input type="hidden" name="ProductCurrency" value="@Dynamicweb.Ecommerce.Common.Context.Currency.Code"> 147 <input type="hidden" name="ProductPrice" value="@PriceViewModelExtensions.ToStringInvariant(product.Price)"> 148 <input type="hidden" name="ProductReferer" value="component_ProductAddToCart"> 149 <input type="hidden" name="cartcmd" value="add"> 150 @if(boxProduct!=null){ 151 <input type="hidden" name="EcomOrderLineFieldInput_LinkedItem" value="@boxProduct.Id"> 152 } 153 154 @if (reserveMode == Dynamicweb.Ecommerce.Frontend.Cart.ProductReserveMode.AddToCart) 155 { 156 <input type="hidden" name="GetReservedAmount" value="true"> 157 } 158 159 @if (!string.IsNullOrEmpty(product.VariantId)) 160 { 161 <input type="hidden" name="VariantId" value="@product.VariantId"> 162 } 163 164 @if (!product.NeverOutOfstock) 165 { 166 <input type="hidden" name="Stock" value="@product.StockLevel"> 167 168 <template class="js-out-of-stock-notice"> 169 <div class="modal-header"> 170 <h1 class="modal-title fs-5">@Translate("Stock limit")</h1> 171 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> 172 </div> 173 <div class="modal-body"> 174 @Translate("There are not enough products in stock. The product might be sold out or discontinued. Please adjust the quantity.") 175 </div> 176 </template> 177 } 178 179 @if (stepQty != "1") 180 { 181 <template class="js-step-quantity-warning"> 182 <div class="modal-header"> 183 <h1 class="modal-title fs-5">@Translate("The quantity is not valid")</h1> 184 </div> 185 <div class="modal-body"> 186 @Translate("Please select a quantity that is dividable by") @stepQty 187 </div> 188 </template> 189 } 190 @if (product.PurchaseMinimumQuantity != 1) 191 { 192 <template class="js-min-quantity-warning"> 193 <div class="modal-header"> 194 <h1 class="modal-title fs-5">@Translate("The product could not be added to the cart")</h1> 195 </div> 196 <div class="modal-body"> 197 @Translate("The quantity is not valid. You must buy at least") @product.PurchaseMinimumQuantity 198 </div> 199 </template> 200 } 201 202 @if (quantitySelector || (!anonymousUser && product.VariantInfo.VariantInfo != null) || (!anonymousUser && favoritesSelector)) 203 { 204 <input type="hidden" id="Unit_@(product.Id)_@product.VariantId" name="UnitID" value="@unitId" /> 205 } 206 207 <div class="d-flex flex-row w-100"> 208 @if (!anonymousUser && favoritesSelector) 209 { 210 @RenderPartial("Components/ToggleFavorite.cshtml", product) 211 } 212 213 @if (!quantitySelector) 214 { 215 <input id="Quantity_@(product.Id)_@product.VariantId" name="Quantity" value="@valueQty" type="hidden" @disableAddToCart> 216 } 217 218 <div class="input-group input-primary-button-group flex-nowrap@(inputSize)"> 219 @if(product.StockLevel>0){ 220 if (quantitySelector) 221 { 222 <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> 223 } 224 225 if (unitsSelector && product.UnitOptions.Count > 0) 226 { 227 string selectedUnitName = !string.IsNullOrEmpty(unitId) && product?.UnitOptions != null ? unitId : product.UnitOptions.FirstOrDefault<UnitOptionViewModel>().Name; 228 229 foreach (var unitOption in product.UnitOptions) 230 { 231 if (unitOption.Id == unitId) 232 { 233 selectedUnitName = unitOption.Name; 234 } 235 } 236 237 <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> 238 @selectedUnitName 239 </button> 240 <ul class="dropdown-menu swift_unit-field"> 241 @foreach (var unitOption in product.UnitOptions) 242 { 243 var selectedUnit = unitOption.Id == unitId ? "selected" : ""; 244 245 <li> 246 <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'); 247 document.querySelector('#Unit_@(product.Id)_@product.VariantId').value = this.getAttribute('data-value'); 248 swift.PageUpdater.Update(document.querySelector('#UnitSelectorForm_@(product.Id)_@(product.VariantId)_@Model.ID'))"> 249 <span>@unitOption.Name</span> 250 <span> 251 @if (unitOption.StockLevel > 0) 252 { 253 if (!Model.Item.GetBoolean("HideInventory")) 254 { 255 <span class="small text-success">@unitOption.StockLevel @Translate("In stock")</span> 256 } 257 else 258 { 259 <span class="small text-success">@Translate("In stock")</span> 260 } 261 } 262 else 263 { 264 <span class="small text-danger">@Translate("Out of Stock")</span> 265 } 266 </span> 267 </button> 268 </li> 269 } 270 </ul> 271 } 272 273 <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"> 274 @if (!Model.Item.GetBoolean("HideButtonText")) 275 { 276 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 277 @addToCartLabel 278 </span> 279 } 280 else 281 { 282 @addToCartLabel 283 } 284 </button> 285 <div aria-live="polite" aria-atomic="true"> 286 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11"> 287 <div id="AddToCartInfo" class="toast hide" role="alert" aria-live="assertive" aria-atomic="true" autohide="true"> 288 <div class="toast-header"> 289 <strong class="me-auto">@Translate("Product is added to the cart")</strong> 290 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button> 291 </div> 292 <div class="toast-body d-flex gap-3"> 293 <div id="AddToCartInfoNotificationToast_Image"><img src="@imagePathXs" style="width:100px;"></div> 294 <div id="AddToCartInfoNotificationToast_Text" >@(product.Name)<br> 295 @(product.Id)</div> 296 </div> 297 </div> 298 </div> 299 </div> 300 <script> 301 function AddToCartInfo() { 302 document.getElementById("AddToCartInfo").classList.add("show"); 303 setTimeout(function() { 304 document.getElementById("AddToCartInfo").classList.remove("show"); 305 }, 3000); 306 } 307 </script> 308 309 310 311 312 313 } else { 314 315 <div class="productNotAvailable text-nowrap d-flex align-items-center justify-content-center gap-2">@Translate("This product is currently not available.")</div> 316 317 } 318 </div> 319 </div> 320 </form> 321 </div> 322 } else if (whenVariantsExist == "modal") { 323 string buttonText = Translate("Select"); 324 325 string variantSelectorServicePageId = !string.IsNullOrEmpty(Model.Item.GetString("VariantSelectorServicePageId")) ? Model.Item.GetLink("VariantSelectorServicePageId").PageId.ToString() : ""; 326 variantSelectorServicePageId = variantSelectorServicePageId != "" ? variantSelectorServicePageId : GetPageIdByNavigationTag("VariantSelectorService").ToString(); 327 328 <div class="d-flex @horizontalAlign w-100 item_@Model.Item.SystemName.ToLower()"> 329 @if (!anonymousUser && favoritesSelector) 330 { 331 @RenderPartial("Components/ToggleFavorite.cshtml", product) 332 } 333 <form action="/Default.aspx?ID=@variantSelectorServicePageId" data-response-target-element="DynamicModalContent" data-preloader="inline" style="z-index: 1" class="@fullWidth"> 334 <input type="hidden" name="ProductID" value="@product.Id"> 335 <input type="hidden" name="QuantitySelector" value="@quantitySelector.ToString()"> 336 <input type="hidden" name="HideInventory" value="@hideInventory.ToString()"> 337 <input type="hidden" name="HideStockState" value="@hideStockState.ToString()"> 338 <input type="hidden" name="VariantSelectorServicePage" value="@variantSelectorServicePageId"> 339 <input type="hidden" name="ViewType" value="ModalContent"> 340 <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> 341 </form> 342 </div> 343 } 344 } else if (Pageview.IsVisualEditorMode) { 345 <div class="alert alert-dark m-0">@Translate("No products available")</div> 346 } 347 <section> 348 <style> 349 .js-add-to-cart-button, .Cart.nav-item {!display:none} 350 </style> 351 <p style="color:red;display:none">@Translate("maintenance mode line")</p> 352 </section>

+ INFO O PROIZVODU

Dezen: Tematski
Motiv: Pleter
Boja: Marelica
Proizvod: Kravata
Veličina: Standardna 8 cm
Brand: CROATA
Sirovinski sastav : Svila 100%

+ MATERIJAL I ODRŽAVANJE

Obrada materijala: Obična
Održavanje: Zabranjeno strojno pranje
Proizvođač: Potomac Grupa d.o.o., Trg kralja Tomislava 4, 10000 Zagreb, RH
Tehnika izrade: Obično tkanje
Uzorak: Usmjereni
Sirovinski sastav : Svila 100%
Vrsta materijala: Jacquardne tkanine
Klikom na 'Prihvatite sve' pristajete na prikupljanje informacija o Vama u različite namjene uključujući: funkcionalnost, statistiku i marketing
Multiply icon