Error executing template "Designs/Swift/Paragraph/Swift_ProductPrice.cshtml"
System.Data.SqlClient.SqlException (0x80131904): The transaction log for database 'Integration_v2023_LIVE' is full due to 'LOG_BACKUP'.
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.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Potomac.LiveIntegration.Connectors.DatabaseConnector.FetchPrice(String productNo, String currencyCode, String customerNumber, String vatRegistrationNumber, String region, String ProductLinked, Double& price)
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__48()
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 CompiledRazorTemplates.Dynamic.RazorEngine_581c0eabb6ad4d568252183ceb99e306.Execute() in C:\inetpub\wwwroot\DWProd_2025\Solutions\Swift_v1.21.0\Files\Templates\Designs\Swift\Paragraph\Swift_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()
ClientConnectionId:c97d8865-9fcd-48f5-97b3-926966b9d1b7
Error Number:9002,State:2,Class:17
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 1</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
165 if (product?.VariantInfo?.VariantInfo != null)
166 {
167 priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted != null ? product.VariantInfo.PriceMin.PriceFormatted : "";
168 priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted != null ? product.VariantInfo.PriceMax.PriceFormatted : "";
169 }
170 if (priceMin != priceMax)
171 {
172 price = priceMin + " - " + priceMax;
173 }
174 <span class="@theme @contentPadding">
175 <span class="text-price">@price</span>
176 </span>
177 }
178 }
179
180 @* Stock state for Schema.org, start *@
181 @{
182 Uri url = Dynamicweb.Context.Current.Request.Url;
183 }
184
185 <link itemprop="url" href="@url">
186
187 @{
188 bool IsNeverOutOfStock = product.NeverOutOfstock;
189 }
190
191 @if (IsNeverOutOfStock)
192 {
193 <span itemprop="availability" class="d-none">@Translate("Available in stock")</span>
194 }
195 else
196 {
197 if (product.StockLevel > 0)
198 {
199 <span itemprop="availability" class="d-none">InStock</span>
200 }
201 else
202 {
203 <span itemprop="availability" class="d-none">OutOfStock</span>
204 }
205 }
206 @* Stock state for Schema.org, stop *@
207
208 </div>
209
210 @if (showPricesWithVat == "false" && !neverShowVat)
211 {
212 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode)
213 {
214 <small class="opacity-85 fst-normal js-text-price-with-vat d-none" data-suffix="@Translate("Incl. VAT")"></small>
215 }
216 else
217 {
218 string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithVatFormatted : product.Price.PriceWithVatFormatted;
219
220 if (product?.VariantInfo?.VariantInfo != null)
221 {
222 priceMin = product?.VariantInfo?.PriceMin?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithVatFormatted : "";
223 priceMax = product?.VariantInfo?.PriceMax?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithVatFormatted : "";
224 }
225 if (priceMin != priceMax)
226 {
227 price = priceMin + " - " + priceMax;
228 }
229 <small class="opacity-85 fst-normal">@price @Translate("Incl. VAT")</small>
230 }
231 }
232 </div>
233 }
234 else if (Pageview.IsVisualEditorMode)
235 {
236 <div class="alert alert-dark m-0" role="alert">
237 <span>@Translate("No products available")</span>
238 </div>
239 }
240