Topp Bilde
Error executing template "Designs/EG/eCom/Product/Product.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_25e86851484a4fc0ac73a61393a21a14.Execute() in D:\home\site\wwwroot\Solution\Files\Templates\Designs\EG\eCom\Product\Product.cshtml:line 859
   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.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 3 @{ 4 int productListPageId = GetInteger("Ecom:ProductList:Page.ID"); 5 var assortmentService = new Dynamicweb.Ecommerce.Assortments.AssortmentService(); 6 var assortmentId = assortmentService.GetAssortmentIdsByUser(Dynamicweb.Security.UserManagement.User.GetCurrentUser()); 7 // var assortmentId = assortmentService.GetAssortmentIdsByUser(Dynamicweb.Security.UserManagement.User.Current().Dynamicweb.Security.UserManagement.PagePermissionLevels.Frontend ); 8 9 var mode2 = Pageview.Area.Item["Mode"]; 10 string[] modeArray2 = (mode2 != null) ? mode2.ToString().Split(',') : new string[0]; 11 } 12 13 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 14 15 @using System.Web; 16 @using System.Linq; 17 @using Dynamicweb.Ecommerce; 18 @using CustomCode.Functions; 19 20 21 22 @functions 23 { 24 private List<string> GetGroupAndSubGroups(string groupId) 25 { 26 List<string> groups = new List<string>(); 27 groups.Add(groupId); 28 29 Dynamicweb.Ecommerce.Products.GroupService service = new Dynamicweb.Ecommerce.Products.GroupService(); 30 31 foreach (var subGroup in service.GetGroup(groupId).Subgroups) 32 { 33 groups.AddRange(GetGroupAndSubGroups(subGroup.Id)); 34 } 35 36 return groups; 37 } 38 } 39 40 @helper RenderEcomNavigation(Dynamicweb.Ecommerce.Products.GroupCollection groupCollection, int level, int catalogPageID, string currentGroupID) 41 { 42 var shopService = new Dynamicweb.Ecommerce.Shops.ShopService(); 43 groupCollection = (groupCollection == null) ? shopService.GetShop(Dynamicweb.Frontend.PageView.Current().Area.EcomShopId).TopLevelGroups : groupCollection; 44 45 foreach (Dynamicweb.Ecommerce.Products.Group group in groupCollection) 46 { 47 bool existsInBranch = (GetGroupAndSubGroups(group.Id).Where(node => node == currentGroupID).FirstOrDefault() != null) ? true : false; 48 bool showInMenu = group.NavigationShowInMenu; 49 bool hasImage = !string.IsNullOrEmpty(group.SmallImage); 50 bool hasDescription = !string.IsNullOrEmpty(group.Description); 51 52 if (showInMenu) 53 { 54 <li class='@(((group.Id == currentGroupID) || existsInBranch) ? "active" : string.Empty)'> 55 <div class="row" style="cursor:pointer;" onclick="window.location = '/Default.aspx?ID=@catalogPageID&GroupID=@group.Id'; BlockUI();"> 56 <div class="col-4" style="display:flex; align-items:center; justify-content:left;"> 57 @if (hasImage) 58 { 59 <img src="/admin/public/GetImage.ashx?image=/Files/@(group.SmallImage)&width=95&height=50&crop=5&Compression=100&DoNotUpscale=False&Resolution=72" /> 60 } 61 </div> 62 <div class="col-8" style="padding-left:0;"> 63 <div><a style="border:none; padding:0;" href='/Default.aspx?ID=@catalogPageID&GroupID=@group.Id' class='@((group.Id == currentGroupID) ? "scheme_color" : "color_dark")'>@group.Name</a></div> 64 @if (hasDescription) 65 { 66 <div style="color:#ccc;">@group.Description.Replace("<p>", string.Empty).Replace("</p>", string.Empty)</div> 67 } 68 </div> 69 </div> 70 @if (group.HasChildGroups) 71 { 72 <ul style="margin:10px 0 10px; border-bottom:1px solid #eee; border-top:1px solid #eee; padding:5px 0 10px 0;" class='@((existsInBranch) ? string.Empty : "d_none")'> 73 @RenderEcomNavigation(group.Subgroups, (level + 1), catalogPageID, currentGroupID) 74 </ul> 75 } 76 </li> 77 } 78 } 79 } 80 81 @helper RenderEcomNavigationMobile(Dynamicweb.Ecommerce.Products.GroupCollection groupCollection, int level, int catalogPageID, string currentGroupID) 82 { 83 var shopService = new Dynamicweb.Ecommerce.Shops.ShopService(); 84 groupCollection = (groupCollection == null) ? shopService.GetShop(Dynamicweb.Frontend.PageView.Current().Area.EcomShopId).TopLevelGroups : groupCollection; 85 86 foreach (Dynamicweb.Ecommerce.Products.Group group in groupCollection) 87 { 88 bool existsInBranch = (GetGroupAndSubGroups(group.Id).Where(node => node == currentGroupID).FirstOrDefault() != null) ? true : false; 89 bool showInMenu = group.NavigationShowInMenu; 90 91 if (showInMenu) 92 { 93 <option value="@group.Id" @((group.Id == currentGroupID) ? "selected" : string.Empty)>@group.Name</option> 94 } 95 } 96 } 97 98 @helper RenderProductGroups() 99 { 100 int catalogPageID = Ecom.GetPageIdByLink(Pageview.Area.Item["ProductCatalogPage"].ToString()); 101 string currentGroupID = HttpContext.Current.Request["GroupID"]; 102 bool isMobile = false; 103 bool.TryParse(GetGlobalValue("Global:Device.IsMobile"), out isMobile); 104 var brandCode = GetString("Ecom:Product:Field.BrandCode"); 105 106 List<LoopItem> facetGroups = GetLoop("FacetGroups"); 107 108 <div class="col-12 col-lg-3"> 109 @* Brand code logo on product page *@ 110 @if (!string.IsNullOrEmpty(brandCode)) 111 { 112 <div class="m_bottom_30"> 113 <img src="/admin/public/GetImage.ashx?image=/Files/Images/@(brandCode.ToLower()).png&width=150&height=150&crop=5&Compression=100" alt="@brandCode" /> 114 </div> 115 } 116 117 @* Product groups *@ 118 <div class="m_bottom_30"> 119 <div class="js-filter-options"> 120 @if (isMobile) 121 { 122 <select class="custom-select" onchange="BlockUI(); window.location = '/Default.aspx?ID=@catalogPageID&GroupID=' + this.options[this.selectedIndex].value"> 123 <option value="@currentGroupID">Velg varegruppe</option> 124 @RenderEcomNavigationMobile(null, 1, catalogPageID, currentGroupID) 125 </select> 126 } 127 else 128 { 129 <ul class="categories_list"> 130 @RenderEcomNavigation(null, 1, catalogPageID, currentGroupID) 131 </ul> 132 } 133 </div> 134 </div> 135 136 @if (facetGroups.Count > 0) 137 { 138 var selectedFilters = 0; 139 140 <form method="get" action=""> 141 <figure class="widget shadow r_corners wrapper m_bottom_30"> 142 <figcaption> 143 <h5 class="color_light js-filter-toggle" style="margin:0; padding:0;"> 144 @Translate("Ecom.Filter.Title", "Filters") 145 <i class="fa fa-plus color_light f_right"></i> 146 147 </h5> 148 149 </figcaption> 150 <div class="widget_content collapse collapse-xl-none js-filter-options"> 151 <fieldset> 152 <input type='hidden' name='ID' value='@Pageview.Page.ID' /> 153 @foreach (LoopItem facetGroup in facetGroups) 154 { 155 foreach (LoopItem facetItem in facetGroup.GetLoop("Facets")) 156 { 157 var facetOptions = facetItem.GetLoop("FacetOptions"); 158 var facetRenderType = facetItem.GetString("Facet.RenderType"); 159 var name = facetItem.GetString("Facet.Name"); 160 161 if (facetOptions.Count > 0) 162 { 163 var queryParameter = facetItem.GetString("Facet.QueryParameter"); 164 165 if (facetRenderType == "Checkboxes") 166 { 167 var i = 0; 168 169 <legend class="default_t_color f_size_large m_bottom_15 clearfix full_width relative"> 170 <span class="f_left">@Translate(name)</span> 171 </legend> 172 173 foreach (LoopItem FacetOption in facetOptions) 174 { 175 var value = FacetOption.GetValue("FacetOption.Value"); 176 var selected = FacetOption.GetBoolean("FacetOption.Selected"); 177 var label = FacetOption.GetString("FacetOption.Label"); 178 var count = FacetOption.GetInteger("FacetOption.Count"); 179 180 label = label == "True" || label == "False" ? Translate(label) : label; 181 182 // Custom selected check since DW dont pick up on int32 beeing set in query 183 if (!selected) 184 { 185 var queryValues = HttpContext.Current.Request.QueryString.GetValues(queryParameter); 186 if (queryValues != null && queryValues.Length > 0) { selected = queryValues.Contains((string)value); }; 187 } 188 189 if (selected) 190 { 191 selectedFilters++; 192 } 193 194 if (count > 0) 195 { 196 <div class="full_width row"> 197 <label class="checkbox" for="@queryParameter@i"> 198 <input value="@value" id="@queryParameter@i" name="@queryParameter" checked="@selected" type="checkbox" class="filter-option col-2" /> 199 <span></span> 200 @label (@count) 201 </label> 202 </div> 203 } 204 205 i++; 206 } 207 <hr class="m_top_20 m_bottom_20" /> 208 209 } 210 211 else if (facetRenderType == "Select") 212 { 213 var i = 0; 214 215 216 217 <legend class="default_t_color f_size_large m_bottom_15 clearfix full_width relative"> 218 <span class="f_left">@name</span> 219 </legend> 220 221 <select name="@queryParameter" class="custom-select filter-select"> 222 <option></option> 223 224 @foreach (LoopItem FacetOption in facetOptions) 225 { 226 var value = FacetOption.GetValue("FacetOption.Value"); 227 var selected = FacetOption.GetBoolean("FacetOption.Selected"); 228 var label = FacetOption.GetString("FacetOption.Label"); 229 var count = FacetOption.GetInteger("FacetOption.Count"); 230 231 label = label == "True" || label == "False" ? Translate(label) : label; 232 233 // Custom selected check since DW dont pick up on int32 beeing set in query 234 if (!selected) 235 { 236 var queryValues = HttpContext.Current.Request.QueryString.GetValues(queryParameter); 237 if (queryValues != null && queryValues.Length > 0) { selected = queryValues.Contains((string)value); }; 238 } 239 240 if (selected) 241 { 242 selectedFilters++; 243 } 244 245 if (count > 0) 246 { 247 <option @(selected ? "selected" : string.Empty) value="@value">@label (@count)</option> 248 } 249 250 i++; 251 } 252 </select> 253 <hr class="m_top_20 m_bottom_20" /> 254 255 } 256 else if (facetRenderType == "Range" && !isMobile) 257 { 258 string param = HttpContext.Current.Request[queryParameter]; 259 var rangeMin = facetOptions[0].GetValue("FacetOption.Value"); 260 var rangeMax = facetOptions[facetOptions.Count - 1].GetValue("FacetOption.Value"); 261 var rangeFrom = (!string.IsNullOrEmpty(param)) ? param.Split(',')[0] : rangeMin; 262 var rangeTo = (!string.IsNullOrEmpty(param)) ? param.Split(',')[1] : rangeMax; 263 264 <legend class="default_t_color f_size_large m_bottom_15 clearfix full_width relative"> 265 <span class="f_left">@name</span> 266 </legend> 267 268 <div id="totalvekt" data-range-from="@rangeFrom" data-range-to="@rangeTo" data-range-min="@rangeMin" data-range-max="@rangeMax" class="slider m_bottom_10"></div> 269 <div class="clearfix range_values"> 270 <input class="f_left first_limit" readonly="" name="" type="text" value="@rangeFrom"> 271 <input class="f_right last_limit t_align_r" readonly="" name="" type="text" value="@rangeTo"> 272 <input class="sliderQueryParameter" type="hidden" name="@queryParameter" value="@rangeFrom,@rangeTo" /> 273 </div> 274 <hr class="m_top_20 m_bottom_20" /> 275 } 276 } 277 //else 278 //{ 279 @*<div>@Translate("Ecom.Filter.NoFilterOptions", "No filter options")</div>*@ 280 //} 281 } 282 } 283 <div> 284 <button id="filter-submit" onclick="BlockUI();" type="submit" class="tr_delay_hover r_corners button_type_3 f_size_medium bg_scheme_color color_light">@Translate("Ecom.Filter.ApplyFilters", "Apply filters")</button> 285 @if (selectedFilters > 0) 286 { 287 <a onclick="BlockUI();" href="/Default.aspx?ID=@Pageview.Page.ID" class="tr_delay_hover r_corners button_type_3 m_top_10 f_left f_size_medium t_align_c color_dark bg_light_color_2">@Translate("Ecom.Filter.ClearAll", "Clear filters")</a> 288 } 289 </div> 290 </fieldset> 291 </div> 292 </figure> 293 </form> 294 } 295 </div> 296 } 297 298 299 300 @helper RenderProductFiltersRow() 301 { 302 303 int catalogPageID = Ecom.GetPageIdByLink(Pageview.Area.Item["ProductCatalogPage"].ToString()); 304 string currentGroupID = HttpContext.Current.Request["GroupID"]; 305 bool isMobile = false; 306 bool.TryParse(GetGlobalValue("Global:Device.IsMobile"), out isMobile); 307 308 List<LoopItem> facetGroups = GetLoop("FacetGroups"); 309 310 if (facetGroups.Count > 0) 311 { 312 var selectedFilters = 0; 313 <div class="col-12 my-2"> 314 <div class="row "> 315 @foreach (LoopItem facetGroup in facetGroups) 316 { 317 foreach (LoopItem facetItem in facetGroup.GetLoop("Facets")) 318 { 319 var facetOptions = facetItem.GetLoop("FacetOptions"); 320 var facetRenderType = facetItem.GetString("Facet.RenderType"); 321 var name = facetItem.GetString("Facet.Name"); 322 323 if (facetOptions.Count > 0) 324 { 325 var queryParameter = facetItem.GetString("Facet.QueryParameter"); 326 327 328 var i = 0; 329 330 <div class="col"> 331 <label for="@queryParameter">@name</label> 332 <select name="@queryParameter" class="custom-select filter-select" onchange="filterSelect()"> 333 <option></option> 334 335 @foreach (LoopItem FacetOption in facetOptions) 336 { 337 var value = FacetOption.GetValue("FacetOption.Value"); 338 var selected = FacetOption.GetBoolean("FacetOption.Selected"); 339 var label = FacetOption.GetString("FacetOption.Label"); 340 var count = FacetOption.GetInteger("FacetOption.Count"); 341 342 label = label == "True" || label == "False" ? Translate(label) : label; 343 344 // Custom selected check since DW dont pick up on int32 beeing set in query 345 if (!selected) 346 { 347 var queryValues = HttpContext.Current.Request.QueryString.GetValues(queryParameter); 348 if (queryValues != null && queryValues.Length > 0) { selected = queryValues.Contains((string)value); }; 349 } 350 351 if (selected) 352 { 353 selectedFilters++; 354 } 355 356 if (count > 0) 357 { 358 <option @(selected ? "selected" : string.Empty) value="@value">@label (@count)</option> 359 } 360 361 i++; 362 } 363 </select> 364 </div> 365 } 366 367 } 368 369 } 370 </div> 371 </div> 372 373 if (selectedFilters > 0) 374 { 375 <div class="col-12"> 376 <div class="row"> 377 <div class="col-2 my-2"> 378 379 <button onclick="resetFilters()" class="tr_delay_hover r_corners button_type_16 f_size_medium color_dark bg_light_color_2">@Translate("Ecom.Filter.ClearAll", "Clear filters")</button> 380 </div> 381 </div> 382 </div> 383 } 384 } 385 } 386 387 388 <div class="row"> 389 390 @if (assortmentId.Count() == 0) 391 { 392 @RenderProductGroups() 393 } 394 <section class="@((assortmentId.Count() == 0) ? "col-9" : "col-12")"> 395 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 396 397 @using CustomCode.Functions; 398 @using Dynamicweb.Ecommerce; 399 400 @{ 401 var userID = int.Parse(GetGlobalValue("Global:Extranet.UserID")); 402 var thisUrl = HttpContext.Current.Request.Url; 403 404 405 // Description 406 var id = GetString("Ecom:Product.ID"); 407 var description = string.Empty; 408 var longDescription = GetString("Ecom:Product.LongDescription"); 409 var socialMediaButtons = (bool)Pageview.Area.Item["SocialMediaButtons"]; 410 var productImagesFolder = (string)Pageview.Area.Item["ProductImagesFolder"]; 411 var showRelatedItems = (bool)Pageview.Area.Item["ShowRelatedItems"]; 412 var showViewedByOtherCustomers = (bool)Pageview.Area.Item["ShowViewedByOtherCustomers"]; 413 var imageCustom = GetString("Product.ImageCustom"); 414 var wishListPageID = Ecom.GetPageIdByLink(Pageview.Area.Item["WishList"].ToString()); 415 var languageID = GetString("Ecom:Product.LanguageID"); 416 var dbPrice = GetDouble("Ecom:Product.DBPrice"); 417 var salesPrice = GetDouble("Ecom:Product.Price"); 418 var url = string.Format("/Default.aspx?id={0}&ProductID={1}&LanguageID={2}", wishListPageID, id, languageID); 419 var stockNumber = GetDouble("Ecom:Product.Stock"); 420 var stockText = GetString("Ecom:Product:Stock.Text"); 421 var stockImage = GetValue("Ecom:Product:Stock.Image"); 422 var stock = (!string.IsNullOrEmpty(stockText)) ? string.Format("{0} {1}", stockText, stockImage) : string.Format("{0} stk.", stockNumber > 0 ? stockNumber : 0); 423 var debug = "debug"; 424 var limit = GetInteger("Ecom:Product:Field.StockLimit"); 425 var defaultImage = GetString("Ecom:Product.ImageDefault.Default.Clean"); 426 427 var variantCount = GetInteger("Ecom:Product.VariantCount"); 428 429 int sizeArray = 0; 430 431 432 var shortDescription = GetString("Ecom:Product.ShortDescription"); 433 434 if (!string.IsNullOrEmpty(longDescription)) 435 { 436 description = longDescription; 437 } 438 else 439 { 440 if (!string.IsNullOrEmpty(shortDescription)) 441 { 442 description = shortDescription; 443 } 444 else 445 { 446 description = Translate("Ecom.NoDescription"); 447 debug = string.Empty; 448 } 449 } 450 451 var hideStock = GetBoolean("Ecom:Product:Field.HideStock_Hidden"); 452 var username = GetGlobalValue("Global:Extranet.UserName"); 453 var mode = Pageview.Area.Item["Mode"]; 454 string[] modeArray = (mode != null) ? mode.ToString().Split(',') : new string[0]; 455 var allowBuy = (modeArray.Contains("B2C") || !string.IsNullOrEmpty(username)) ? true : false; 456 var isInCart = GetBoolean("Ecom:Product.IsInCart"); 457 458 var partialName = GetString("Ecom:Product.ID"); 459 460 FileInfo[] filesInDir; 461 try 462 { 463 DirectoryInfo hdDirectoryInWhichToSearch = new DirectoryInfo(productImagesFolder); 464 filesInDir = hdDirectoryInWhichToSearch.GetFiles("*" + partialName + "*.*"); 465 } 466 catch 467 { 468 filesInDir = null; 469 } 470 471 var categoryFields = new Dictionary<string, string>(); 472 foreach (LoopItem pc in GetLoop("ProductCategories")) 473 { 474 foreach (LoopItem pcf in pc.GetLoop("ProductCategoryFields")) 475 { 476 var pcfVal = pcf.GetString("Ecom:Product.CategoryField.Value"); 477 var pcfTyp = pcf.GetInteger("Ecom:Product.CategoryField.TypeID"); 478 479 if (!string.IsNullOrEmpty(pcfVal) || pcfTyp == 3) 480 { 481 var label = pcf.GetString("Ecom:Product.CategoryField.Label"); 482 483 if (categoryFields.Where(x => x.Key == label).Count() == 0) 484 { 485 categoryFields.Add(label, (string.IsNullOrEmpty(pcfVal)) ? "False" : pcfVal); 486 } 487 } 488 } 489 } 490 491 // TODO: Do not hardcode group id 492 List<LoopItem> relatedProducts = new List<Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>.LoopItem>(); 493 List<LoopItem> bomProducts = new List<Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>.LoopItem>(); 494 foreach (var prg in GetLoop("ProductRelatedGroups")) 495 { 496 if (prg.GetString("Ecom:Product:RelatedGroup.GroupID") == "RELGRP1") 497 { 498 relatedProducts.AddRange(prg.GetLoop("RelatedProducts")); 499 } 500 501 if (prg.GetString("Ecom:Product:RelatedGroup.GroupID") == "RELGRP2") 502 { 503 bomProducts.AddRange(prg.GetLoop("RelatedProducts")); 504 } 505 } 506 507 var number = GetString("Ecom:Product.Number"); 508 var name = GetString("Ecom:Product.Name"); 509 var image = GetString("Ecom:Product.ImageLarge.Default.Clean"); 510 var detailsLoop = GetLoop("Details"); 511 } 512 513 @functions { 514 public string GetTabUrl(string tab) 515 { 516 Uri myuri = new Uri(System.Web.HttpContext.Current.Request.Url.AbsoluteUri); 517 string pathQuery = myuri.PathAndQuery; 518 string hostName = myuri.ToString().Replace(pathQuery, ""); 519 520 //return hostName + "/" + GetString("Ecom:Product.Link.Clean") + "#" + tab; 521 return System.Web.HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path) + "#" + tab; 522 } 523 } 524 525 526 @helper PartsListProduct(LoopItem p) 527 { 528 var userID = int.Parse(GetGlobalValue("Global:Extranet.UserID")); 529 string id = p.GetString("Ecom:Product.ID"); 530 var imageCustom = p.GetString("Product.ImageCustom"); 531 bool allowBuy = p.GetBoolean("Product.AllowBuy"); 532 bool isInCart = p.GetBoolean("Ecom:Product.IsInCart"); 533 var productCatalogPageID = Ecom.GetPageIdByLink(Pageview.Area.Item["ProductCatalogPage"].ToString()); 534 var productLink = string.Format("/Default.aspx?ID={0}&ProductID={1}", productCatalogPageID, id); 535 var dbPrice = p.GetDouble("Ecom:Product.DBPrice"); 536 var salesPrice = (dbPrice * 1.25); 537 538 <div data-filter-item="partslist" data-filter-name="@id.ToLower() @p.GetString("Ecom:Product.Name").ToLower()" class="product_item full_width list_type hit m_left_0 m_right_0 isotope-item no-transition @(p.GetBoolean("Ecom:Product.IsInCart") ? "in_cart" : string.Empty)" data-productno="@p.GetString("Ecom:Product.Number")"> 539 <figure class="r_corners photoframe tr_all_hover type_2 shadow relative clearfix"> 540 <!--product preview--> 541 <a class="d_block f_left relative pp_wrap m_right_20 m_xs_right_25" style="height:100px; width:150px; text-align:center; line-height:100px;" href='@productLink'> 542 <img style="margin:auto; vertical-align:middle;" alt="" class="tr_all_hover" src='@Ecom.GetImage(imageCustom, height:100, width:150, placeholderText:Translate("Ecom.NoImage", "No image"), placeholderTextSize: 30)'> 543 </a> 544 <!--description and price of product--> 545 <figcaption> 546 <div class="clearfix"> 547 <div class="f_left p_list_description f_sm_none w_sm_full m_xs_bottom_10" style="width:310px; margin-top:15px;"> 548 <h4 class="fw_medium m_bottom_10"><a href='@productLink'>@p.GetString("Ecom:Product.Name")a</a></h4> 549 <hr class="m_bottom_10 m_top_10"> 550 <div class="clearfix"> 551 <p class="m_bottom_5 f_left" style="font-size:11px; margin-right:15px !important; margin-top:0px !important;">@Translate("Ecom.ProductNumber"): @p.GetString("Ecom:Product.Number")</p> 552 <p class="m_bottom_5 f_left" style="font-size:11px; margin-right:15px !important; margin-top:0px !important;">Antall i pakken: 1 stk</p> 553 </div> 554 <hr class="m_bottom_10"> 555 <p class="d_sm_none d_xs_block">@p.GetString("Ecom:Product.ShortDescription")</p> 556 </div> 557 <div class="f_right f_sm_none t_align_r t_sm_align_l"> 558 <div class="clearfix"> 559 <div class="f_right NetPrice m_left_20" style="display:none;"> 560 <div style="text-transform:uppercase; font-size:11px; text-align:right;">@((allowBuy) ? Translate("Ecom.NetEx") : Translate("Ecom.SalesPrice"))</div> 561 <p class="f_size_large m_bottom_15" style="margin:5px 0; text-align:right;"><span class="fw_medium">@p.GetString("Ecom:Product.Discount.Price.PriceWithoutVATFormatted")</span></p> 562 </div> 563 @if (allowBuy) 564 { 565 <div class="f_right"> 566 <div style="text-transform:uppercase; font-size:11px; text-align:right;">@Translate("Ecom.ListIncl")</div> 567 <p class="f_size_large m_bottom_15" style="margin:5px 0; text-align:right;"><span class="">@salesPrice.ToString("C")</span></p> 568 </div> 569 } 570 </div> 571 @if (allowBuy) 572 { 573 <input type="text" class="r_corners type_2 t_align_c add_to_basket_quantity @(!isInCart ? string.Empty : "debug")" style="width:50px; height:38px;" value="1" data-productno="@id" /> 574 <button style="height:37px;" onclick="BlockUI(); window.location.href = '/Default.aspx?ID=@GetGlobalValue("Global:eCommerce.CartPageID")'; return false;" class="button_type_4 bg_light_color_1 r_corners tr_all_hover color_dark mw_0 added_to_basket @(p.GetBoolean("Ecom:Product.IsInCart") ? string.Empty : "debug")" data-productno="@p.GetString("Ecom:Product.Number")"><i style="font-size:16px;" class="fa fa-check"></i> @Translate("Ecom.AddedToCart")</button> 575 <button style="height:37px;" class="button_type_4 bg_scheme_color r_corners tr_all_hover color_light mw_0 add_to_basket @(p.GetBoolean("Ecom:Product.IsInCart") ? "debug" : string.Empty)" data-productno="@p.GetString("Ecom:Product.ID")">@Translate("Ecom.AddToCart")</button> 576 } 577 </div> 578 </div> 579 </figcaption> 580 </figure> 581 </div> 582 } 583 584 @helper RelatedProduct(LoopItem p) 585 { 586 var userID = int.Parse(GetGlobalValue("Global:Extranet.UserID")); 587 string id = p.GetString("Ecom:Product.ID"); 588 var imageCustom = p.GetString("Product.ImageCustom"); 589 bool allowBuy = p.GetBoolean("Product.AllowBuy"); 590 bool isInCart = p.GetBoolean("Ecom:Product.IsInCart"); 591 var languageID = p.GetString("Ecom:Product.LanguageID"); 592 var wishListPageID = Ecom.GetPageIdByLink(Pageview.Area.Item["WishList"].ToString()); 593 var url = string.Format("/Default.aspx?id={0}&ProductID={1}&LanguageID={2}", wishListPageID, id, languageID); 594 var productCatalogPageID = Ecom.GetPageIdByLink(Pageview.Area.Item["ProductCatalogPage"].ToString()); 595 var productLink = string.Format("/Default.aspx?ID={0}&ProductID={1}", productCatalogPageID, id); 596 var dbPrice = p.GetDouble("Ecom:Product.DBPrice"); 597 var salesPrice = (dbPrice * 1.25); 598 599 var categoryFields = new Dictionary<string, string>(); 600 foreach (LoopItem pc in p.GetLoop("ProductCategories")) 601 { 602 foreach (LoopItem pcf in pc.GetLoop("ProductCategoryFields").Take(5)) 603 { 604 var pcfVal = pcf.GetString("Ecom:Product.CategoryField.Value"); 605 var pcfTyp = pcf.GetInteger("Ecom:Product.CategoryField.TypeID"); 606 607 if (!string.IsNullOrEmpty(pcfVal) || pcfTyp == 3) 608 { 609 categoryFields.Add(pcf.GetString("Ecom:Product.CategoryField.Label"), (string.IsNullOrEmpty(pcfVal)) ? "False" : pcfVal); 610 } 611 } 612 } 613 614 <div data-filter-item="accessories" data-filter-name="@id.ToLower() @p.GetString("Ecom:Product.Name").ToLower()" class="product_item full_width list_type hit m_left_0 m_right_0 isotope-item no-transition @(p.GetBoolean("Ecom:Product.IsInCart") ? "in_cart" : string.Empty)" data-productno="@p.GetString("Ecom:Product.Number")"> 615 <figure class="r_corners photoframe tr_all_hover type_2 shadow relative clearfix"> 616 <!--product preview--> 617 <a class="d_block f_left relative pp_wrap m_right_20 m_xs_right_25" style="height:100px; width:130px; text-align:center; line-height:100px;" href='@productLink'> 618 <img style="margin:auto; vertical-align:middle;" alt="" class="tr_all_hover" src='@Ecom.GetImage(imageCustom, height:100, width:130, placeholderText:Translate("Ecom.NoImage", "No image"), placeholderTextSize: 30)'> 619 </a> 620 <!--description and price of product--> 621 <figcaption> 622 <div class="clearfix"> 623 <div class="f_left p_list_description f_sm_none w_sm_full m_xs_bottom_10" style="width:330px; margin-top:5px;"> 624 <h4 class="fw_medium m_bottom_10"><a href='@productLink'>@p.GetString("Ecom:Product.Name")</a></h4> 625 <hr class="m_bottom_10 m_top_10"> 626 <div class="clearfix"> 627 <p class="m_bottom_5 f_left" style="font-size:11px; margin-right:15px !important; margin-top:0px !important;">@Translate("Ecom.ProductNumber"): @p.GetString("Ecom:Product.Number")</p> 628 @foreach (var cf in categoryFields) 629 { 630 <p class="m_bottom_5 f_left m_right_10" style="font-size:11px; margin-right:15px !important; margin-top:0px !important;">@cf.Key: @((cf.Value == "True") ? "Ja" : (cf.Value == "False") ? "Nei" : cf.Value)</p> 631 } 632 </div> 633 <hr class="m_bottom_10"> 634 <p class="d_sm_none d_xs_block">@p.GetString("Ecom:Product.ShortDescription")</p> 635 </div> 636 <div class="f_right f_sm_none t_align_r t_sm_align_l"> 637 <div class="clearfix"> 638 <div class="f_right NetPrice m_left_20" style="display:none;"> 639 <div style="text-transform:uppercase; font-size:11px; text-align:right;">@((allowBuy) ? Translate("Ecom.NetEx") : Translate("Ecom.SalesPrice"))</div> 640 <p class="f_size_large m_bottom_15" style="margin:5px 0; text-align:right;"><span class="fw_medium">@p.GetString("Ecom:Product.Discount.Price.PriceWithoutVATFormatted")</span></p> 641 </div> 642 @if (allowBuy) 643 { 644 <div class="f_right"> 645 <div style="text-transform:uppercase; font-size:11px; text-align:right;">@Translate("Ecom.ListIncl")</div> 646 <p class="f_size_large m_bottom_15" style="margin:5px 0; text-align:right;"><span class="">@salesPrice.ToString("C")</span></p> 647 </div> 648 } 649 </div> 650 @if (allowBuy) 651 { 652 <input type="text" class="r_corners type_2 t_align_c add_to_basket_quantity @(!isInCart ? string.Empty : "debug")" style="width:50px; height:38px;" value="1" data-productno="@id" /> 653 <button style="height:37px;" onclick="BlockUI(); window.location.href = '/Default.aspx?ID=@GetGlobalValue("Global:eCommerce.CartPageID")'; return false;" class="button_type_4 bg_light_color_1 r_corners tr_all_hover color_dark mw_0 added_to_basket @(p.GetBoolean("Ecom:Product.IsInCart") ? string.Empty : "debug")" data-productno="@p.GetString("Ecom:Product.Number")"><i style="font-size:16px;" class="fa fa-check"></i> @Translate("Ecom.AddedToCart")</button> 654 <button style="height:37px;" class="button_type_4 bg_scheme_color r_corners tr_all_hover color_light mw_0 add_to_basket @(p.GetBoolean("Ecom:Product.IsInCart") ? "debug" : string.Empty)" data-productno="@p.GetString("Ecom:Product.ID")">@Translate("Ecom.AddToCart")</button> 655 } 656 <button onclick="Compare.add('@p.GetString("Ecom:Product.CompareID")', '@p.GetString("Ecom:Product.Name")', '@p.GetString("Ecom:Product.LinkGroup.Clean")')" class="add_compare_@p.GetString("Ecom:Product.CompareID").Replace("$","_") button_type_4 bg_light_color_2 tr_all_hover f_right m_sm_left_5 r_corners color_dark mw_0 p_hr_0 d_sm_inline_middle f_sm_none tooltip_container"><i class="fa fa-files-o"></i><span class="tooltip_type_2 bottom tr_all_hover r_corners f_size_small color_dark d_block">@Translate("Ecom.AddToCompare.Tooltip")</span></button> 657 <button onclick="Compare.remove('@p.GetString("Ecom:Product.CompareID")', true)" class="remove_compare_@p.GetString("Ecom:Product.CompareID").Replace("$", "_") button_type_4 bg_scheme_color tr_all_hover f_right m_sm_left_5 r_corners color_light mw_0 p_hr_0 d_sm_inline_middle f_sm_none tooltip_container m_left_5" style="display:none;"><i class="fa fa-files-o"></i><span class="tooltip_type_2 bottom tr_all_hover r_corners f_size_small color_dark d_block">@Translate("Ecom.RemoveFromCompare.Tooltip")</span></button> 658 <button data-popup="#@((userID != 0) ? "blank" : "login")_popup" data-url='@url' class="button_type_4 bg_light_color_2 tr_all_hover f_right m_sm_left_5 r_corners color_dark mw_0 p_hr_0 d_sm_inline_middle f_sm_none tooltip_container m_right_5 m_left_5"><i class="fa fa-heart-o"></i><span class="tooltip_type_2 bottom tr_all_hover r_corners f_size_small color_dark d_block">@Translate("Ecom.AddToWishList.Tooltip")</span></button> 659 @if (allowBuy) 660 { 661 var stockNumber = p.GetDouble("Ecom:Product.Stock"); 662 var stockText = p.GetString("Ecom:Product:Stock.Text"); 663 var stockImage = p.GetValue("Ecom:Product:Stock.Image"); 664 var stock = (!string.IsNullOrEmpty(stockText)) ? string.Format("{0} {1}", stockText, stockImage) : string.Format("{0} stk.", stockNumber > 0 ? stockNumber : 0); 665 666 <div style="text-transform:uppercase; font-size:11px; text-align:right; margin-top:10px;">@Translate("Ecom.Stock"): <span style="padding-left:10px;">@stock</span></div> 667 } 668 </div> 669 </div> 670 </figcaption> 671 </figure> 672 </div> 673 } 674 675 @helper SearchMenu(string type) 676 { 677 <div class="row clearfix" style="margin:0 20px 0 0;"> 678 <div class="col-md-12" style="background-color:#ecf0f1; border:1px solid #e4e4e2; padding:10px;"> 679 <div class="col-md-12"> 680 <div class="row clearfix"> 681 <div class="col-md-12" style="padding-left:0px; padding-right:0px; height:38px;"> 682 <input data-search="@type" @*id="search-input-@type" data-type="@type"*@ type="text" style="width:100%; height:36px;" placeholder="@Translate("Sok etter varenummer/varenavn")" class="r_corners f_size_medium full_width search-input"> 683 </div> 684 @*<div class="col-md-2" style="padding-right:0px; padding-left:0px;"> 685 <button id="search-@type" data-type="@type" class="tr_delay_hover r_corners button_type_6 f_size_medium bg_dark_color color_light m_xs_bottom_5 full_width search-button" style="height:33px;">@Translate("Sok")</button> 686 </div>*@ 687 </div> 688 </div> 689 </div> 690 </div> 691 } 692 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 693 694 @using CustomCode.Functions; 695 @using System.Web; 696 @using System.IO; 697 698 @functions { 699 public string GetImage(string key, string width = "150", string height = "150") 700 { 701 string basePath = "/Admin/Public/getImage.ashx?Image=/Files/Images/Products/"; 702 string imgParams = "&Width=" + width + "&Height=" + height + "&Crop=5"; 703 string defaultImage = basePath + "placeholder.png" + imgParams; 704 705 try 706 { 707 string path = HttpContext.Current.Request.MapPath(@"/Files/Images/Products"); 708 string[] images = Directory.GetFiles(path, key + ".*"); 709 710 if (images.Count() > 0) 711 return basePath + Path.GetFileName(images[0]) + imgParams; 712 else 713 return defaultImage; 714 } 715 catch 716 { 717 return defaultImage; 718 } 719 } 720 721 private string GetFileIcon(string ext) 722 { 723 switch (ext.ToLower().Replace(".", string.Empty)) 724 { 725 case "pdf": 726 return "fa-file-pdf-o"; 727 case "xls": 728 case "xlsx": 729 return "fa-file-excel-o"; 730 case "doc": 731 case "docx": 732 return "fa-file-word-o"; 733 case "jpg": 734 case "jpeg": 735 case "png": 736 case "gif": 737 case "bmp": 738 return "fa-file-image-o"; 739 case "zip": 740 case "rar": 741 return "fa-file-archive-o"; 742 case "avi": 743 case "wmv": 744 case "mp4": 745 case "mpg": 746 case "mpeg": 747 return "fa-file-video-o"; 748 case "mp3": 749 return "fa-file-audio-o"; 750 default: 751 return "fa-file-o"; 752 } 753 } 754 755 private static string GetFileSize(string filename) 756 { 757 try 758 { 759 FileInfo fi = new FileInfo(HttpContext.Current.Request.MapPath(filename)); 760 return SizeSuffix(fi.Length); 761 } 762 catch 763 { 764 return "N/A"; 765 } 766 } 767 768 static readonly string[] SizeSuffixes = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" }; 769 static string SizeSuffix(Int64 value) 770 { 771 try 772 { 773 if (value < 0) { return "-" + SizeSuffix(-value); } 774 if (value == 0) { return "0.0 bytes"; } 775 776 int mag = (int)Math.Log(value, 1024); 777 decimal adjustedSize = (decimal)value / (1L << (mag * 10)); 778 779 return string.Format("{0:n1} {1}", adjustedSize, SizeSuffixes[mag]); 780 } 781 catch 782 { 783 return "N/A"; 784 } 785 } 786 787 string _attrib = string.Empty; 788 public string AddAttribute(string source, string tagName, string attrib) 789 { 790 _attrib = attrib; 791 string term = "<" + tagName + " [^>]+>"; 792 System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(term, System.Text.RegularExpressions.RegexOptions.IgnoreCase); 793 System.Text.RegularExpressions.MatchEvaluator myEvaluator = new System.Text.RegularExpressions.MatchEvaluator(this.ProcessMatch); 794 return r.Replace(source, myEvaluator); 795 } 796 797 private string ProcessMatch(System.Text.RegularExpressions.Match m) 798 { 799 string tag = m.Value; 800 if (tag.IndexOf(_attrib) == -1) 801 { 802 tag = tag.Replace(">", " " + _attrib + ">"); 803 } 804 return tag; 805 } 806 807 private string GetCurrentUrl(string sortBy = "", string sortOrder = "", string sortView = "", string pageSize = "", string brand = "") 808 { 809 Uri uri = new Uri(GetGlobalValue("Global:Request.Url")); 810 var q = HttpUtility.ParseQueryString(uri.Query); 811 812 SetQueryParameter("SortBy", sortBy, ref q); 813 SetQueryParameter("SortOrder", sortOrder, ref q); 814 SetQueryParameter("SortView", sortView, ref q); 815 SetQueryParameter("PageSize", pageSize, ref q); 816 SetQueryParameter("manufacturer", brand, ref q); 817 818 return uri.AbsolutePath + "?" + q.ToString(); ; 819 } 820 821 private void SetQueryParameter(string key, string value, ref System.Collections.Specialized.NameValueCollection q) 822 { 823 string localValue = q.Get(key); 824 825 if (!string.IsNullOrEmpty(value)) 826 { 827 if (string.IsNullOrEmpty(localValue)) 828 q.Add(key, value); 829 else 830 q.Set(key, value); 831 } 832 } 833 } 834 <div class="clearfix m_bottom_30 t_xs_align_c"> 835 <div class="row clearfix"> 836 <div class="col-lg-6"> 837 <div class="photoframe type_2 shadow r_corners f_left f_sm_none d_xs_inline_b product_single_preview relative m_right_30 m_bottom_5 m_sm_bottom_20 m_xs_right_0 w_mxs_full"> 838 <div class="relative d_inline_b m_bottom_10 qv_preview d_xs_block" style="min-height:200px; min-width:200px; cursor:pointer;"> 839 <img id="main_image" src='/admin/public/GetImage.ashx?image=@image&width=400&height=450&crop=5&Compression=100&DoNotUpscale=False&Resolution=72' class="tr_all_hover" alt="@name"> 840 </div> 841 </div> 842 </div> 843 <div class="col-lg-6"> 844 <div class="p_top_10 t_xs_align_l"> 845 <!--description--> 846 <h2 class="color_dark fw_medium m_bottom_10">@name</h2> 847 <hr class="m_bottom_10 divider_type_3"> 848 <table class="description_table m_bottom_10" width="100%"> 849 <tbody> 850 <tr> 851 <td>@Translate("Ecom.ProductNumber"):</td> 852 <td align="right">@number</td> 853 </tr> 854 </tbody> 855 </table> 856 857 @{ 858 var currentUser = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser(); 859 var user = Dynamicweb.Security.UserManagement.User.GetUserByID(currentUser.ID); 860 var group = (user != null && user.Groups.Count > 0) ? user.Groups[0] : null; //Expection exactly one group - not 0 not 2 or more 861 var users = (group != null) ? group.Users : null; 862 var groupParent = (group != null) ? group.Parent : null; 863 string sizeType = GetString("Ecom:Product:Field.SizeType"); 864 } 865 866 @if (groupParent != null != null && modeArray.Contains("B2B")) 867 { 868 if (group.Parent.Name.Contains("Storkunder")) 869 { 870 <p>Hei @user.Name, du kan bestille til ansatte i @group.Name</p> 871 <select class="js-employee custom-select"> 872 <option></option> 873 @foreach (var sg in group.Subgroups) 874 { 875 <optgroup label="@sg.Name" /> 876 foreach (var u in sg.Users) 877 { 878 var cfValues = u.CustomFieldValues; 879 var size = string.Empty; 880 foreach (var cf in cfValues) 881 { 882 if (cf.CustomField.Name.Contains(sizeType)) 883 { 884 size = cf.Value.ToString(); 885 } 886 } 887 <option data-size-type="@sizeType" data-employee-name="@u.Name" value="@size"> 888 @u.Name 889 </option> 890 } 891 } 892 </select> 893 } 894 else if (group.Parent.Parent != null && group.Parent.Parent.Name.Contains("Storkunder")) 895 { 896 <p>Hei @user.Name, du kan bestille til ansatte i @group.Name</p> 897 <select class="js-employee custom-select"> 898 <option></option> 899 @foreach (var u in users) 900 { 901 var cfValues = u.CustomFieldValues; 902 var size = string.Empty; 903 foreach (var cf in cfValues) 904 { 905 if (cf.CustomField.Name.Contains(sizeType)) 906 { 907 size = cf.Value.ToString(); 908 } 909 } 910 <option data-size-type="@sizeType" data-employee-name="@u.Name" value="@size"> 911 @u.Name 912 </option> 913 } 914 </select> 915 } 916 } 917 918 919 920 @*Variants start*@ 921 922 @*Variant select*@ 923 @if (variantCount > 0) 924 { 925 <hr class="divider_type_3 m_bottom_15"> 926 foreach (LoopItem vg in GetLoop("VariantGroups")) 927 { 928 if (vg.GetLoop("VariantAvailableOptions").Count > 0) 929 { 930 //var label = Translate(string.Format("{0}", vg.GetString("Ecom:VariantGroup.Name"))); 931 var label = Translate(vg.GetString("Ecom:VariantGroup.Name")); 932 933 <label class="variant-select-label f_left m-2">@label</label> 934 List<LoopItem> variantOptions = vg.GetLoop("VariantAvailableOptions"); 935 { 936 <select id="@vg.GetString("Ecom:VariantGroup.ID")" class="custom-select js-variant-select @((vg.GetString("Ecom:VariantGroup.ID") == "SIZE") ? "js-variant-size" : string.Empty)"> 937 938 @foreach (LoopItem vao in variantOptions.OrderBy(t => int.TryParse(t.GetString("Ecom:VariantOption.Name"), out sizeArray) ? sizeArray : t.GetInteger("Ecom:VariantOption.SortOrder"))) 939 { 940 if(@vg.GetString("Ecom:VariantGroup.ID") == "COLOR"){ 941 <option data-color="@vao.GetString("Ecom:VariantOption.ID")" @(vao.GetBoolean("Ecom:VariantOption.Selected") ? "selected" : string.Empty) value="@vao.GetString("Ecom:VariantOption.ID")">@vao.GetString("Ecom:VariantOption.Name") (@vao.GetString("Ecom:VariantOption.ID").Replace("COLOR",string.Empty))</option> 942 } else { 943 <option @(vao.GetBoolean("Ecom:VariantOption.Selected") ? "selected" : string.Empty) value="@vao.GetString("Ecom:VariantOption.ID")">@vao.GetString("Ecom:VariantOption.Name")</option> 944 } 945 } 946 </select> 947 } 948 } 949 } 950 951 @*Variants prices *@ 952 953 foreach (var i in GetLoop("VariantCombinations")) 954 { 955 956 <div class="js-variant-price m_top_10 " id='@i.GetValue("Ecom:VariantCombination.VariantID")'> 957 @{ 958 var variantStock = i.GetString("Ecom:VariantCombination.Product.Stock"); 959 var vStock = Convert.ToInt32(variantStock); 960 } 961 @if (limit > 0) 962 { 963 if (vStock > limit) 964 { 965 <p>@Translate("Ecom.Stock"): @Translate("Ecom.Stock.More") @limit stk.</p> 966 } 967 else if (vStock < limit && vStock > 0) 968 { 969 <p>@Translate("Ecom.Stock"): @vStock stk.</p> 970 } 971 else if (vStock <= 0) 972 { 973 <p>@Translate("Ecom.Stock"): 0 stk.</p> 974 } 975 } 976 else 977 { 978 <p>@Translate("Ecom.Stock"): @vStock stk.</p> 979 } 980 981 982 <p>@((allowBuy) ? Translate("Ecom.NetEx") : Translate("Ecom.SalesPrice")): @i.GetValue("Ecom:VariantCombination.Product.Price")</p> 983 984 <form method="post" role="form"> 985 <input type="hidden" name="ID" value="@GetValue("Ecom:Product:Page.ID")" /> 986 <input type="hidden" name="ProductID" value="@GetValue("Ecom:Product.ID")" /> 987 <input type="hidden" name="VariantID" value="@i.GetValue("Ecom:VariantCombination.VariantID")" /> 988 <input type="hidden" name="EcomOrderLineFieldInput_EmployeeName" size="100" value=""> 989 <input type="number" class="form-control custom-select" name="Quantity" value="1" style="width:67px;" /> 990 <input type="hidden" name="CartCmd" value="add" /> 991 <button type="submit" style="height:37px;" class="button_type_4 bg_scheme_color r_corners tr_all_hover color_light mw_0 m_right_5">@Translate("Ecom.AddToCart")</button> 992 </form> 993 </div> 994 } 995 996 @*Variants end*@ 997 998 } 999 else 1000 { 1001 <div class="clearfix"> 1002 <div class="f_left"> 1003 <button onclick="Compare.add('@GetString("Ecom:Product.CompareID")', '@GetString("Ecom:Product.Name")', '@GetString("Ecom:Product.LinkGroup.Clean")')" class="add_compare_@GetString("Ecom:Product.CompareID").Replace("$","_") button_type_4 bg_light_color_2 tr_all_hover f_right m_sm_left_5 r_corners color_dark mw_0 p_hr_0 d_sm_inline_middle f_sm_none tooltip_container"><i class="fa fa-files-o"></i><span class="tooltip_type_2 bottom tr_all_hover r_corners f_size_small color_dark d_block">@Translate("Ecom.AddToCompare.Tooltip")</span></button> 1004 <button onclick="Compare.remove('@GetString("Ecom:Product.CompareID")', true)" class="remove_compare_@GetString("Ecom:Product.CompareID").Replace("$", "_") button_type_4 bg_scheme_color tr_all_hover f_right m_sm_left_5 r_corners color_light mw_0 p_hr_0 d_sm_inline_middle f_sm_none tooltip_container m_left_5" style="display:none;"><i class="fa fa-files-o"></i><span class="tooltip_type_2 bottom tr_all_hover r_corners f_size_small color_dark d_block">@Translate("Ecom.RemoveFromCompare.Tooltip")</span></button> 1005 <button data-popup="#@((userID != 0) ? "blank" : "login")_popup" data-url='@url' class="button_type_4 bg_light_color_2 tr_all_hover f_right m_sm_left_5 r_corners color_dark mw_0 p_hr_0 d_sm_inline_middle f_sm_none tooltip_container m_right_5 m_left_5"><i class="fa fa-heart-o"></i><span class="tooltip_type_2 bottom tr_all_hover r_corners f_size_small color_dark d_block">@Translate("Ecom.AddToWishList.Tooltip")</span></button> 1006 </div> 1007 @if (allowBuy) 1008 { 1009 <div class="f_right"> 1010 @*<input type="text" class="r_corners type_2 t_align_c add_to_basket_quantity" style="width:50px; height:38px;" value="1" data-productno="@id" /> 1011 <button style="height:37px;" onclick="BlockUI(); window.location.href = '/Default.aspx?ID=@GetGlobalValue("Global:eCommerce.CartPageID")'; return false;" class="button_type_4 bg_light_color_1 r_corners tr_all_hover color_dark mw_0 added_to_basket @(GetBoolean("Ecom:Product.IsInCart") ? string.Empty : "debug")" data-productno="@GetString("Ecom:Product.Number")"><i style="font-size:16px;" class="fa fa-check"></i> @Translate("Ecom.AddedToCart")</button> 1012 <button style="height:37px;" class="button_type_4 bg_scheme_color tr_all_hover color_light mw_0 add_to_basket" data-productno="@GetString("Ecom:Product.ID")">@Translate("Ecom.AddToCart")</button>*@ 1013 <form method="post" role="form"> 1014 <input type="hidden" name="ID" value="@GetValue("Ecom:Product:Page.ID")" /> 1015 <input type="hidden" name="ProductID" value="@GetValue("Ecom:Product.ID")" /> 1016 <input type="hidden" name="EcomOrderLineFieldInput_EmployeeName" size="100" value=""> 1017 <input type="number" class="form-control custom-select" name="Quantity" value="1" style="width:67px;" /> 1018 <input type="hidden" name="CartCmd" value="add" /> 1019 <button type="submit" style="height:37px;" class="button_type_4 bg_scheme_color r_corners tr_all_hover color_light mw_0 m_right_5 add_to_basket">@Translate("Ecom.AddToCart")</button> 1020 </form> 1021 </div> 1022 } 1023 1024 </div> 1025 } 1026 </div> 1027 </div> 1028 </div> 1029 </div> 1030 1031 <div class="tabs_new m_bottom_45"> 1032 <nav> 1033 <ul class="tabs_nav horizontal_list clearfix" style="cursor:pointer;"> 1034 @if (!string.IsNullOrEmpty(description)) 1035 { 1036 <li class="f_xs_none"><a data-tab="description" class="bg_light_color_1 color_dark tr_delay_hover r_corners d_block">@Translate("Ecom.Product.Description")</a></li> 1037 } 1038 <li class="f_xs_none"><a data-tab="specifications" class="bg_light_color_1 color_dark tr_delay_hover r_corners d_block">@Translate("Ecom.Product.Specifications")</a></li> 1039 @if (detailsLoop.Count > 0) 1040 { 1041 <li class="f_xs_none"><a data-tab="files" class="bg_light_color_1 color_dark tr_delay_hover r_corners d_block">@Translate("Ecom.Product.Documents")</a></li> 1042 } 1043 </ul> 1044 </nav> 1045 <section class="tabs_content shadow r_corners"> 1046 @if (!string.IsNullOrEmpty(description)) 1047 { 1048 <div id="description" class="tabs_content_item"> 1049 <div class="table_sm_wrap"> 1050 <table class="description_table type_3 m_xs_bottom_10 full_width"> 1051 <tr> 1052 <td> 1053 @description 1054 </td> 1055 </tr> 1056 </table> 1057 </div> 1058 </div> 1059 } 1060 <div id="specifications" class="tabs_content_item debug"> 1061 <div class="table_sm_wrap"> 1062 <table class="description_table type_3 m_xs_bottom_10 full_width"> 1063 @{int countFields = 0;} 1064 @foreach (LoopItem li in GetLoop("CustomFieldList")) 1065 { 1066 string templateName = li.GetString("Ecom:CustomField.Template"); 1067 string key = Translate("Ecom.CustomFields." + templateName, li.GetString("Ecom:CustomField.Name")); 1068 string value = GetString(string.Format("Ecom:Product:Field.{0}", templateName)); 1069 1070 if (!string.IsNullOrWhiteSpace(value)) 1071 { 1072 <tr> 1073 <td width="25%" style="border-bottom:1px solid #eee;"><b>@key:</b></td> 1074 <td width="75%" style="border-bottom:1px solid #eee;">@value</td> 1075 </tr> 1076 1077 countFields++; 1078 } 1079 } 1080 1081 @if (countFields == 0) 1082 { 1083 <tr> 1084 <td colspan="2">@Translate("Ecom.NoSpecifications")</td> 1085 </tr> 1086 } 1087 </table> 1088 </div> 1089 </div> 1090 @if (detailsLoop.Count > 0) 1091 { 1092 <div id="files" class="tabs_content_item debug"> 1093 <div class="table_sm_wrap"> 1094 <table class="description_table type_3 m_xs_bottom_10 full_width"> 1095 @foreach (LoopItem li in detailsLoop) 1096 { 1097 string file = li.GetString("Ecom:Product:Detail.Image.Clean"); 1098 bool showFile = (li.GetBoolean("Ecom:Product:Detail.Image.Metadata.Restricted") && string.IsNullOrEmpty(username)) ? false : true; 1099 1100 if (showFile) 1101 { 1102 <tr> 1103 <td> 1104 <a href='@file' target="_blank"><i class='fa @GetFileIcon(Path.GetExtension(file))'></i> @Path.GetFileName(file)</a> (@GetFileSize(file)) 1105 </td> 1106 </tr> 1107 } 1108 } 1109 </table> 1110 </div> 1111 </div> 1112 } 1113 </section> 1114 </div> 1115 1116 <div class="row"> 1117 @foreach (LoopItem prg in GetLoop("ProductRelatedGroups")) { 1118 <div class="col-md-12"> 1119 <p>@prg.GetString("Ecom:Product:RelatedGroup.Name")</p> 1120 </div> 1121 } 1122 </div> 1123 1124 <div class="row"> 1125 <div class="col-md-6"> 1126 <a onclick="window.history.back();" style="cursor:pointer;" class="d_inline_b bg_light_color_2 color_dark tr_all_hover button_type_4 r_corners" role="button"><i class="fa fa-reply m_left_5 m_right_10 f_size_large"></i>@Translate("Master.Back")</a> 1127 </div> 1128 <div class="col-md-6"> 1129 @if (socialMediaButtons) 1130 { 1131 <!-- AddToAny BEGIN --> 1132 <div class="a2a_kit a2a_kit_size_32 a2a_default_style pull-right"> 1133 <a class="a2a_button_facebook"></a> 1134 <a class="a2a_button_twitter"></a> 1135 <a class="a2a_button_pinterest"></a> 1136 <a class="a2a_dd" href="https://www.addtoany.com/share"></a> 1137 </div> 1138 <script async src="https://static.addtoany.com/menu/page.js"></script> 1139 <!-- AddToAny END --> 1140 } 1141 </div> 1142 </div> 1143 1144 @SnippetStart("cssHeader") 1145 <style> 1146 .is-hidden { display: none; } 1147 1148 .button-close { 1149 display: inline-block; 1150 width: 16px; 1151 height: 16px; 1152 position: absolute; 1153 top: 10px; 1154 right: 10px; 1155 cursor: pointer; 1156 background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAowAAAKMB8MeazgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAB5SURBVDiNrZPRCcAwCEQfnUiySAZuF8kSWeH6Yz8KrQZMQAicJ+epAB0YwAmYJKIADLic0/GPPCbQAnLznCd/4NWUFfkgy1VjH8CryA95ApYltAiTRCZxpuoW+gz9WXE6NPeg+ra1UDIxGlWEObe4SGxY5fIxlc75Bkt9V4JS7KWJAAAAAElFTkSuQmCC59ef34356faa7edebc7ed5432ddb673d'); 1157 } 1158 1159 .overlay { 1160 position: fixed; 1161 top: 0; 1162 left: 0; 1163 height: 100%; 1164 width: 100%; 1165 z-index: 99999; 1166 background-color: rgba(0,0,0,0.5); 1167 } 1168 1169 .modal-content { 1170 padding: 0 10px 10px; 1171 width: 825px; 1172 height: 825px; 1173 position: relative; 1174 margin: 1% auto 0; 1175 background: #fff; 1176 text-align:center; 1177 } 1178 </style> 1179 @SnippetEnd("cssHeader") 1180 1181 @SnippetStart("jsFooter") 1182 <div class="overlay is-hidden" id="overlay"> 1183 <div class="modal-content"> 1184 <span class="button-close" onclick="closeModal();"></span> 1185 <p><img id="overlay_image" src="/admin/public/GetImage.ashx?image=@image&width=800&height=800&crop=5&Compression=100&DoNotUpscale=False&Resolution=72" /></p> 1186 </div> 1187 </div> 1188 <script> 1189 var previousColor; 1190 var colorSelect = document.getElementById('COLOR'); 1191 var mainImage = document.getElementById('main_image'); 1192 var overlayImage = document.getElementById('overlay_image'); 1193 var overlay = document.getElementById('overlay'); 1194 1195 mainImage.addEventListener('click', function(e) { 1196 openModal(); 1197 }); 1198 1199 overlay.addEventListener('click', function(e) { 1200 closeModal(); 1201 }); 1202 1203 colorSelect.addEventListener('click', function(e) { 1204 previousColor = e.target.options[e.target.selectedIndex].getAttribute('data-color'); 1205 }); 1206 1207 colorSelect.addEventListener('change', function(e) { 1208 var color = e.target.options[e.target.selectedIndex].getAttribute('data-color'); 1209 mainImage.setAttribute('src', mainImage.getAttribute('src').replace(previousColor, color)); 1210 overlayImage.setAttribute('src', overlayImage.getAttribute('src').replace(previousColor, color)); 1211 }); 1212 1213 function openModal(){ 1214 overlay.classList.remove("is-hidden"); 1215 } 1216 1217 function closeModal(){ 1218 overlay.classList.add("is-hidden"); 1219 } 1220 </script> 1221 @SnippetEnd("jsFooter") 1222 1223 </section> 1224 </div>