GF8-000005-700N

14-32944-8-700
Gasfjeder C75/E203 M6 gevind
Returret
Bestillingsvare. Ingen returret.
Fabrikat/Passer til
Krosno
Weight
0,15
Endemontering
M6 gevind
Længde E (mm)
203
Tryk (N)
700
Vandring C (mm)
75
Gasfjeder type
GF8/19 Ø8mm stempel/Ø19mm hus
Returret
Bestillingsvare. Ingen returret.
Error executing template "Designs/Swift/Paragraph/Swift_ProductPriceTable.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Products.ProductManager.GetProductInfo(Product product, Settings settings, User user, LiveContext context, String unitId)
   at Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Products.ProductManager.GetProductInfo(Product product, Settings settings, User user)
   at CompiledRazorTemplates.Dynamic.RazorEngine_96e74e455f8f48cd926c19fc3d860f88.Execute() in D:\dynamicweb.net\Solutions\composeit\JS-Komponenter\Files\Templates\Designs\Swift\Paragraph\Swift_ProductPriceTable.cshtml:line 34
   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.Products; 4 @using Dynamicweb.Ecommerce.DynamicwebLiveIntegration; 5 @using Dynamicweb.Ecommerce.Prices; 6 @using Dynamicweb.Environment; 7 @using Dynamicweb.Ecommerce.Prices; 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.Page.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 26 string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); 27 bool anonymousUser = Pageview.User == null; 28 bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; 29 hidePrice = Pageview.IsVisualEditorMode ? false : hidePrice; 30 31 //#19870 - pricewmatrix fix start 32 var dwProduct = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, product.VariantId, Dynamicweb.Ecommerce.Common.Context.LanguageID); 33 var settings = Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Configuration.SettingsManager.GetSettingsByShop(Pageview.Area.EcomShopId); 34 var infoProduct = Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Products.ProductManager.GetProductInfo(dwProduct, settings, Pageview.User); 35 var prices = Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Products.ProductManager.GetPrices(infoProduct); 36 //#19870 - end 37 } 38 39 @if (product is object && !hidePrice) 40 { 41 bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); 42 43 if (Pageview.IsVisualEditorMode && product.Prices.Count == 0) 44 { 45 product.Prices.Add(new PriceListViewModel { Price = new PriceViewModel { Price = 95, PriceFormatted = "€95" }, Quantity = 1 }); 46 product.Prices.Add(new PriceListViewModel { Price = new PriceViewModel { Price = 85, PriceFormatted = "€85" }, Quantity = 2 }); 47 } 48 49 string layout = Model.Item.GetRawValueString("Layout", "list"); 50 51 //#19870 - pricewmatrix fix start 52 if (prices.Count > 0) 53 { 54 foreach (var price in prices) 55 { 56 PriceContext context = new PriceContext(Dynamicweb.Ecommerce.Common.Context.Currency, Dynamicweb.Ecommerce.Common.Context.Country); 57 var calculated = PriceCalculated.Create(context, new PriceRaw(price.Amount, price.Currency), dwProduct); 58 calculated.Calculate(); 59 product.Prices.Add(new PriceListViewModel 60 { 61 Quantity = price.Quantity, 62 UnitId = price.UnitId, 63 Price = new PriceViewModel 64 { 65 Price = calculated.Price, 66 PriceFormatted = calculated.PriceWithoutVATFormatted, 67 PriceWithVat = calculated.PriceWithVAT, 68 PriceWithVatFormatted = calculated.PriceWithVATFormatted, 69 PriceWithoutVat = calculated.PriceWithoutVAT, 70 PriceWithoutVatFormatted = calculated.PriceWithoutVATFormatted, 71 Vat = calculated.VAT, 72 VatFormatted = calculated.VATFormatted, 73 VATPercent = calculated.VATPercent, 74 VATPercentFormatted = calculated.VATPercentFormatted, 75 CurrencyCode = calculated.Currency.Code 76 }, 77 78 }); 79 } 80 81 if (layout == "list") 82 { 83 <div class="item_@Model.Item.SystemName.ToLower() list"> 84 @foreach (PriceListViewModel quantityPrice in product.Prices) 85 { 86 string quantityLabel = Translate("PCS"); 87 string quantityPriceSuffix = quantityPrice.Quantity > 1 ? Translate("pr. PCS") : ""; 88 89 <small class="d-block opacity-75"><span>@quantityPrice.Quantity @quantityLabel</span> - <span class="fw-bold">@quantityPrice.Price.PriceFormatted @quantityPriceSuffix</span></small> 90 } 91 </div> 92 } 93 else if (layout == "table") 94 { 95 <div class="item_@Model.Item.SystemName.ToLower() grid"> 96 <table class="table table-sm mt-3 g-col-12 g-col-lg-6"> 97 <thead> 98 <tr> 99 <td>@Translate("QTY")</td> 100 <td>@Translate("pr. PCS")</td> 101 </tr> 102 </thead> 103 <tbody> 104 @foreach (PriceListViewModel quantityPrice in product.Prices) 105 { 106 <tr> 107 <td>@quantityPrice.Quantity</td> 108 <td>@quantityPrice.Price.PriceFormatted</td> 109 </tr> 110 } 111 </tbody> 112 </table> 113 </div> 114 } 115 } 116 //#19870 - end 117 118 if (product.Prices.Count > 0) 119 { 120 if (isLazyLoadingForProductInfoEnabled) 121 { 122 <div class="product-prices-container d-none" data-show-if="LiveProductInfo.product.Prices.length > 0"> 123 @if (layout == "list") 124 { 125 <div class="product-prices item_@Model.Item.SystemName.ToLower() list"> 126 <small class="d-block opacity-75 product-prices-template"><span><span class="js-text-price-quantity"></span> @Translate("PCS")</span> - <span class="fw-bold"><span class="js-text-price-price"></span> <span class="d-none" data-show-if="LiveProductInfo.productPrice.Quantity > 1">@Translate("pr. PCS")</span></span></small> 127 </div> 128 } 129 else if (layout == "table") 130 { 131 <div class="item_@Model.Item.SystemName.ToLower() grid"> 132 <table class="table table-sm mt-3 g-col-12 g-col-lg-6"> 133 <thead> 134 <tr> 135 <td>@Translate("QTY")</td> 136 <td>@Translate("pr. PCS")</td> 137 </tr> 138 </thead> 139 <tbody class="product-prices"> 140 <tr class="product-prices-template"> 141 <td class="js-text-price-quantity"></td> 142 <td class="js-text-price-price"></td> 143 </tr> 144 </tbody> 145 </table> 146 </div> 147 } 148 </div> 149 } 150 @*else 151 { 152 if (layout == "list") 153 { 154 <div class="item_@Model.Item.SystemName.ToLower() list"> 155 @foreach (PriceListViewModel quantityPrice in product.Prices) 156 { 157 string quantityLabel = Translate("PCS"); 158 string quantityPriceSuffix = quantityPrice.Quantity > 1 ? Translate("pr. PCS") : ""; 159 160 <small class="d-block opacity-75"><span>@quantityPrice.Quantity @quantityLabel</span> - <span class="fw-bold">@quantityPrice.Price.PriceFormatted @quantityPriceSuffix</span></small> 161 } 162 </div> 163 } 164 else if (layout == "table") 165 { 166 <div class="item_@Model.Item.SystemName.ToLower() grid"> 167 <table class="table table-sm mt-3 g-col-12 g-col-lg-6"> 168 <thead> 169 <tr> 170 <td>@Translate("QTY")</td> 171 <td>@Translate("pr. PCS")</td> 172 </tr> 173 </thead> 174 <tbody> 175 @foreach (PriceListViewModel quantityPrice in product.Prices) 176 { 177 <tr> 178 <td>@quantityPrice.Quantity</td> 179 <td>@quantityPrice.Price.PriceFormatted</td> 180 </tr> 181 } 182 </tbody> 183 </table> 184 </div> 185 } 186 }*@ 187 } 188 else if (Pageview.IsVisualEditorMode) 189 { 190 <div class="alert alert-dark m-0" role="alert"> 191 <span>@Translate("No products available")</span> 192 </div> 193 } 194 } 195 else if (Pageview.IsVisualEditorMode) 196 { 197 <div class="alert alert-dark m-0" role="alert"> 198 <span>@Translate("No products available")</span> 199 </div> 200 } 201 202 <script> 203 document.addEventListener('DOMContentLoaded', function () { 204 // Function to get the value of a specific cookie 205 function getCookieValue(cookieName) { 206 const cookies = document.cookie.split('; '); 207 for (const cookie of cookies) { 208 const [name, value] = cookie.split('='); 209 if (name === cookieName) { 210 return value; 211 } 212 } 213 return null; // Return null if the cookie doesn't exist 214 } 215 216 // Specify the name of the cookie you want to check 217 const cookieName = 'ShowHidePrices'; 218 219 // Get the value of the specified cookie 220 const cookieValue = getCookieValue(cookieName); 221 const myDiv = document.getElementsByClassName('item_swift_productpricetable'); 222 223 // Check if the cookie value is 'true' 224 if (cookieValue === 'true') { 225 226 for (let i = 0; i < myDiv.length; i++) { 227 myDiv[i].style.display = 'none'; 228 } 229 230 } else { 231 if (myDiv) { 232 for (let i = 0; i < myDiv.length; i++) { 233 myDiv[i].style.display = 'unset'; 234 } 235 } 236 } 237 });</script>