Error executing template "Designs/Rapido/eCom/Productlist/ProductsRender.cshtml"System.NullReferenceException: Object reference not set to an instance of an object.at CompiledRazorTemplates.Dynamic.RazorEngine_64ea473474804782900c7f80d131ad9f.b__21_0(TextWriter __razor_helper_writer) in D:\web\websites\NewSpaldings\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 2015at RazorEngine.Templating.TemplateWriter.ToString()at System.Lazy`1.CreateValue()at System.Lazy`1.LazyInitValue()at CompiledRazorTemplates.Dynamic.RazorEngine_64ea473474804782900c7f80d131ad9f.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\web\websites\NewSpaldings\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 168at CompiledRazorTemplates.Dynamic.RazorEngine_64ea473474804782900c7f80d131ad9f.<>c__DisplayClass1_0.b__0(TextWriter __razor_helper_writer) in D:\web\websites\NewSpaldings\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 82at CompiledRazorTemplates.Dynamic.RazorEngine_64ea473474804782900c7f80d131ad9f.Execute() in D:\web\websites\NewSpaldings\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 1964at 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 @using Dynamicweb.Frontend.Devices 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Content 5 @using Dynamicweb.Core 6 @using System 7 @using System.IO 8 @using System.Web 9 @using System.Collections.Generic; 10 @using System.Linq 11 @using System.Text.RegularExpressions 12 @using Dynamicweb.Rapido.Blocks 13 14 @functions { 15 BlocksPage productListPage = BlocksPage.GetBlockPage("ProductList"); 16 } 17 18 @{ 19 Block pageContainer = new Block() 20 { 21 Id = "PageContainer", 22 Template = RenderPageContainer(), 23 SkipRenderBlocksList = true 24 }; 25 productListPage.Add(pageContainer); 26 27 Block productListNavigation = new Block() 28 { 29 Id = "Navigation", 30 SortId = 20, 31 Design = new Design 32 { 33 RenderType = RenderType.Column, 34 Size = "3" 35 } 36 }; 37 productListPage.Add("PageContainer", productListNavigation); 38 39 Block productListContainer = new Block() 40 { 41 Id = "ProductList", 42 SortId = 30, 43 Template = RenderProductList(), 44 SkipRenderBlocksList = true 45 }; 46 productListPage.Add("PageContainer", productListContainer); 47 48 Block productListSnippets = new Block() 49 { 50 Id = "BottomSnippets", 51 SortId = 40 52 }; 53 productListPage.Add(productListSnippets); 54 } 55 56 @* This is required for the product list feed to work *@ 57 @GetValue("DoNotRenderProductListTemplate") 58 59 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 60 @using System.Text.RegularExpressions 61 @using System.Collections.Generic 62 @using System.Reflection 63 @using System.Web.UI.HtmlControls 64 @using Dynamicweb.Rapido.Blocks.Components 65 @using Dynamicweb.Rapido.Blocks.Components.Articles 66 @using Dynamicweb.Rapido.Blocks.Components.Documentation 67 @using Dynamicweb.Rapido.Blocks 68 69 70 @*--- START: Base block renderers ---*@ 71 72 @helper RenderBlockList(List<Block> blocks) 73 { 74 blocks = blocks.OrderBy(item => item.SortId).ToList(); 75 76 foreach (Block item in blocks) 77 { 78 <!-- START: @item.Id --> 79 80 if (item.Design == null) 81 { 82 @RenderBlock(item) 83 } 84 else if (item.Design.RenderType == RenderType.None) { 85 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 86 87 <div class="@cssClass dw-mod"> 88 @RenderBlock(item) 89 </div> 90 } 91 else if (item.Design.RenderType != RenderType.Hide) 92 { 93 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 94 95 if (!item.SkipRenderBlocksList) { 96 if (item.Design.RenderType == RenderType.Row) 97 { 98 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> 99 @RenderBlock(item)100 </div>101 }102103 if (item.Design.RenderType == RenderType.Column)104 {105 string hidePadding = item.Design.HidePadding ? "u-no-padding" : "";106 string size = item.Design.Size ?? "12";107 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size;108109 <div class="grid__col-lg-@item.Design.Size grid__col-md-@item.Design.Size grid__col-sm-12 grid__col-xs-12 @hidePadding @cssClass dw-mod" id="Block__@item.Id">110 @RenderBlock(item)111 </div>112 }113114 if (item.Design.RenderType == RenderType.Table)115 {116 <table class="table @cssClass dw-mod" id="Block__@item.Id">117 @RenderBlock(item)118 </table>119 }120121 if (item.Design.RenderType == RenderType.TableRow)122 {123 <tr class="@cssClass dw-mod" id="Block__@item.Id">124 @RenderBlock(item)125 </tr>126 }127128 if (item.Design.RenderType == RenderType.TableColumn)129 {130 <td class="@cssClass dw-mod" id="Block__@item.Id">131 @RenderBlock(item)132 </td>133 }134135 if (item.Design.RenderType == RenderType.CardHeader)136 {137 <div class="card-header @cssClass dw-mod">138 @RenderBlock(item)139 </div>140 }141142 if (item.Design.RenderType == RenderType.CardBody)143 {144 <div class="card @cssClass dw-mod">145 @RenderBlock(item)146 </div>147 }148149 if (item.Design.RenderType == RenderType.CardFooter)150 {151 <div class="card-footer @cssClass dw-mod">152 @RenderBlock(item)153 </div>154 }155 }156 else157 {158 @RenderBlock(item)159 }160 }161162 <!-- END: @item.Id -->163 }164 }165166 @helper RenderBlock(Block item)167 {168 if (item.Template != null)169 {170 @BlocksPage.RenderTemplate(item.Template)171 }172173 if (item.Component != null)174 {175 string methodName = item.Component.HelperName;176 dynamic[] methodParameters = new dynamic[1];177 methodParameters[0] = item.Component;178 Type methodType = this.GetType();179 MethodInfo generalMethod = methodType.GetMethod(methodName);180181 if (generalMethod != null) {182 @generalMethod.Invoke(this, methodParameters).ToString();183 } else {184 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked");185 }186 }187188 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList)189 {190 @RenderBlockList(item.BlocksList)191 }192 }193194 @*--- END: Base block renderers ---*@195196197 @* Include the Blocks for the page *@198 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>199 @using Dynamicweb.Core200 @using System201 @using System.Web202 @using System.Collections.Generic203 @using Dynamicweb.Rapido.Blocks204205 @{206 BlocksPage productListProductsBlocksPage = BlocksPage.GetBlockPage("ProductList");207208 Block productsBlock = new Block209 {210 Id = "Views",211 SortId = 30,212 Template = RenderProducts()213 };214215 productListProductsBlocksPage.Add("ProductList", productsBlock);216 }217218 @helper RenderProducts()219 {220 @*This is part of a script template *@221222 <div id="ProductsContainer" data-template="{{listTemplate}}" class="grid product-list grid--external-bleed-x dw-mod" data-save-cookie="true">223 {{#ProductsContainer}}224 {{> (lookup . 'template') }}225 {{/ProductsContainer}}226 </div>227 }228 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>229 @using Dynamicweb.Core230 @using System231 @using System.Web232 @using System.Collections.Generic233 @using Dynamicweb.Rapido.Blocks234235 @if (Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableListView"))236 {237 BlocksPage productList = BlocksPage.GetBlockPage("ProductList");238239 Block listViewButton = new Block240 {241 Id = "ProductItemContainer",242 Name = "th-list",243 SortId = 10244 };245 productList.Add("Views", listViewButton);246247 Block listViewScripts = new Block248 {249 Id = "ListViewScripts",250 SortId = 20,251 Template = ListView()252 };253 productList.Add("BottomSnippets", listViewScripts);254 }255256 @helper ListView()257 {258 string pageId = GetGlobalValue("Global:Page.ID");259 bool onlyPreview = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Pageview.User == null;260 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");261 bool showPrice = !Pageview.AreaSettings.GetItem("ProductList").GetBoolean("HidePrice");262 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fas fa-shopping-cart";263 bool showCartButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("ListView").GetBoolean("ShowAddToCartButton");264 bool showViewButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("ListView").GetBoolean("ShowViewButton");265 bool showFavoriteButton = !Pageview.AreaSettings.GetItem("ProductList").GetItem("ListView").GetBoolean("HideFavoriteButton");266 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("ListView").GetBoolean("ShowAddToDownloadButton");267 bool showStock = Pageview.AreaSettings.GetItem("ProductList").GetItem("ListView").GetBoolean("ShowStockAndShipping");268 bool showNumber = Pageview.AreaSettings.GetItem("ProductList").GetItem("ListView").GetBoolean("ShowProductNumber");269 bool showVariantSelector = Pageview.AreaSettings.GetItem("ProductList").GetItem("ListView").GetList("Variants").SelectedValue == "selector" ? true : false;270 bool showStaticVariants = Pageview.AreaSettings.GetItem("ProductList").GetItem("ListView").GetList("Variants").SelectedValue == "static" ? true : false;271 string viewMoreText = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("ProductList").GetItem("ListView").GetString("ViewMoreText")) ? Pageview.AreaSettings.GetItem("ProductList").GetItem("ListView").GetString("ViewMoreText") : "View";272 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));273 bool showVATPrice = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("ShowBothPricesWithWithoutVAT");274 bool isPricesWithVATEnabled = Converter.ToBoolean(Pageview.Area.EcomPricesWithVat);275 string imageZoomOnHover = Pageview.AreaSettings.GetItem("ProductList").GetItem("ListView").GetBoolean("HoverImageZoom") ? "image-hover--zoom" : "";276 bool secondaryImage = Pageview.AreaSettings.GetItem("ProductList").GetItem("ListView").GetString("HoverAlternatineImage") != null ? Pageview.AreaSettings.GetItem("ProductList").GetItem("ListView").GetBoolean("HoverAlternatineImage") : false;277 bool preventWebSale = GetBoolean("Ecom:Product:Field.SLPreventWebSale");278279 <script id="ProductItemContainer" type="text/x-template">280 {{#.}}281 <div id="Product{{id}}" class="grid__col-12 js-product dw-mod" data-template="ProductItem" data-preloader="overlay">282 {{#Product}}283 {{>ProductItem}}284 {{/Product}}285 </div>286 {{/.}}287 </script>288289 <script id="ProductItem" type="text/x-template">290 {{#.}}291 @if (useGoogleTagManager)292 {293 <text>{{{googleEnchantImpression 'Product catalogue' currency googleImpression}}}</text>294 }295 <input type="hidden" name="ProductLoopCounter{{id}}" value="{{id}}" />296 <input type="hidden" name="ProductID{{id}}" value="{{productId}}" />297 <input type="hidden" value="{{variantid}}" name="VariantID{{id}}" id="Variant_{{id}}" />298299 <div class="grid product-list__list-item dw-mod">300 <div class="grid__col-md-4 {{noImage}} product-list__list-item__left u-no-padding u-color-light--bg dw-mod @imageZoomOnHover">301 <div class="grid__cell">302 <a href="{{link}}" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}" class="u-position-relative u-block image-hover__wrapper dw-mod">303 <img class="grid__cell-img grid__cell-img--centered b-lazy" src="/Files/Images/placeholder.gif"304 data-src="/Admin/Public/GetImage.ashx?width=300&height=300&crop=5&Compression=75&DoNotUpscale=true&FillCanvas=true&image={{image}}"305 @if (secondaryImage) { <text>306 {{#if secondaryImage}}307 data-secondary-image-src="/Admin/Public/GetImage.ashx?width=300&height=300&crop=5&Compression=75&FillCanvas=true&DoNotUpscale=true&image={{secondaryImage}}"308 {{/if}}309 </text> }310 alt="{{name}}" />311 {{#StickersContainers}}312 {{>StickersContainer}}313 {{/StickersContainers}}314 </a>315 </div>316 </div>317 <div class="grid__col-md-auto product-list__list-item__right dw-mod">318 <div>319 <div class="u-pull--left">320 <a href="{{link}}" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}">321 <h2 class="u-no-margin">{{name}}</h2>322 </a>323324 @if (showNumber)325 {326 <div class="item-number dw-mod">{{number}}</div>327 }328329 @if (!onlyPreview && showStock)330 {331 <text>332 {{#if stockText}}333 <div>334 <span class="stock-icon {{stockState}} u-no-margin dw-mod" title="{{stockText}}"></span>335 <span class="u-margin-right--lg"> {{stockText}}</span>336 {{deliveryText}}337 </div>338 {{/if}}339 </text>340 }341342 </div>343344 @if (showFavoriteButton)345 {346 <div class="favorites u-pull--right {{hasVariants}} dw-mod" {{hasVariants}}>347 {{#Favorite}}348 {{>FavoriteTemplate}}349 {{/Favorite}}350 </div>351 }352 </div>353354 <div class="grid__cell u-margin-top u-margin-bottom">355 {{{description}}}356 </div>357358 @if (showCartButton && showVariantSelector)359 {360 <div data-template="VariantsTemplate" class="js-variants grid__cell" data-combinations="{{combinationsStringArray}}" data-variants="{{variantsStringArray}}" data-variant-selections="{{variantSelections}}" data-total-variant-groups="{{variantGroupsCount}}" data-selection-complete="UpdateData" data-page-id="@pageId" data-product-id="{{productId}}">361 {{#Variants}}362 {{>VariantsTemplate}}363 {{/Variants}}364 </div>365 <small class="js-help-text help-text {{hideViewMore}} {{hideHelpText}}">@Translate("Please select variant!")</small>366 }367368 @if (showStaticVariants)369 {370 <text>371 {{#Variants}}372 {{>StaticVariantsTemplate}}373 {{/Variants}}374 {{#ifCond variantGroupsCount '>' 1}}375 <div class="static-variant">376 @Translate("More options available")377 </div>378 {{/ifCond}}379 </text>380 }381382 @if (!onlyPreview)383 {384 <div class="grid__cell-footer">385 <div class="grid__cell">386 <div class="product-list__list-item__price-actions dw-mod">387 @if (showPrice)388 {389 <div class="u-margin-bottom">390 @if (pointShopOnly)391 {392 <text>393 {{#if havePointPrice}}394 <div class="price price--product-list dw-mod">{{points}} @Translate("points")</div>395 {{else}}396 @Translate("Not available")397 {{/if}}398 </text>399 }400 else401 {402403 if (!onlyPreview)404 {405406 <text>407 {{#ifCond preventWebSale "===" false}}408 {{#unless HidePrice}}409 <div class="price price--product-list dw-mod">{{price}}</div>410 <div class="before-price {{onSale}} dw-mod">{{discount}}</div>411 {{/unless}}412 {{/ifCond}}413 </text>414415 }416417 if (showVATPrice)418 {419 <small class="vat-price vat-price--product-list dw-mod">420 @if (isPricesWithVATEnabled)421 {422 @Translate("excl. VAT") <text>({{priceWithoutVAT}})</text>423 }424 else425 {426 @Translate("incl. VAT") <text>({{priceWithVAT}})</text>427 }428 </small>429 }430 }431 </div>432 }433434 @if (showCartButton)435 {436 string hasVariantsClass = "";437 if (!showVariantSelector)438 {439 hasVariantsClass = "{{hasVariants}}";440 }441442 if (pointShopOnly)443 {444 <text>445 {{#unless canBePurchasedWithPoints}}446 {{#if havePointPrice}}447 <small class="help-text u-no-margin u-margin-bottom">@Translate("Not enough points to buy this")</small>448 {{/if}}449 {{/unless}}450 </text>451 }452 <text>453 {{#unless preventWebSale}}454 {{#unless HidePrice}}455 <div class="buttons-collection buttons-collection--right @hasVariantsClass">456 @if (pointShopOnly)457 {458 <button type="button" id="CartButton_{{id}}" class="btn btn--primary btn--condensed u-no-margin dw-mod u-pull--right js-cart-btn {{disabledBuyButton}} {{#unless canBePurchasedWithPoints}}js-stay-disabled{{/unless}}" name="CartCmd" value="addWithPoints"459 onclick="Cart.AddToCart(event, {460 id: '{{productId}}',461 variantId: '{{variantid}}',462 unitId: '{{unitId}}',463 quantity: 1,464 buyForPoints: true,465 productInfo: {{productInfo}},466 }); {{facebookPixelAction}}" {{disabledBuyButton}}>467 <i class="@cartIcon"></i><span class="u-hidden-xs u-hidden-xxs"> @Translate("Buy with points")</span>468 </button>469 }470 else471 {472 <button type="button" id="CartButton_{{id}}" class="js-cart-btn btn btn--primary btn--condensed u-pull--right dw-mod {{disabledBuyButton}}" name="submit"473 onclick="Cart.AddToCart(event, {474 id: '{{productId}}',475 variantId: '{{variantid}}',476 unitId: '{{unitId}}',477 quantity: document.getElementById('Quantity_{{id}}').value,478 productInfo: {{productInfo}},479 }); {{facebookPixelAction}}" {{disabledBuyButton}}>480 <i class="@cartIcon"></i><span class="u-hidden-xs u-hidden-xxs"> @Translate("Add to cart")</span>481 </button>482 <input type="number" class="u-w80px u-margin-right u-pull--right use-btn-primary-height" id="Quantity_{{id}}" name="Quantity{{id}}" value="1" min="1" step="1" onkeypress="return event.charCode >= 48 && event.charCode <= 57">483 }484485 <input type="checkbox" id="UnitOptions_{{id}}" class="dropdown-trigger" />486 <div class="dropdown u-w150px u-w100px--xs use-btn-primary-height {{hasUnits}} dw-mod">487 <label class="dropdown__header dropdown__btn dw-mod" for="UnitOptions_{{id}}">{{unitName}}</label>488 <div id="unitOptions" class="dropdown__content dw-mod">489 {{#unitOptions}}490 {{>UnitOption}}491 {{/unitOptions}}492 </div>493 <label class="dropdown-trigger-off" for="UnitOptions_{{id}}"></label>494 </div>495 <input type="hidden" value="{{unitId}}" name="Unit{{id}}" id="Unit_{{id}}" />496 </div>497 {{/unless }}498 {{/unless }}499 @if (Pageview.AreaID == 1 && Pageview.User == null)500 {501502 }503 else504 {505 <text>506 {{#if preventWebSale}}507 {{#unless Discontinued}}508 <p>@Translate("Please call", "Please call")</p>509 {{/unless}}510 {{/if}}511 </text>512 }513 </text>514 if (showViewButton)515 {516 if (Pageview.User == null)517 {518 <text>519 {{#if HidePrice}}520 <div class="buttons-collection buttons-collection--right">521 <label for="SignInModalTrigger" class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)">@Translate("Sign in")</label>522 </div>523 {{/if}}524 </text>525 }526 }527 }528 else if (showViewButton)529 {530 <div class="buttons-collection buttons-collection--right">531 <a href="{{link}}" id="CartButton_{{id}}" title="@Translate(viewMoreText)" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" class="btn btn--secondary btn--full u-no-margin dw-mod">532 @Translate(viewMoreText)533 </a>534 </div>535 }536537 </div>538 </div>539 </div>540 }541 else542 {543 <text>544 {{#if Discontinued}}545 <p>@Translate("DISCONTINUED_A", "DISCONTINUED_A")</p>546 {{/if}}547 </text>548 {549 <div class="grid__cell-footer">550 <div class="grid__cell">551 <div class="product-list__list-item__price-actions dw-mod">552 @if (Pageview.User == null)553 {554 <text>555 {{#if SLGuestPricing}}556 <div class="price price--product-list dw-mod">{{price}}</div>557 <div class="before-price {{onSale}} dw-mod">{{discount}}</div>558 {{/if}}559 </text>560 }561 <label for="SignInModalTrigger" class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)">@Translate("Sign in")</label>562563 </div>564 </div>565 </div>566 @*<button type="button" id="CartButton_{{id}}" class="u-hidden"></button>*@567 }568 }569570 @if (showAddToDownloadButton && Pageview.User != null)571 {572 <div class="grid__cell-footer @((showCartButton || showViewButton) ? "u-margin-top" : "" )">573 <div class="grid__cell">574 <button type="button" class="btn btn--primary btn--condensed u-no-margin u-pull--right dw-mod js-add-to-downloads" title="@Translate("Add")" data-product-id="{{productId}}">575 <i class="fas fa-plus js-button-icon"></i>576 <span class="js-button-text">@Translate("Add")</span>577 </button>578 </div>579 </div>580 }581 </div>582 </div>583 {{/.}}584 </script>585 }586 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>587 @using Dynamicweb.Core588 @using System589 @using System.Web590 @using System.Collections.Generic591 @using Dynamicweb.Rapido.Blocks592593 @if (Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableGridView"))594 {595 BlocksPage productList = BlocksPage.GetBlockPage("ProductList");596597 Block gridViewButton = new Block598 {599 Id = "ProductGridItemContainer",600 Name = "th",601 SortId = 20602 };603 productList.Add("Views", gridViewButton);604605 Block gridViewScripts = new Block606 {607 Id = "GridViewScripts",608 SortId = 20,609 Template = GridView()610 };611 productList.Add("BottomSnippets", gridViewScripts);612 }613614 @helper GridView()615 {616 bool onlyPreview = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Pageview.User == null;617 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");618 bool showPrice = !Pageview.AreaSettings.GetItem("ProductList").GetBoolean("HidePrice");619 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fas fa-shopping-cart";620 string columnsCount = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetList("Columns") != null ? Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetList("Columns").SelectedValue : "4";621 bool showCartButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowAddToCartButton");622 bool showViewButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowViewButton");623 bool showFavoriteButton = !Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("HideFavoriteButton");624 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowAddToDownloadButton");625 bool showStock = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowStockAndShipping");626 bool showNumber = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowProductNumber");627 bool showStaticVariants = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowStaticVariants");628 string cartButtonText = Converter.ToInt32(columnsCount) >= 4 && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" ? Translate("Add to cart") : "";629 string viewMoreText = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetString("ViewMoreText")) ? Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetString("ViewMoreText") : "View";630 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));631 bool showVATPrice = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("ShowBothPricesWithWithoutVAT");632 bool isPricesWithVATEnabled = Converter.ToBoolean(Pageview.Area.EcomPricesWithVat);633 string imageZoomOnHover = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("HoverImageZoom") ? "image-hover--zoom" : "";634 bool secondaryImage = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetString("HoverAlternatineImage") != null ? Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("HoverAlternatineImage") : false;635 string footerClasses = showStaticVariants ? "u-min-h120px" : "";636637638 <script id="ProductGridItemContainer" type="text/x-template">639 {{#.}}640 <div id="Product{{id}}" data-template="ProductGridItem" data-preloader="overlay" class="grid__col-lg-@columnsCount grid__col-md-@columnsCount grid__col-sm-@columnsCount grid__col-xs-6 product-list__grid-item @imageZoomOnHover dw-mod">641 {{#Product}}642 {{>ProductGridItem}}643 {{/Product}}644645 </div>646 {{/.}}647 </script>648649 <script id="ProductGridItem" type="text/x-template">650 {{#.}}651 @if (useGoogleTagManager)652 {653 <text>{{{googleEnchantImpression 'Product catalogue' currency googleImpression}}}</text>654 }655 <input type="hidden" name="ProductLoopCounter{{id}}" value="{{id}}" />656 <input type="hidden" name="ProductID{{id}}" value="{{productId}}" />657 <input type="hidden" name="wishListID{{id}}" id="wishListID{{id}}" value="0" />658659 <div class="grid__cell product-list__grid-item__image dw-mod {{noImage}}">660 <a href="{{link}}" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}" class="u-block u-position-relative image-hover__wrapper dw-mod">661 <img class="grid__cell-img grid__cell-img--centered u-padding b-lazy" src="/Files/Images/placeholder.gif"662 data-src="/Admin/Public/GetImage.ashx?width=300&height=300&crop=5&Compression=75&FillCanvas=true&DoNotUpscale=true&image={{image}}"663 @if (secondaryImage) { <text>664 {{#if secondaryImage}}665 data-secondary-image-src="/Admin/Public/GetImage.ashx?width=300&height=300&crop=5&Compression=75&FillCanvas=true&DoNotUpscale=true&image={{secondaryImage}}"666 {{/if}}667 </text> }668 alt="{{name}}" />669 {{#StickersContainers}}670 {{>StickersContainer}}671 {{/StickersContainers}}672 </a>673 @if (showFavoriteButton)674 {675 <div class="favorites favorites--for-grid-view u-pull--right {{hasVariants}} dw-mod" {{hasVariants}}>676 {{#Favorite}}677 {{>FavoriteTemplate}}678 {{/Favorite}}679 </div>680 }681 </div>682683 <div class="grid__cell product-list__grid-item__price-info dw-mod">684 <a href="{{link}}" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}">685 <h6 class="u-condensed-text">{{name}}</h6>686 </a>687 @if (showNumber)688 {689 <div class="item-number dw-mod">{{number}}</div>690 }691692 @if (showPrice && !onlyPreview)693 {694 if (pointShopOnly)695 {696 <text>697 {{#if havePointPrice}}698 <div class="price price--product-list dw-mod">{{points}} @Translate("points")</div>699 {{else}}700 @Translate("Not available")701 {{/if}}702 </text>703 }704 else705 {706 if (!onlyPreview && showPrice)707 {708709 if (!onlyPreview)710 {711712 <text>713 {{#ifCond preventWebSale "===" false}}714 {{#unless HidePrice}}715 <div class="price price--product-list dw-mod">{{price}}</div>716 <div class="before-price {{onSale}} dw-mod">{{discount}}</div>717 {{/unless}}718 {{/ifCond}}719 </text>720721 }722723 if (showVATPrice)724 {725 <div class="vat-price vat-price--product-list u-margin-top dw-mod">726 @if (isPricesWithVATEnabled)727 {728 <span>@Translate("excl. VAT")</span><span> ({{priceWithoutVAT}})</span>729 }730 else731 {732 <span>@Translate("incl. VAT")</span><span> ({{priceWithVAT}})</span>733 }734 </div>735 }736 }737738739740 }741742 }743 <input type="hidden" value="{{unitId}}" name="Unit{{id}}" id="Unit_{{id}}" />744 <input type="hidden" value="{{variantid}}" name="VariantID{{id}}" id="Variant_{{id}}" />745 @*<input type="hidden" id="Quantity_{{id}}" name="Quantity{{id}}" value="1" min="1">*@746 </div>747748 <div class="product-list__grid-item__footer @footerClasses dw-mod">749 @if (!onlyPreview)750 {751 <text>752 {{#unless preventWebSale}}753 {{#unless HidePrice}}754 <div class="u-ta-center u-inline-block">755 <div class="buttons-collection {{hideBuyOptions}}">756 @if (pointShopOnly)757 {758 <button type="button" id="CartButton_{{id}}" class="btn btn--primary btn--condensed u-no-margin dw-mod js-cart-btn {{disabledBuyButton}} {{#unless canBePurchasedWithPoints}}js-stay-disabled{{/unless}}" name="CartCmd" value="addWithPoints"759 onclick="Cart.AddToCart(event, {760 id: {{productId}}',761 variantId: '{{variantid}}',762 unitId: '{{unitId}}',763 quantity: 1,764 buyForPoints: true,765 productInfo: {{productInfo}},766 }); {{facebookPixelAction}}" {{disabledBuyButton}}>767 <i class="@cartIcon"></i><span class="u-hidden-xs u-hidden-xxs"> @Translate("Buy with points")</span>768 </button>769 }770 else771 {772 <button type="button" id="CartButton_{{id}}" class="js-cart-btn btn btn--primary btn--condensed u-no-margin u-pull--right dw-mod {{disabledBuyButton}}" name="submit"773 onclick="Cart.AddToCart(event, {774 id: '{{productId}}',775 variantId: '{{variantid}}',776 unitId: '{{unitId}}',777 quantity: document.getElementById('Quantity_{{id}}').value,778 productInfo: {{productInfo}},779 }); {{facebookPixelAction}}" {{disabledBuyButton}}>780 <i class="@cartIcon"></i><span class="u-hidden-xs u-hidden-xxs"> @cartButtonText</span>781 </button>782 <input type="number" class="u-w80px u-pull--right use-btn-primary-height" id="Quantity_{{id}}" name="Quantity{{id}}" value="1" min="1" step="1" onkeypress="return event.charCode >= 48 && event.charCode <= 57">783 }784 </div>785 </div>786 {{/unless }}787 {{/unless }}788 @if (Pageview.AreaID == 1 && Pageview.User == null)789 {790791 }792 else793 {794 <text>795 {{#if preventWebSale}}796 {{#unless Discontinued}}797 <p>@Translate("Please call", "Please call")</p>798 {{/unless}}799 {{/if}}800 </text>801 }802803 </text>804 if (showViewButton)805 {806 //hideViewMore handlebar value in class attribute807 if (Pageview.User == null)808 {809 <text>810 {{#if HidePrice}}811 <div class="u-ta-center">812 <label for="SignInModalTrigger" class="button--productdetail" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)">@Translate("Sign in")</label>813 <label for="SignupModalTrigger" class="button--productdetail" onclick="setTimeout(function () { document.getElementById('SignUpModal').focus() }, 10)">@Translate("Sign up")</label>814815 </div>816 {{/if }}817 </text>818 }819 }820821 }822 else if (showViewButton)823 {824 <div class="u-ta-center">825 @if (onlyPreview)826 {827 <label for="SignInModalTrigger" class="button--productdetail" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)">@Translate("Sign in")</label>828 <label for="SignupModalTrigger" class="button--productdetail" onclick="setTimeout(function () { document.getElementById('SignUpModal').focus() }, 10)">@Translate("Sign up")</label>829 }830831 @*<a href="{{link}}" id="CartButton_{{id}}" class="btn btn--secondary btn--full u-no-margin dw-mod" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="@Translate(viewMoreText)">@Translate(viewMoreText)</a>*@832 </div>833 }834835 @if (!onlyPreview && showStock)836 {837 <div class="u-margin-top">838 {{#if stockText}}839 <div><span class="stock-icon {{stockState}} u-no-margin dw-mod" title="{{stockText}}"></span> {{stockText}}</div>840 <div>841 {{#if deliveryText}}842 {{deliveryText}}843 {{else}}844 {{/if}}845 </div>846 {{/if}}847 </div>848 }849850 @if (showStaticVariants)851 {852 <text>853 {{#Variants}}854 {{>StaticVariantsTemplate}}855 {{/Variants}}856857 {{#ifCond variantGroupsCount '>' 1}}858 <div class="static-variant">859 @Translate("More options available")860 </div>861 {{/ifCond}}862863 {{#ifCond variantGroupsCount '==' 0}}864 <div class="static-variant"></div>865 {{/ifCond}}866 </text>867 }868869 @if (showAddToDownloadButton && Pageview.User != null)870 {871 <button type="button" class="btn btn--primary u-no-margin u-margin-top btn--condensed dw-mod js-add-to-downloads" title="@Translate("Add")" data-product-id="{{productId}}">872 <i class="fas fa-plus js-button-icon"></i>873 <span class="js-button-text">@Translate("Add")</span>874 </button>875 }876 </div>877 {{/.}}878 </script>879 }880 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>881 @using Dynamicweb.Core882 @using System883 @using System.Web884 @using System.Collections.Generic885 @using Dynamicweb.Rapido.Blocks886887 @if (Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableDetailsView"))888 {889 BlocksPage productList = BlocksPage.GetBlockPage("ProductList");890891 Block detailsViewButton = new Block892 {893 Id = "ProductDetailsItemContainer",894 Name = "list",895 SortId = 30896 };897 productList.Add("Views", detailsViewButton);898899 Block detailsViewScripts = new Block900 {901 Id = "DetailsViewScripts",902 SortId = 30,903 Template = DetailsView()904 };905 productList.Add("BottomSnippets", detailsViewScripts);906 }907908 @helper DetailsView()909 {910 bool onlyPreview = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Pageview.User == null;911 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");912 bool showPrice = !Pageview.AreaSettings.GetItem("ProductList").GetBoolean("HidePrice");913 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fas fa-shopping-cart";914 bool showCartButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowAddToCartButton");915 bool showViewButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowViewButton");916 bool showFavoriteButton = !Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("HideFavoriteButton");917 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowAddToDownloadButton");918 bool showStock = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowStockAndShipping");919 bool showImage = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowImage");920 bool showNumber = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowProductNumber");921 bool showStaticVariants = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowStaticVariants");922 string viewMoreText = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetString("ViewMoreText")) ? Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetString("ViewMoreText") : "View";923 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));924 bool showVATPrice = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("ShowBothPricesWithWithoutVAT");925 bool isPricesWithVATEnabled = Converter.ToBoolean(Pageview.Area.EcomPricesWithVat);926927 <script id="ProductDetailsItemContainer" type="text/x-template">928 {{#.}}929 <div id="Product{{id}}" data-template="ProductDetailsItem" data-preloader="overlay" class="grid__col-12 u-no-padding-y" style="z-index: {{zIndex}}">930 {{#Product}}931 {{>ProductDetailsItem}}932 {{/Product}}933 </div>934 {{/.}}935 </script>936937 if (Pageview.Device.ToString() != "Mobile")938 {939 <script id="ProductDetailsItem" type="text/x-template">940 {{#.}}941 @if (useGoogleTagManager)942 {943 <text>{{{googleEnchantImpression 'Product catalogue' currency googleImpression}}}</text>944 }945 <input type="hidden" name="ProductLoopCounter{{id}}" value="{{id}}" />946 <input type="hidden" name="ProductID{{id}}" value="{{productId}}" />947 <div class="product-list__details-item grid__col-12 dw-mod">948 <div class="product-list__details-item__left grid__cell dw-mod">949 @if (showImage)950 {951 <div class="lightbox u-hidden-xxs">952 <a href="{{link}}" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}">953 <img class="lightbox__image {{noImage}}" src="/Admin/Public/GetImage.ashx?width=220&height=220&crop=5&Compression=75&image={{image}}" alt="{{name}}" />954 <div class="u-margin-right {{noImage}}">955 <img class="b-lazy" src="/Files/Images/placeholder.gif"956 data-src="/Admin/Public/GetImage.ashx?width=75&height=55&crop=5&FillCanvas=true&Compression=75&image={{image}}"957 alt="{{name}}" />958 </div>959 </a>960 </div>961 }962 <div class="u-margin-left u-margin-right">963 <a href="{{link}}" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}">964 <h6 class="u-no-margin">{{name}}</h6>965 </a>966 <div class="item-number item-number--compressed dw-mod">967 @if (showNumber)968 {969 <div class="item-number dw-mod">{{number}}</div>970 }971972 @if (!onlyPreview && showStock)973 {974 <text>975 {{#if stockText}}976 <span>977 <span class="stock-icon {{stockState}} u-no-margin dw-mod" title="{{stockText}}"></span>978 <span class="u-margin-right--lg"> {{stockText}}</span>979 {{deliveryText}}980 </span>981 {{/if}}982 </text>983 }984 </div>985 @if (showStaticVariants)986 {987 <span>988 {{#Variants}}989 {{>StaticVariantsTemplate}}990 {{/Variants}}991 </span>992 <text>993 {{#ifCond variantGroupsCount '>' 1}}994 <div class="static-variant">995 @Translate("More options available")996 </div>997 {{/ifCond}}998 </text>999 }1000 <div class="grid__cell-footer stickers-container stickers-container--row u-margin-top dw-mod">1001 {{#StickersContainers}}1002 {{#Stickers}}1003 {{>MiniSticker}}1004 {{/Stickers}}1005 {{/StickersContainers}}1006 </div>1007 </div>1008 </div>1009 <div class="product-list__details-item__right grid__cell dw-mod">1010 @if (!onlyPreview && showCartButton)1011 {1012 <div class="u-margin-right">1013 <input type="checkbox" id="UnitOptions_{{id}}" class="dropdown-trigger" />1014 <div class="dropdown u-w120px use-btn-primary-height {{hasUnits}} dw-mod">1015 <label class="dropdown__header dropdown__btn dw-mod" for="UnitOptions_{{id}}">{{unitName}}</label>1016 <div id="unitOptions" class="dropdown__content dw-mod">1017 {{#unitOptions}}1018 {{>UnitOption}}1019 {{/unitOptions}}1020 </div>1021 <label class="dropdown-trigger-off" for="UnitOptions_{{id}}"></label>1022 </div>1023 <input type="hidden" value="{{unitId}}" name="Unit{{id}}" id="Unit_{{id}}" />1024 <input type="hidden" value="{{variantid}}" name="VariantID{{id}}" id="Variant_{{id}}" />1025 </div>1026 }10271028 <div class="u-min-w140px product-list__details-item-price-block">1029 <div class="u-ta-right u-padding-right">1030 @if (pointShopOnly)1031 {1032 <text>1033 {{#if havePointPrice}}1034 <div class="price price--product-list price--micro dw-mod">{{points}} @Translate("points")</div>1035 {{else}}1036 @Translate("Not available")1037 {{/if}}1038 </text>1039 }1040 else1041 {10421043 if (!onlyPreview)1044 {1045 <text>1046 {{#ifCond preventWebSale "===" false}}1047 {{#unless HidePrice}}1048 <div class="price price--product-list dw-mod">{{price}}</div>1049 <div class="before-price {{onSale}} dw-mod">{{discount}}</div>1050 {{/unless}}1051 {{/ifCond}}1052 </text>1053 }105410551056 if (showVATPrice)1057 {1058 <small class="vat-price vat-price--micro dw-mod">1059 @if (isPricesWithVATEnabled)1060 {1061 @Translate("excl. VAT") <text>({{priceWithoutVAT}})</text>1062 }1063 else1064 {1065 @Translate("incl. VAT") <text>({{priceWithVAT}})</text>1066 }1067 </small>1068 }1069 }1070 </div>1071 </div>10721073 @if (!onlyPreview && showCartButton)1074 {1075 if (!pointShopOnly)1076 {1077 <text>1078 {{#unless preventWebSale}}1079 {{#unless HidePrice}}1080 <div class="{{hideBuyOptions}}">1081 <input type="number" class="u-w100px u-no-margin u-margin-right use-btn-primary-height" id="Quantity_{{id}}" name="Quantity{{id}}" value="1" min="1" step="1" onkeypress="return event.charCode >= 48 && event.charCode <= 57">1082 </div>1083 {{/unless }}1084 {{/unless }}1085 </text>1086 }1087 <text>1088 {{#unless preventWebSale}}1089 {{#unless HidePrice}}1090 <div class="{{hideBuyOptions}}">1091 @if (pointShopOnly)1092 {1093 <button type="button" id="CartButton_{{id}}" class="btn btn--primary btn--condensed u-no-margin dw-mod js-cart-btn {{disabledBuyButton}} {{#unless canBePurchasedWithPoints}}js-stay-disabled{{/unless}}" name="CartCmd" value="addWithPoints"1094 onclick="Cart.AddToCart(event, {1095 id: '{{productId}}',1096 variantId: '{{variantId}}',1097 unitId: '{{UnitId}}',1098 quantity: 1,1099 buyForPoints: true,1100 productInfo: {{productInfo}},1101 }); {{facebookPixelAction}}" {{disabledBuyButton}}>1102 <i class="@cartIcon"></i><span> @Translate("Buy with points")</span>1103 </button>1104 }1105 else1106 {1107 <button type="button" id="CartButton_{{id}}" class="js-cart-btn btn btn--primary btn--condensed u-pull--right u-no-margin dw-mod {{disabledBuyButton}}" name="submit"1108 onclick="Cart.AddToCart(event, {1109 id: '{{productId}}',1110 variantId: '{{variantid}}',1111 unitId: '{{unitId}}',1112 quantity: document.getElementById('Quantity_{{id}}').value,1113 productInfo: {{productInfo}},1114 }); {{facebookPixelAction}}" {{disabledBuyButton}}>1115 <i class="@cartIcon"></i>1116 </button>1117 }1118 </div>1119 {{/unless }}1120 {{/unless }}1121 @if (Pageview.AreaID == 1 && Pageview.User == null)1122 {11231124 }1125 else1126 {1127 <text>1128 {{#if preventWebSale}}1129 {{#unless Discontinued}}1130 <p>@Translate("Please call", "Please call")</p>1131 {{/unless}}1132 {{/if}}1133 </text>1134 }1135 </text>11361137 if (showViewButton)1138 {1139 //#unless hideViewMore1140 if (Pageview.User == null)1141 {1142 <text>1143 {{#if HidePrice}}1144 <div>1145 <label for="SignInModalTrigger" class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)">@Translate("Sign in")</label>1146 </div>1147 {{/if }}1148 </text>1149 }1150 }1151 }1152 else if (showViewButton)1153 {1154 <div>1155 @*<a href="{{link}}" class="btn btn--secondary u-no-margin dw-mod" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="@Translate(viewMoreText)">@Translate(viewMoreText)</a>*@1156 <label for="SignInModalTrigger" class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)">@Translate("Sign in")</label>11571158 </div>1159 }1160 @if (showFavoriteButton && Pageview.User != null)1161 {1162 <div class="favorites u-margin {{hasVariants}} dw-mod" {{hasVariants}}>1163 {{#Favorite}}1164 {{>FavoriteTemplate}}1165 {{/Favorite}}1166 </div>1167 <div class="favorites favorites--lg u-hidden {{hasVariants}} dw-mod" {{hasVariants}}>1168 {{#Favorite}}1169 {{>FavoriteListItem}}1170 {{/Favorite}}1171 </div>1172 }1173 @if (showAddToDownloadButton && Pageview.User != null)1174 {1175 <button type="button" class="btn btn--primary u-no-margin btn--condensed u-margin-left u-margin-right dw-mod js-add-to-downloads" title="@Translate("Add")" data-product-id="{{productId}}">1176 <i class="fas fa-plus js-button-icon"></i>1177 </button>1178 }1179 </div>1180 </div>1181 {{/.}}1182 </script>1183 }1184 else1185 {1186 <script id="ProductDetailsItem" type="text/x-template">1187 {{#.}}1188 @if (useGoogleTagManager)1189 {1190 <text>{{{googleEnchantImpression 'Product catalogue' currency googleImpression}}}</text>1191 }1192 <input type="hidden" name="ProductLoopCounter{{id}}" value="{{id}}" />1193 <input type="hidden" name="ProductID{{id}}" value="{{productId}}" />1194 <div class="grid__col-12 dw-mod">1195 <div class="grid__cell u-color-light--bg dw-mod">1196 <div class="u-margin">1197 <a href="{{link}}" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}">1198 <h6 class="u-no-margin">{{name}}</h6>1199 </a>1200 <div class="item-number item-number--compressed dw-mod">1201 @if (showNumber)1202 {1203 <div class="item-number dw-mod">{{number}}</div>1204 }12051206 @if (!onlyPreview && showStock)1207 {1208 <span>1209 <span class="stock-icon {{stockState}} u-no-margin dw-mod" title="{{stockText}}"></span>1210 <span> {{stockText}}</span>1211 {{deliveryText}}1212 </span>1213 }1214 </div>1215 @if (showStaticVariants)1216 {1217 <span>1218 {{#Variants}}1219 {{>StaticVariantsTemplate}}1220 {{/Variants}}1221 </span>1222 <text>1223 {{#ifCond variantGroupsCount '>' 1}}1224 <div class="static-variant">1225 @Translate("More options available")1226 </div>1227 {{/ifCond}}1228 </text>1229 }1230 <div class="grid__cell-footer stickers-container stickers-container--row u-margin-top dw-mod">1231 {{#StickersContainers}}1232 {{#Stickers}}1233 {{>MiniSticker}}1234 {{/Stickers}}1235 {{/StickersContainers}}1236 </div>1237 </div>1238 <div class="u-ta-right u-margin-bottom product-list__details-item-price-block dw-mod">1239 @if (pointShopOnly)1240 {1241 <text>1242 {{#if havePointPrice}}1243 <div class="price price--product-list price--micro dw-mod">{{points}} @Translate("points")</div>1244 {{else}}1245 @Translate("Not available")1246 {{/if}}1247 </text>1248 }1249 else1250 {1251 <div class="before-price {{onSale}} before-price--micro dw-mod">{{discount}}</div>1252 <div class="price price--product-list price--micro dw-mod">{{price}}</div>125312541255 }1256 </div>1257 </div>1258 <div class="grid__cell u-color-light--bg dw-mod">1259 <div class="collection u-pull--right u-no-margin u-margin dw-mod">1260 @if (!onlyPreview && showCartButton)1261 {1262 <div>1263 <input type="checkbox" id="UnitOptions_{{id}}" class="dropdown-trigger" />1264 <div class="dropdown u-w120px use-btn-primary-height {{hasUnits}} dw-mod">1265 <label class="dropdown__header dropdown__btn dw-mod" for="UnitOptions_{{id}}">{{unitName}}</label>1266 <div id="unitOptions" class="dropdown__content dw-mod">1267 {{#unitOptions}}1268 {{>UnitOption}}1269 {{/unitOptions}}1270 </div>1271 <label class="dropdown-trigger-off" for="UnitOptions_{{id}}"></label>1272 </div>1273 <input type="hidden" value="{{unitId}}" name="Unit{{id}}" id="Unit_{{id}}" />1274 <input type="hidden" value="{{variantid}}" name="VariantID{{id}}" id="Variant_{{id}}" />1275 </div>1276 }12771278 @if (!onlyPreview && showCartButton)1279 {1280 if (!pointShopOnly)1281 {1282 <div class="{{hideBuyOptions}}">1283 <input type="number" class="u-w50px u-no-margin use-btn-primary-height" id="Quantity_{{id}}" name="Quantity{{id}}" value="1" min="1" step="1" onkeypress="return event.charCode >= 48 && event.charCode <= 57">1284 </div>1285 }1286 <div class="{{hideBuyOptions}}">1287 @if (pointShopOnly)1288 {1289 <button type="button" id="CartButton_{{id}}" class="btn btn--primary btn--condensed u-no-margin dw-mod js-cart-btn {{disabledBuyButton}} {{#unless canBePurchasedWithPoints}}js-stay-disabled{{/unless}}" name="CartCmd" value="addWithPoints"1290 onclick="Cart.AddToCart(event, {1291 id: '{{productId}}',1292 variantId: '{{variantId}}',1293 unitId: '{{UnitId}}',1294 quantity: 1,1295 buyForPoints: true,1296 productInfo: {{productInfo}},1297 }); {{facebookPixelAction}}" {{disabledBuyButton}}>1298 <i class="@cartIcon"></i><span> @Translate("Buy with points")</span>1299 </button>1300 }1301 else1302 {1303 <button type="button" id="CartButton_{{id}}" class="js-cart-btn btn btn--primary btn--condensed u-pull--right u-no-margin dw-mod {{disabledBuyButton}}" name="submit"1304 onclick="Cart.AddToCart(event, {1305 id: '{{productId}}',1306 variantId: '{{variantid}}',1307 unitId: '{{unitId}}',1308 quantity: document.getElementById('Quantity_{{id}}').value,1309 productInfo: {{productInfo}},1310 }); {{facebookPixelAction}}" {{disabledBuyButton}}>1311 <i class="@cartIcon"></i>1312 </button>1313 }1314 </div>1315 if (showViewButton)1316 {1317 <text>1318 {{#unless hideViewMore}}1319 <div>1320 <a href="{{link}}" class="btn btn--secondary u-no-margin dw-mod" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="@Translate("View")">@Translate("View")</a>1321 </div>1322 {{/unless}}1323 </text>1324 }1325 }1326 else if (showViewButton)1327 {1328 <div>1329 <a href="{{link}}" class="btn btn--secondary u-no-margin dw-mod" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="@Translate("View")">@Translate("View")</a>1330 </div>1331 }1332 @if (showFavoriteButton && Pageview.User != null)1333 {1334 <div class="favorites u-margin {{hasVariants}} dw-mod" {{hasVariants}}>1335 {{#Favorite}}1336 {{>FavoriteTemplate}}1337 {{/Favorite}}1338 </div>1339 <div class="favorites favorites--lg u-hidden {{hasVariants}} dw-mod" {{hasVariants}}>1340 {{#Favorite}}1341 {{>FavoriteListItem}}1342 {{/Favorite}}1343 </div>1344 }1345 </div>1346 </div>1347 </div>1348 {{/.}}1349 </script>1350 }1351 }1352 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>1353 @using Dynamicweb.Core1354 @using System1355 @using System.Web1356 @using System.Collections.Generic1357 @using Dynamicweb.Rapido.Blocks13581359 @{1360 BlocksPage productListMenuBlocksPage = BlocksPage.GetBlockPage("ProductList");13611362 if (Pageview.Page.PropertyItem["LeftMenu"] != null && Converter.ToString(Pageview.Page.PropertyItem["LeftMenu"]) == "True" && Pageview.Page.NavigationSettings != null && Pageview.Page.NavigationSettings.UseEcomGroups) {1363 Block productListMenuBlock = new Block1364 {1365 Id = "Menu",1366 SortId = 20,1367 Template = RenderProductListMenu()1368 };13691370 productListMenuBlocksPage.Add("Navigation", productListMenuBlock);1371 }1372 }13731374 @helper RenderProductListMenu()1375 {1376 var navigationMarkup = RenderNavigation(new1377 {1378 id = "leftnav",1379 cssclass = "dwnavigation",1380 startLevel = 1,1381 endlevel = 5,1382 template = "LeftNavigation.xslt",1383 mode = "ecom"1384 });13851386 <h2 class="u-margin-bottom">@Translate("Product categories")</h2>13871388 <div class="u-padding-bottom--lg">1389 @navigationMarkup1390 </div>1391 }1392 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>1393 @using Dynamicweb.Core1394 @using System1395 @using System.Web1396 @using System.Collections.Generic1397 @using Dynamicweb.Rapido.Blocks13981399 @{1400 BlocksPage productListFacetsBlocksPage = BlocksPage.GetBlockPage("ProductList");14011402 string facetsBlockViewMode = !String.IsNullOrEmpty(Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode")) ? Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode").ToLower() : "left";14031404 if (facetsBlockViewMode == "left" && Pageview.Device.ToString() != "Mobile")1405 {1406 Block facetsBlock = new Block1407 {1408 Id = "Facets",1409 SortId = 30,1410 Template = RenderProductListFacets()1411 };1412 productListFacetsBlocksPage.Add("Navigation", facetsBlock);1413 }14141415 if (facetsBlockViewMode == "top" || Pageview.Device.ToString() == "Mobile")1416 {1417 Block facetsBlock = new Block1418 {1419 Id = "Facets",1420 SortId = 10,1421 Template = RenderProductListTopFacets()1422 };1423 productListFacetsBlocksPage.Add("ProductList", facetsBlock);1424 }142514261427 Block facetSelections = new Block1428 {1429 Id = "FacetSelections",1430 SortId = 20,1431 Template = RenderFacetSelections()1432 };1433 productListFacetsBlocksPage.Add("ProductList", facetSelections);1434 }14351436 @helper RenderFacetSelections()1437 {1438 @*This is part of a script template *@1439 <div class="grid">1440 <div class="grid__col-12 grid__col--bleed">1441 <div class="collection u-no-margin" id="selectedFacets">1442 {{#FacetSelections}}1443 {{> (lookup . 'template') }}1444 {{/FacetSelections}}1445 </div>1446 </div>1447 </div>1448 }14491450 @helper RenderProductListFacets()1451 {1452 @*This is part of a script template *@1453 <div class="u-margin-bottom--lg">1454 <h2 class="u-no-margin">@Translate("Filters")</h2>1455 </div>14561457 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" />1458 <div class="facets-container facets-container--left expandable--collapsed dw-mod" data-trigger="CheckFacetGroups">1459 {{#FacetGroups}}1460 <input type="checkbox" id="OptionsGroup_{{name}}" class="expand-trigger js-remember-state" {{defaultState}} />14611462 <div class="expand-container facets-container__box dw-mod js-filter">1463 <label class="expand-container__btn facets-container__header dw-mod" for="OptionsGroup_{{name}}">{{name}}</label>1464 <div class="expand-container__content dw-mod">1465 <div class="u-margin {{showFilter}}">1466 <input type="text" class="u-full-width u-no-margin" onkeyup="Filter.FilterItems(event)" placeholder="@Translate("Search")" />1467 </div>1468 <div class="facets-container__list dw-mod">1469 {{#FacetOptions}}1470 {{#ifCond template "===" "Checkboxes"}}1471 {{>Checkboxes}}1472 {{/ifCond}}1473 {{#ifCond template "===" "Range"}}1474 {{>Checkboxes}}1475 {{/ifCond}}1476 {{#ifCond template "===" "Weight"}}1477 {{>Checkboxes}}1478 {{/ifCond}}1479 {{#ifCond template "===" "Tags"}}1480 {{>Tags}}1481 {{/ifCond}}1482 {{#ifCond template "===" "Colors"}}1483 {{>Colors}}1484 {{/ifCond}}1485 {{/FacetOptions}}1486 </div>1487 </div>1488 </div>1489 {{/FacetGroups}}1490 </div>1491 <label for="CheckFacetGroups" class="btn btn--primary btn--full dw-mod js-expand-hide facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Select filters")</label>1492 <label for="CheckFacetGroups" class="btn btn--primary btn--full dw-mod expandable--collapsed facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Close filters")</label>1493 }14941495 @helper RenderProductListTopFacets()1496 {1497 @*This is part of a script template *@1498 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" />1499 <div class="grid grid--external-bleed-x dw-mod expandable--collapsed facets-container facets-container--top" data-trigger="CheckFacetGroups">1500 {{#FacetGroups}}1501 <div class="grid__col-lg-3 grid__col-md-3 grid__col-sm-4 grid__col-xs-12">1502 <input type="checkbox" id="OptionsGroup_{{counter}}" class="dropdown-trigger" />1503 <div class="dropdown dw-mod js-filter">1504 <label class="dropdown__header dropdown__btn dw-mod" for="OptionsGroup_{{counter}}">{{name}}</label>1505 <div class="dropdown__content dropdown__content--padding dw-mod">1506 <div class="u-margin-bottom {{showFilter}}">1507 <input type="text" class="u-full-width u-no-margin" onkeyup="Filter.FilterItems(event)" placeholder="@Translate("Search")" />1508 </div>1509 {{#FacetOptions}}1510 {{#ifCond template "===" "Checkboxes"}}1511 {{>Checkboxes}}1512 {{/ifCond}}1513 {{#ifCond template "===" "Range"}}1514 {{>Checkboxes}}1515 {{/ifCond}}1516 {{#ifCond template "===" "Weight"}}1517 {{>Checkboxes}}1518 {{/ifCond}}1519 {{#ifCond template "===" "Tags"}}1520 {{>Tags}}1521 {{/ifCond}}1522 {{#ifCond template "===" "Colors"}}1523 {{>Colors}}1524 {{/ifCond}}1525 {{/FacetOptions}}1526 </div>1527 <label class="dropdown-trigger-off" for="OptionsGroup_{{counter}}"></label>1528 </div>1529 </div>1530 {{/FacetGroups}}1531 </div>1532 <label for="CheckFacetGroups" class="btn btn--primary btn--full dw-mod js-expand-hide facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Select filters")</label>1533 <label for="CheckFacetGroups" class="btn btn--primary btn--full dw-mod expandable--collapsed facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Close filters")</label>1534 }15351536 @*Facets*@1537 <script id="Checkboxes" type="text/x-template">1538 <input type="checkbox" class="{{selected}} checkbox-facet__checkbox form__control dw-mod" onclick="Facets.UpdateFacets(this);" id="{{queryParameter}}{{value}}" name="{{queryParameter}}" value="[{{value}}]" {{selected}} {{disabled}}>1539 <label class="{{disabled}} checkbox-facet dw-mod" data-filter-value="{{label}}" for="{{queryParameter}}{{value}}">1540 <span class="checkbox-facet__label dw-mod">{{label}}</span>1541 <span class="checkbox-facet__count dw-mod">({{count}})</span>1542 </label>1543 </script>15441545 <script id="Tags" type="text/x-template">1546 <button type="button" class="btn btn--tag {{selected}} {{disabled}}" data-filter-value="{{label}}" data-check="{{selected}}" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" {{disabled}}>1547 {{label}} <span class="facets-group__counter">({{count}})</span>1548 </button>1549 </script>15501551 <script id="Colors" type="text/x-template">1552 <button type="button" class="btn btn--colorbox u-margin-right {{selected}} {{disabled}}" data-filter-value="{{label}}" style="background-color: {{value}}" title="{{label}}" data-check="{{selected}}" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" {{disabled}}></button>1553 </script>15541555 @*Facet selections*@1556 <script id="SelectedFilter" type="text/x-template">1557 <button type="button" class="btn btn--tag" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" title="@Translate("Remove filter")">1558 {{group}}: {{label}} <i class="fas fa-times"></i>1559 </button>1560 </script>15611562 <script id="SelectedColorFilter" type="text/x-template">1563 <button type="button" class="btn btn--tag" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" title="@Translate("Remove filter")">1564 {{group}}: <div class="btn__colorbox" style="background-color: {{label}}"></div> <i class="fas fa-times"></i>1565 </button>1566 </script>15671568 <script id="ResetFilters" type="text/x-template">1569 <button type="button" class="btn btn--tag" onclick="Facets.ResetFacets();">1570 @Translate("Reset all filters") <i class="fas fa-redo"></i>1571 </button>1572 </script>1573 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>1574 @using Dynamicweb.Core1575 @using System1576 @using System.Web1577 @using System.Collections.Generic1578 @using Dynamicweb.Rapido.Blocks15791580 @{1581 BlocksPage productListMoreBlocksPage = BlocksPage.GetBlockPage("ProductList");15821583 Block moreBlock = new Block1584 {1585 Id = "More",1586 SortId = 40,1587 Template = RenderListMore()1588 };15891590 productListMoreBlocksPage.Add("ProductList", moreBlock);1591 }15921593 @helper RenderListMore()1594 {1595 @*This is part of a script template *@1596 string groupID = HttpContext.Current.Request.QueryString.Get("groupid");1597 string listId = HttpContext.Current.Request.QueryString.Get("ListID");1598 bool isFavoriteList = !string.IsNullOrEmpty(listId);1599 string moreFeedFullUrl = GetGlobalValue("Global:Pageview.Url.Raw") + "&feed=true";1600 moreFeedFullUrl += !isFavoriteList ? "&DoNotShowVariantsAsSingleProducts=True" : "";1601 string columnCss = Pageview.Device.ToString() == "Mobile" ? "grid__col--bleed" : "grid__col--bleed-y";16021603 <div class="grid">1604 <div class="grid__col-12 @columnCss">1605 <button type="button" id="LoadMoreButton" class="btn btn--primary btn--full {{nextdisabled}} dw-mod" data-current="{{currentPage}}" data-page-size="{{pageSize}}" data-total="{{totalPages}}" data-container="ProductsContainer" data-feed-url="@moreFeedFullUrl&groupid=@groupID{{loadMoreFeedParams}}" onclick="LoadMore.Next(this)" {{nextdisabled}}>@Translate("Load") {{pageSizeText}} @Translate("more")</button>1606 <button type="button" class="btn btn--clean" onclick="window.scroll(0, 0)">@Translate("Return to top")</button>1607 </div>1608 </div>1609 }1610 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>1611 @using Dynamicweb.Core1612 @using System1613 @using System.Web1614 @using System.Collections.Generic1615 @using Dynamicweb.Rapido.Blocks16161617 @{1618 BlocksPage productListBottomSnippetsPage = BlocksPage.GetBlockPage("ProductList");16191620 Block productListStickers = new Block1621 {1622 Id = "Stickers",1623 SortId = 10,1624 Template = RenderStickersTemplates()1625 };1626 productListBottomSnippetsPage.Add("BottomSnippets", productListStickers);16271628 Block productListUnits = new Block1629 {1630 Id = "Units",1631 SortId = 20,1632 Template = RenderUnitTemplates()1633 };1634 productListBottomSnippetsPage.Add("BottomSnippets", productListUnits);16351636 Block productListVariants = new Block1637 {1638 Id = "Variants",1639 SortId = 30,1640 Template = RenderVariantTemplates()1641 };1642 productListBottomSnippetsPage.Add("BottomSnippets", productListVariants);16431644 Block productListFavorites = new Block1645 {1646 Id = "Favorites",1647 SortId = 40,1648 Template = RenderFavoritesTemplates()1649 };1650 productListBottomSnippetsPage.Add("BottomSnippets", productListFavorites);16511652 Block productListPreRender = new Block1653 {1654 Id = "PreRenders",1655 SortId = 50,1656 Template = RenderPreRenderTemplates()1657 };1658 productListBottomSnippetsPage.Add("BottomSnippets", productListPreRender);16591660 Block productListInitializers = new Block1661 {1662 Id = "Initializers",1663 SortId = 60,1664 Template = RenderInitializers()1665 };1666 productListBottomSnippetsPage.Add("BottomSnippets", productListInitializers);1667 }16681669 @helper RenderStickersTemplates() {1670 <script id="StickersContainer" type="text/x-template">1671 <div class="stickers-container stickers-container--{{position}} dw-mod">1672 {{#Stickers}}1673 {{>Sticker}}1674 {{/Stickers}}1675 </div>1676 </script>16771678 <script id="Sticker" type="text/x-template">1679 <div class="stickers-container__tag {{className}} dw-mod">{{text}}</div>1680 </script>16811682 <script id="MiniSticker" type="text/x-template">1683 <div class="stickers-container__tag stickers-container__tag--micro {{className}} dw-mod">{{text}}</div>1684 </script>1685 }16861687 @helper RenderUnitTemplates() {1688 <script id="UnitOption" type="text/x-template">1689 <div class="dropdown__item dw-mod" onclick="HandlebarsBolt.UpdateContent('Product{{id}}', '{{link}}&feed=true&UnitID={{value}}&rid={{id}}')">{{name}}</div>1690 </script>1691 }16921693 @helper RenderVariantTemplates() {1694 <script id="VariantsTemplate" type="text/x-template">1695 {{#.}}1696 <div>1697 <div class="u-bold">{{name}}</div>1698 <div>1699 {{#VariantOptions}}1700 {{>VariantOption}}1701 {{/VariantOptions}}1702 </div>1703 </div>1704 {{/.}}1705 </script>17061707 <script id="VariantOption" type="text/x-template">1708 {{#if color}}1709 <button type="button" data-variant-id="{{variantId}}" data-variant-group="{{groupId}}" onclick="MatchVariants.SelectThis(event)" class="btn btn--colorbox u-margin-right {{disabled}} {{selected}} js-variant-option" data-check="{{selected}}" {{disabled}} style="background-color: {{color}}"></button>1710 {{else}}1711 {{#if image}}1712 <img data-variant-id="{{variantId}}" data-variant-group="{{groupId}}" src="{{image}}" onclick="MatchVariants.SelectThis(event)" alt="{{name}}" title="{{name}}" class="btn btn--tag {{selected}} js-variant-option" data-check="{{selected}}" />1713 {{else}}1714 <button type="button" data-variant-id="{{variantId}}" data-variant-group="{{groupId}}" onclick="MatchVariants.SelectThis(event)" class="btn btn--tag {{disabled}} {{selected}} js-variant-option" data-check="{{selected}}" {{disabled}}>{{name}}</button>1715 {{/if}}1716 {{/if}}1717 </script>17181719 <script id="StaticVariantsTemplate" type="text/x-template">1720 {{#.}}1721 {{#if isFirstGroup}}1722 <div>1723 {{#VariantOptions}}1724 {{>StaticVariantOption}}1725 {{/VariantOptions}}1726 </div>1727 {{/if}}1728 {{/.}}1729 </script>17301731 <script id="StaticVariantOption" type="text/x-template">1732 {{#if color}}1733 <div class="static-variant static-variant--color dw-mod" style="background-color: {{color}}" title="{{name}}"></div>1734 {{else}}1735 <div class="static-variant dw-mod">{{name}} </div>1736 {{/if}}1737 </script>17381739 <script id="VariantOptionImage" type="text/x-template">1740 <img data-variant-id="{{variantId}}" data-friends="{{friendsList}}" data-variant-group="{{groupId}}" onclick="MatchVariants.SelectThis(event)" src="/Admin/Public/GetImage.ashx?width=100&height=50&crop=5&Compression=75&image=/Images/{{image}}" alt="{{name}}" title="{{name}}" class="btn btn--tag {{disabled}} {{selected}} js-variant-option" data-check="{{selected}}" {{disabled}} />1741 </script>1742 }17431744 @helper RenderFavoritesTemplates() {1745 <script id="FavoriteTemplate" type="text/x-template">1746 <div class="favorites-list u-ta-left">1747 <label for="FavoriteTrigger_{{id}}" class="u-no-margin js-favorite-btn"><i class="{{favoriteIcon}} fa-1_5x"></i></label>1748 <input type="checkbox" id="FavoriteTrigger_{{id}}" class="dropdown-trigger" />1749 <div class="dropdown dropdown--absolute-position">1750 <div class="dropdown__content dropdown__content--show-left dropdown__content--padding u-w220px dw-mod">1751 <ul class="list list--clean dw-mod">1752 {{#FavoriteLists}}1753 {{>FavoriteListItem}}1754 {{/FavoriteLists}}1755 </ul>1756 </div>1757 <label class="dropdown-trigger-off" for="FavoriteTrigger_{{id}}"></label>1758 </div>1759 </div>1760 </script>17611762 <script id="FavoriteListItem" type="text/x-template">1763 <li>1764 <a href="{{link}}" class="list__link u-no-underline dw-mod" onclick="Scroll.SavePosition(event); {{facebookPixelAction}}"><i class="{{favoriteIcon}}"></i> {{name}}</a>1765 </li>1766 </script>1767 }17681769 @helper RenderPreRenderTemplates() {1770 string facetsViewMode = !String.IsNullOrEmpty(Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode")) ? Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode").ToLower() : "left";17711772 <script id="ProductPreRenderContainer" type="text/x-template">1773 @if (facetsViewMode == "left" && Pageview.Device.ToString() != "Mobile")1774 {1775 <div class="grid__col-3">1776 <div class="pre-render-element pre-render-element--xs"></div>1777 <div class="pre-render-element pre-render-element--md"></div>1778 <div class="pre-render-element pre-render-element--md"></div>1779 <div class="pre-render-element pre-render-element--md"></div>1780 </div>1781 }1782 <div class="grid__col-auto">1783 <div class="pre-render-element pre-render-element--xs"></div>1784 <div class="pre-render-element pre-render-element--lg"></div>1785 <div class="pre-render-element pre-render-element--lg"></div>1786 <div class="pre-render-element pre-render-element--lg"></div>1787 <div class="pre-render-element pre-render-element--lg"></div>1788 </div>1789 </script>1790 }17911792 @helper RenderInitializers() {1793 <script>1794 document.addEventListener("DOMContentLoaded", function (event) {1795 document.getElementById("productList").addEventListener('contentLoaded', function (e) {1796 if (getTarget(e).id === "productList") {1797 Search.Init();1798 Facets.Init("selectedFacets", "productList");1799 }1800 }, false);1801 });1802 </script>1803 }18041805 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>1806 @using Dynamicweb.Core1807 @using System1808 @using System.Web1809 @using System.Linq1810 @using System.Collections.Generic1811 @using Dynamicweb.Rapido.Blocks18121813 @functions {1814 BlocksPage productListActionsBlocksPage = BlocksPage.GetBlockPage("ProductList");1815 }18161817 @{1818 productListActionsBlocksPage.Add("ProductList", new Block1819 {1820 Id = "Actions",1821 SortId = 10,1822 Template = RenderListActions()1823 });18241825 productListActionsBlocksPage.Add("BottomSnippets", new Block() {1826 Id = "ListViewSelectListener",1827 Template = RenderListViewSelectListener()1828 });1829 }18301831 @helper RenderListActions()1832 {1833 @*This is part of a script template *@18341835 bool showSorting = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableSorting");1836 bool onlyPreview = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Pageview.User == null;1837 string listId = HttpContext.Current.Request.QueryString.Get("ListID");1838 bool isFavoriteList = !string.IsNullOrEmpty(listId);1839 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fas fa-shopping-cart";18401841 List<Block> subBlocks = this.productListActionsBlocksPage.GetBlockListById("Views").OrderBy(item => item.SortId).ToList();18421843 <div class="grid u-margin-bottom--lg">1844 @if (!isFavoriteList)1845 {1846 <div class="grid__col--bleed-y grid__col-md-auto u-no-padding-x">1847 <h2 class="u-no-margin"><i class="{{headerIcon}}"></i>{{header}}</h2>1848 <h6 class="u-no-margin">{{groupDescription}}</h6>1849 </div>1850 }1851 <div class="grid--align-end grid__col--bleed-y grid__col-md-auto u-no-padding-x grid--align-self-center">1852 <div class="collection u-no-margin">1853 @if (showSorting)1854 {1855 if (Pageview.Device.ToString() != "Mobile")1856 {1857 <h5 class="u-inline-block u-margin-right">@Translate("Sort by")</h5>1858 }1859 else1860 {1861 <h5 class="u-inline-block u-margin-right">@Translate("Sort")</h5>1862 }1863 <input type="checkbox" id="ProductSort" class="dropdown-trigger" />1864 <div class="dropdown u-w150px u-w120px--xs u-margin-right u-inline-block dw-mod">1865 <label class="dropdown__header dropdown__btn dropdown__btn--small dw-mod" for="ProductSort">{{selectedSort}}</label>1866 <div class="dropdown__content dw-mod">1867 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: '', SortOrder: '' }, true);">@Translate("Default")</div>1868 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Created', SortOrder: 'DESC'}, true);">@Translate("Newest")</div>1869 @if (!onlyPreview)1870 {1871 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Price', SortOrder: 'ASC' }, true);">@Translate("Price low - high")</div>1872 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Price', SortOrder: 'DESC' }, true);">@Translate("Price high - low")</div>1873 }1874 </div>1875 <label class="dropdown-trigger-off" for="ProductSort"></label>1876 </div>1877 }18781879 @if (subBlocks.Count > 1)1880 {1881 foreach (Block item in subBlocks)1882 {1883 <input type="radio" class="tag-btn-trigger" id="ListViewBtn_@item.Id" name="ViewBtnGroup">1884 <label for="ListViewBtn_@item.Id" class="btn btn--tag u-no-margin" onclick="HandlebarsBolt.UpdateTemplate('ProductsContainer', '@item.Id')"><i class="fas fa-@item.Name"></i></label>1885 }1886 }18871888 @if (isFavoriteList)1889 {1890 if (Pageview.Device.ToString() != "Mobile")1891 {1892 <button type="submit" class="btn btn--primary btn--sm dw-mod u-no-margin">@Translate("Buy all") <i class="@cartIcon"></i></button>1893 }1894 else1895 {1896 <button type="submit" class="btn btn--primary btn--full btn--sm u-margin-top dw-mod">@Translate("Buy all") <i class="@cartIcon"></i></button>1897 }1898 }1899 </div>1900 </div>1901 </div>1902 }19031904 @helper RenderListViewSelectListener()1905 {1906 /* the same block code placed in ProductListFeed.cshtml */1907 Dictionary<string, bool> views = new Dictionary<string, bool>()1908 {1909 { "ProductItemContainer", Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableListView") },1910 { "ProductGridItemContainer", Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableGridView") },1911 { "ProductDetailsItemContainer", Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableDetailsView") }1912 };19131914 string defaultView = Pageview.AreaSettings.GetItem("ProductList").GetList("DefaultListView") != null ? Pageview.AreaSettings.GetItem("ProductList").GetList("DefaultListView").SelectedValue : "";19151916 if (!string.IsNullOrEmpty(defaultView) && views[defaultView])1917 {1918 defaultView = defaultView;1919 }1920 else1921 {1922 defaultView = views.FirstOrDefault(x => x.Value).Key ?? "ProductItemContainer";1923 }19241925 <script>1926 let defaultTemplate = '@defaultView';1927 let container = 'productList';1928 let cookieName = 'ProductsContainerTemplate';19291930 document.addEventListener('DOMContentLoaded', function (event) {1931 document.getElementById(container).addEventListener('contentLoaded', function () {1932 let selectedMode = RememberState.GetCookie(cookieName);1933 let element = document.getElementById('ListViewBtn_' + (selectedMode != null ? selectedMode : defaultTemplate));1934 if (element != null) {1935 element.checked = true;1936 }1937 }, false);1938 });1939 </script>1940 }1941 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/eCom/ProductList/Blocks/Custom__Blocks.cshtml")))1942 {1943 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>1944 @using Dynamicweb.Core1945 @using System1946 @using System.Web1947 @using System.Collections.Generic1948 @using Dynamicweb.Rapido.Blocks19491950 @{1951 BlocksPage customBlocksPage = BlocksPage.GetBlockPage("ProductList");19521953 }</text>1954 }19551956 @if (productListNavigation.BlocksList.Count < 1) {1957 productListNavigation.Design.RenderType = RenderType.Hide;1958 }19591960 <form name="multiForm" id="multiForm" method="post">1961 <input type="hidden" name="CartCmd" id="CartCmd" value="addMulti" />1962 <input type="hidden" name="OrderContext" id="OrderContext" value="" />1963 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@1964 @RenderBlockList(productListPage.BlocksRoot.BlocksList)1965 </form>19661967 @helper RenderPageContainer() {1968 string groupid = HttpContext.Current.Request.QueryString["groupid"] == null ? string.Empty : HttpContext.Current.Request.QueryString["groupid"].ToString();1969 string Search = HttpContext.Current.Request.QueryString["Search"] == null ? string.Empty : HttpContext.Current.Request.QueryString["Search"].ToString();1970 List<Block> subBlocks = this.productListPage.GetBlockListById("PageContainer").OrderBy(item => item.SortId).ToList();19711972 string pageUrl = GetGlobalValue("Global:Pageview.Url.Raw");1973 string listId = HttpContext.Current.Request.QueryString.Get("ListID");1974 bool isFavoriteList = !string.IsNullOrEmpty(listId);1975 string feedFullUrl = pageUrl + "&feed=true";1976 feedFullUrl += !isFavoriteList ? "&DoNotShowVariantsAsSingleProducts=True" : "";1977 string smallDeviceCss = Pageview.Device.ToString() == "Mobile" ? "" : "u-padding";19781979 <div class="grid grid--align-content-start @smallDeviceCss js-handlebars-root" id="productList" data-template="ProductContainer" data-pre-render-template="ProductPreRenderContainer" data-json-feed="@feedFullUrl" data-preloader="overlay"></div>19801981 <script id="ProductContainer" type="text/x-template">1982 {{#each .}}1983 @RenderBlockList(subBlocks)1984 {{else}}1985 @if (!string.IsNullOrEmpty(groupid))1986 {1987 <div class="grid__col-lg-3 grid__col-md-3 grid__col-sm-12 grid__col-xs-12 dw-mod">1988 <h2 class="u-margin-bottom">@Translate("Product categories")</h2>19891990 <div class="u-padding-bottom--lg">19911992 @RenderNavigation(new1993 {1994 id = "leftnav",1995 cssclass = "dwnavigation",1996 startLevel = 1,1997 endlevel = 4,1998 template = "LeftNavigationEcom.xslt",1999 expandmode = "path"2000 })2001 </div>2002 </div>200320042005 var groupService = new Dynamicweb.Ecommerce.Products.GroupService();2006 Dynamicweb.Ecommerce.Products.Group group = null;2007 if (!string.IsNullOrEmpty(groupid))2008 {2009 group = groupService.GetGroup(groupid);2010 }201120122013 <div class="grid__col-auto ">2014 <div class="grid__cell">2015 <h2 class="u-margin-bottom">@group.Name</h2>2016 <h6 class="u-margin-bottom">@group.Description</h6>2017 <div class="grid product-list grid--external-bleed-x dw-mod">20182019 @if (group != null && group.HasChildGroups)2020 {2021 foreach (var g in group.Subgroups)2022 {2023 var link = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?id=2200&groupid=" + g.Id);20242025 if (Pageview.Area.ID == 28)2026 {2027 link = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?id=2200&groupid=" + g.Id);2028 var regex = new Regex(Regex.Escape("products/"));2029 link = regex.Replace(link, "", 1);2030 }20312032 var image = g.LargeImage;2033 if (!string.IsNullOrEmpty(image) && image != "Images/Ecom/Machines/")2034 {2035 if (image.StartsWith("/"))2036 {2037 image = "/Files" + image;2038 }2039 else2040 {2041 image = "/Files/" + image;2042 }2043 }2044 else2045 {2046 image = "/Files/Images/Ecom/Groups/S-web-base.jpg";2047 }2048 <div class="grid__col-lg-4 grid__col-md-4 grid__col-sm-4 grid__col-xs-6 product-list__grid-item image-hover--zoom dw-mod">2049 <div class="grid__cell product-list__grid-item__image dw-mod ">2050 <a href="@link" title="@g.Name" class="u-block u-position-relative image-hover__wrapper dw-mod">2051 <img class="grid__cell-img grid__cell-img--centered u-padding b-lazy b-loaded" src="/Admin/Public/GetImage.ashx?width=300&height=300&Compression=75&FillCanvas=true&DoNotUpscale=true&image=@image" alt="@g.Name">2052 </a>2053 </div>2054 <div class="grid__cell product-list__grid-item__price-info dw-mod">2055 <a href="@link" title="@g.Name">2056 <h6 class="u-condensed-text">@g.Name</h6>2057 </a>2058 </div>2059 </div>2060 }2061 }20622063 </div>2064 </div>2065 </div>20662067 }2068 else if (!string.IsNullOrEmpty(Search))2069 {2070 <div class="grid__col-auto">2071 @Pageview.AreaSettings.GetItem("Custom").GetString("ProductNotFoundContent");2072 </div>2073 }2074 {{/each}}2075 </script>2076 }20772078 @helper RenderProductList() {2079 @*This is part of a script template *@20802081 List<Block> subBlocks = productListPage.GetBlockListById("ProductList").OrderBy(item => item.SortId).ToList();20822083 string pageId = GetGlobalValue("Global:Page.ID");2084 string pageUrl = GetGlobalValue("Global:Pageview.Url.Raw");2085 string listId = HttpContext.Current.Request.QueryString.Get("ListID");2086 bool isFavoriteList = !string.IsNullOrEmpty(listId);2087 string feedFullUrl = pageUrl + "&feed=true";2088 feedFullUrl += !isFavoriteList ? "&DoNotShowVariantsAsSingleProducts=True" : "";2089 string smallDeviceCss = Pageview.Device.ToString() == "Mobile" ? "" : "";20902091 <div class="grid__col-sm-auto grid__col-xs-12 @smallDeviceCss">2092 @if (isFavoriteList)2093 {2094 string searchPlaceholder = Translate("Search favorite products", "Search favorite products");2095 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";20962097 <div class="grid__cell">2098 <div class="u-pull--left">2099 <h2 class="u-no-margin"><i class="{{headerIcon}}"></i>{{header}}</h2>2100 </div>2101 <div class="grid__col--bleed grid__col-6 u-pull--right">2102 <div class="u-margin-bottom">2103 <div class="typeahead u-color-inherit js-typeahead" data-page-size="10" id="FavoritesSearch" data-list-id="@listId" data-search-feed-id="@pageId&feed=true" data-result-page-id="@pageId">2104 <input type="text" class="typeahead-search-field u-no-margin u-full-width js-typeahead-search-field" placeholder="@searchPlaceholder" value="@searchValue">2105 <ul class="dropdown dropdown--absolute-position u-full-width js-handlebars-root js-typeahead-search-content u-min-w220px u-full-width dw-mod" id="FavoritesSearchContent" data-template="SearchProductsTemplate" data-json-feed="@feedFullUrl&ListID=@listId" data-init-onload="false" data-preloader="minimal"></ul>2106 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn"><i class="fas fa-search"></i></button>2107 </div>2108 </div>2109 </div>2110 </div>2111 }21122113 <div class="grid__cell">2114 @RenderBlockList(subBlocks)2115 </div>2116 </div>2117 }