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_f4d30c7e9a1b4c06a8f718b9c38dee19.b__22_0(TextWriter __razor_helper_writer) in D:\Web Sites\NewSpaldings\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 2081at RazorEngine.Templating.TemplateWriter.ToString()at System.Lazy`1.CreateValue()at System.Lazy`1.LazyInitValue()at CompiledRazorTemplates.Dynamic.RazorEngine_f4d30c7e9a1b4c06a8f718b9c38dee19.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\Web Sites\NewSpaldings\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 168at CompiledRazorTemplates.Dynamic.RazorEngine_f4d30c7e9a1b4c06a8f718b9c38dee19.<>c__DisplayClass1_0.b__0(TextWriter __razor_helper_writer) in D:\Web Sites\NewSpaldings\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 82at CompiledRazorTemplates.Dynamic.RazorEngine_f4d30c7e9a1b4c06a8f718b9c38dee19.Execute() in D:\Web Sites\NewSpaldings\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 2030at 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&amp;height=300&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=true&amp;FillCanvas=true&amp;image={{image}}"305 @if (secondaryImage) { <text>306 {{#if secondaryImage}}307 data-secondary-image-src="/Admin/Public/GetImage.ashx?width=300&amp;height=300&amp;crop=5&amp;Compression=75&amp;FillCanvas=true&amp;DoNotUpscale=true&amp;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 {{#unless SLWebHideStock}}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 {{/unless }}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 <p>@Translate("Please call", "Please call")</p>508 {{/if}}509 </text>510 }511 </text>512 if (showViewButton)513 {514 if (Pageview.User == null)515 {516 <text>517 {{#if HidePrice}}518 <div class="buttons-collection buttons-collection--right">519 <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>520 </div>521 {{/if}}522 </text>523 }524 }525 }526 else if (showViewButton)527 {528 <div class="buttons-collection buttons-collection--right">529 <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">530 @Translate(viewMoreText)531 </a>532 </div>533 }534535 </div>536 </div>537 </div>538 }539 else540 {541542 <div class="grid__cell-footer">543 <div class="grid__cell">544 <div class="product-list__list-item__price-actions dw-mod">545 @if (Pageview.User == null)546 {547 <text>548 {{#if SLGuestPricing}}549 <div class="price price--product-list dw-mod">{{price}}</div>550 <div class="before-price {{onSale}} dw-mod">{{discount}}</div>551 {{/if}}552 </text>553 }554 <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>555556 </div>557 </div>558 </div>559 @*<button type="button" id="CartButton_{{id}}" class="u-hidden"></button>*@560561 }562563 @if (showAddToDownloadButton && Pageview.User != null)564 {565 <div class="grid__cell-footer @((showCartButton || showViewButton) ? "u-margin-top" : "" )">566 <div class="grid__cell">567 <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}}">568 <i class="fas fa-plus js-button-icon"></i>569 <span class="js-button-text">@Translate("Add")</span>570 </button>571 </div>572 </div>573 }574 </div>575 </div>576 {{/.}}577 </script>578 }579 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>580 @using Dynamicweb.Core581 @using System582 @using System.Web583 @using System.Collections.Generic584 @using Dynamicweb.Rapido.Blocks585586 @if (Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableGridView"))587 {588 BlocksPage productList = BlocksPage.GetBlockPage("ProductList");589590 Block gridViewButton = new Block591 {592 Id = "ProductGridItemContainer",593 Name = "th",594 SortId = 20595 };596 productList.Add("Views", gridViewButton);597598 Block gridViewScripts = new Block599 {600 Id = "GridViewScripts",601 SortId = 20,602 Template = GridView()603 };604 productList.Add("BottomSnippets", gridViewScripts);605 }606607 @helper GridView()608 {609 bool onlyPreview = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Pageview.User == null;610 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");611 bool showPrice = !Pageview.AreaSettings.GetItem("ProductList").GetBoolean("HidePrice");612 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fas fa-shopping-cart";613 string columnsCount = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetList("Columns") != null ? Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetList("Columns").SelectedValue : "4";614 bool showCartButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowAddToCartButton");615 bool showViewButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowViewButton");616 bool showFavoriteButton = !Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("HideFavoriteButton");617 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowAddToDownloadButton");618 bool showStock = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowStockAndShipping");619 bool showNumber = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowProductNumber");620 bool showStaticVariants = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowStaticVariants");621 string cartButtonText = Converter.ToInt32(columnsCount) >= 4 && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" ? Translate("Add to cart") : "";622 string viewMoreText = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetString("ViewMoreText")) ? Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetString("ViewMoreText") : "View";623 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));624 bool showVATPrice = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("ShowBothPricesWithWithoutVAT");625 bool isPricesWithVATEnabled = Converter.ToBoolean(Pageview.Area.EcomPricesWithVat);626 string imageZoomOnHover = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("HoverImageZoom") ? "image-hover--zoom" : "";627 bool secondaryImage = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetString("HoverAlternatineImage") != null ? Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("HoverAlternatineImage") : false;628 string footerClasses = showStaticVariants ? "u-min-h120px" : "";629630631 <script id="ProductGridItemContainer" type="text/x-template">632 {{#.}}633 <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">634 {{#Product}}635 {{>ProductGridItem}}636 {{/Product}}637638 </div>639 {{/.}}640 </script>641642 <script id="ProductGridItem" type="text/x-template">643 {{#.}}644 @if (useGoogleTagManager)645 {646 <text>{{{googleEnchantImpression 'Product catalogue' currency googleImpression}}}</text>647 }648 <input type="hidden" name="ProductLoopCounter{{id}}" value="{{id}}" />649 <input type="hidden" name="ProductID{{id}}" value="{{productId}}" />650 <input type="hidden" name="wishListID{{id}}" id="wishListID{{id}}" value="0" />651652 <div class="grid__cell product-list__grid-item__image dw-mod {{noImage}}">653 <a href="{{link}}" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}" class="u-block u-position-relative image-hover__wrapper dw-mod">654 <img class="grid__cell-img grid__cell-img--centered u-padding b-lazy" src="/Files/Images/placeholder.gif"655 data-src="/Admin/Public/GetImage.ashx?width=300&amp;height=300&amp;crop=5&amp;Compression=75&amp;FillCanvas=true&amp;DoNotUpscale=true&amp;image={{image}}"656 @if (secondaryImage) { <text>657 {{#if secondaryImage}}658 data-secondary-image-src="/Admin/Public/GetImage.ashx?width=300&amp;height=300&amp;crop=5&amp;Compression=75&amp;FillCanvas=true&amp;DoNotUpscale=true&amp;image={{secondaryImage}}"659 {{/if}}660 </text> }661 alt="{{name}}" />662 {{#StickersContainers}}663 {{>StickersContainer}}664 {{/StickersContainers}}665 </a>666 @if (showFavoriteButton)667 {668 <div class="favorites favorites--for-grid-view u-pull--right {{hasVariants}} dw-mod" {{hasVariants}}>669 {{#Favorite}}670 {{>FavoriteTemplate}}671 {{/Favorite}}672 </div>673 }674 </div>675676 <div class="grid__cell product-list__grid-item__price-info dw-mod">677 <a href="{{link}}" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}">678 <h6 class="u-condensed-text">{{name}}</h6>679 </a>680 @if (showNumber)681 {682 <div class="item-number dw-mod">{{number}}</div>683 }684685 @if (showPrice && !onlyPreview)686 {687 if (pointShopOnly)688 {689 <text>690 {{#if havePointPrice}}691 <div class="price price--product-list dw-mod">{{points}} @Translate("points")</div>692 {{else}}693 @Translate("Not available")694 {{/if}}695 </text>696 }697 else698 {699 if (!onlyPreview && showPrice)700 {701702 if (!onlyPreview)703 {704705 <text>706 {{#ifCond preventWebSale "===" false}}707 {{#unless HidePrice}}708 <div class="price price--product-list dw-mod">{{price}}</div>709 <div class="before-price {{onSale}} dw-mod">{{discount}}</div>710 {{/unless}}711 {{/ifCond}}712 </text>713714 }715716 if (showVATPrice)717 {718 <div class="vat-price vat-price--product-list u-margin-top dw-mod">719 @if (isPricesWithVATEnabled)720 {721 <span>@Translate("excl. VAT")</span><span> ({{priceWithoutVAT}})</span>722 }723 else724 {725 <span>@Translate("incl. VAT")</span><span> ({{priceWithVAT}})</span>726 }727 </div>728 }729 }730731732733 }734735 }736 <input type="hidden" value="{{unitId}}" name="Unit{{id}}" id="Unit_{{id}}" />737 <input type="hidden" value="{{variantid}}" name="VariantID{{id}}" id="Variant_{{id}}" />738 @*<input type="hidden" id="Quantity_{{id}}" name="Quantity{{id}}" value="1" min="1">*@739 </div>740741 <div class="product-list__grid-item__footer @footerClasses dw-mod">742 @if (!onlyPreview)743 {744 <text>745 {{#unless preventWebSale}}746 {{#unless HidePrice}}747 <div class="u-ta-center u-inline-block">748 <div class="buttons-collection {{hideBuyOptions}}">749 @if (pointShopOnly)750 {751 <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"752 onclick="Cart.AddToCart(event, {753 id: {{productId}}',754 variantId: '{{variantid}}',755 unitId: '{{unitId}}',756 quantity: 1,757 buyForPoints: true,758 productInfo: {{productInfo}},759 }); {{facebookPixelAction}}" {{disabledBuyButton}}>760 <i class="@cartIcon"></i><span class="u-hidden-xs u-hidden-xxs"> @Translate("Buy with points")</span>761 </button>762 }763 else764 {765 <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"766 onclick="Cart.AddToCart(event, {767 id: '{{productId}}',768 variantId: '{{variantid}}',769 unitId: '{{unitId}}',770 quantity: document.getElementById('Quantity_{{id}}').value,771 productInfo: {{productInfo}},772 }); {{facebookPixelAction}}" {{disabledBuyButton}}>773 <i class="@cartIcon"></i><span class="u-hidden-xs u-hidden-xxs"> @cartButtonText</span>774 </button>775 <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">776 }777 </div>778 </div>779 {{/unless }}780 {{/unless }}781 @if (Pageview.AreaID == 1 && Pageview.User == null)782 {783784 }785 else786 {787 <text>788 {{#if preventWebSale}}789 <p>@Translate("Please call", "Please call")</p>790 {{/if}}791 </text>792 }793794 </text>795 if (showViewButton)796 {797 //hideViewMore handlebar value in class attribute798 if (Pageview.User == null)799 {800 <text>801 {{#if HidePrice}}802 <div class="u-ta-center">803 <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>804 </div>805 {{/if }}806 </text>807 }808 }809810 }811 else if (showViewButton)812 {813 <div class="u-ta-center">814 @if (onlyPreview)815 {816 <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>817 }818819 @*<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>*@820 </div>821 }822823 @if (!onlyPreview && showStock)824 {825 <div class="u-margin-top">826 <div><span class="stock-icon {{stockState}} u-no-margin dw-mod" title="{{stockText}}"></span> {{stockText}}</div>827 <div>828 {{#if deliveryText}}829 {{deliveryText}}830 {{else}}831 -832 {{/if}}833 </div>834 </div>835 }836837 @if (showStaticVariants)838 {839 <text>840 {{#Variants}}841 {{>StaticVariantsTemplate}}842 {{/Variants}}843844 {{#ifCond variantGroupsCount '>' 1}}845 <div class="static-variant">846 @Translate("More options available")847 </div>848 {{/ifCond}}849850 {{#ifCond variantGroupsCount '==' 0}}851 <div class="static-variant"></div>852 {{/ifCond}}853 </text>854 }855856 @if (showAddToDownloadButton && Pageview.User != null)857 {858 <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}}">859 <i class="fas fa-plus js-button-icon"></i>860 <span class="js-button-text">@Translate("Add")</span>861 </button>862 }863 </div>864 {{/.}}865 </script>866 }867 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>868 @using Dynamicweb.Core869 @using System870 @using System.Web871 @using System.Collections.Generic872 @using Dynamicweb.Rapido.Blocks873874 @if (Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableDetailsView"))875 {876 BlocksPage productList = BlocksPage.GetBlockPage("ProductList");877878 Block detailsViewButton = new Block879 {880 Id = "ProductDetailsItemContainer",881 Name = "list",882 SortId = 30883 };884 productList.Add("Views", detailsViewButton);885886 Block detailsViewScripts = new Block887 {888 Id = "DetailsViewScripts",889 SortId = 30,890 Template = DetailsView()891 };892 productList.Add("BottomSnippets", detailsViewScripts);893 }894895 @helper DetailsView()896 {897 bool onlyPreview = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Pageview.User == null;898 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");899 bool showPrice = !Pageview.AreaSettings.GetItem("ProductList").GetBoolean("HidePrice");900 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fas fa-shopping-cart";901 bool showCartButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowAddToCartButton");902 bool showViewButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowViewButton");903 bool showFavoriteButton = !Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("HideFavoriteButton");904 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowAddToDownloadButton");905 bool showStock = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowStockAndShipping");906 bool showImage = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowImage");907 bool showNumber = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowProductNumber");908 bool showStaticVariants = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowStaticVariants");909 string viewMoreText = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetString("ViewMoreText")) ? Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetString("ViewMoreText") : "View";910 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));911 bool showVATPrice = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("ShowBothPricesWithWithoutVAT");912 bool isPricesWithVATEnabled = Converter.ToBoolean(Pageview.Area.EcomPricesWithVat);913914 <script id="ProductDetailsItemContainer" type="text/x-template">915 {{#.}}916 <div id="Product{{id}}" data-template="ProductDetailsItem" data-preloader="overlay" class="grid__col-12 u-no-padding-y" style="z-index: {{zIndex}}">917 {{#Product}}918 {{>ProductDetailsItem}}919 {{/Product}}920 </div>921 {{/.}}922 </script>923924 if (Pageview.Device.ToString() != "Mobile")925 {926 <script id="ProductDetailsItem" type="text/x-template">927 {{#.}}928 @if (useGoogleTagManager)929 {930 <text>{{{googleEnchantImpression 'Product catalogue' currency googleImpression}}}</text>931 }932 <input type="hidden" name="ProductLoopCounter{{id}}" value="{{id}}" />933 <input type="hidden" name="ProductID{{id}}" value="{{productId}}" />934 <div class="product-list__details-item grid__col-12 dw-mod">935 <div class="product-list__details-item__left grid__cell dw-mod">936 @if (showImage)937 {938 <div class="lightbox u-hidden-xxs">939 <a href="{{link}}" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}">940 <img class="lightbox__image {{noImage}}" src="/Admin/Public/GetImage.ashx?width=220&amp;height=220&amp;crop=5&amp;Compression=75&amp;image={{image}}" alt="{{name}}" />941 <div class="u-margin-right {{noImage}}">942 <img class="b-lazy" src="/Files/Images/placeholder.gif"943 data-src="/Admin/Public/GetImage.ashx?width=75&amp;height=55&amp;crop=5&FillCanvas=true&amp;Compression=75&amp;image={{image}}"944 alt="{{name}}" />945 </div>946 </a>947 </div>948 }949 <div class="u-margin-left u-margin-right">950 <a href="{{link}}" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}">951 <h6 class="u-no-margin">{{name}}</h6>952 </a>953 <div class="item-number item-number--compressed dw-mod">954 @if (showNumber)955 {956 <div class="item-number dw-mod">{{number}}</div>957 }958959 @if (!onlyPreview && showStock)960 {961 <text>962 {{#unless SLWebHideStock}}963 <span>964 <span class="stock-icon {{stockState}} u-no-margin dw-mod" title="{{stockText}}"></span>965 <span class="u-margin-right--lg"> {{stockText}}</span>966 {{deliveryText}}967 </span>968 {{/unless }}969 </text>970 }971 </div>972 @if (showStaticVariants)973 {974 <span>975 {{#Variants}}976 {{>StaticVariantsTemplate}}977 {{/Variants}}978 </span>979 <text>980 {{#ifCond variantGroupsCount '>' 1}}981 <div class="static-variant">982 @Translate("More options available")983 </div>984 {{/ifCond}}985 </text>986 }987 <div class="grid__cell-footer stickers-container stickers-container--row u-margin-top dw-mod">988 {{#StickersContainers}}989 {{#Stickers}}990 {{>MiniSticker}}991 {{/Stickers}}992 {{/StickersContainers}}993 </div>994 </div>995 </div>996 <div class="product-list__details-item__right grid__cell dw-mod">997 @if (!onlyPreview && showCartButton)998 {999 <div class="u-margin-right">1000 <input type="checkbox" id="UnitOptions_{{id}}" class="dropdown-trigger" />1001 <div class="dropdown u-w120px use-btn-primary-height {{hasUnits}} dw-mod">1002 <label class="dropdown__header dropdown__btn dw-mod" for="UnitOptions_{{id}}">{{unitName}}</label>1003 <div id="unitOptions" class="dropdown__content dw-mod">1004 {{#unitOptions}}1005 {{>UnitOption}}1006 {{/unitOptions}}1007 </div>1008 <label class="dropdown-trigger-off" for="UnitOptions_{{id}}"></label>1009 </div>1010 <input type="hidden" value="{{unitId}}" name="Unit{{id}}" id="Unit_{{id}}" />1011 <input type="hidden" value="{{variantid}}" name="VariantID{{id}}" id="Variant_{{id}}" />1012 </div>1013 }10141015 <div class="u-min-w140px product-list__details-item-price-block">1016 <div class="u-ta-right u-padding-right">1017 @if (pointShopOnly)1018 {1019 <text>1020 {{#if havePointPrice}}1021 <div class="price price--product-list price--micro dw-mod">{{points}} @Translate("points")</div>1022 {{else}}1023 @Translate("Not available")1024 {{/if}}1025 </text>1026 }1027 else1028 {10291030 if (!onlyPreview)1031 {1032 <text>1033 {{#ifCond preventWebSale "===" false}}1034 {{#unless HidePrice}}1035 <div class="price price--product-list dw-mod">{{price}}</div>1036 <div class="before-price {{onSale}} dw-mod">{{discount}}</div>1037 {{/unless}}1038 {{/ifCond}}1039 </text>1040 }104110421043 if (showVATPrice)1044 {1045 <small class="vat-price vat-price--micro dw-mod">1046 @if (isPricesWithVATEnabled)1047 {1048 @Translate("excl. VAT") <text>({{priceWithoutVAT}})</text>1049 }1050 else1051 {1052 @Translate("incl. VAT") <text>({{priceWithVAT}})</text>1053 }1054 </small>1055 }1056 }1057 </div>1058 </div>10591060 @if (!onlyPreview && showCartButton)1061 {1062 if (!pointShopOnly)1063 {1064 <text>1065 {{#unless preventWebSale}}1066 {{#unless HidePrice}}1067 <div class="{{hideBuyOptions}}">1068 <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">1069 </div>1070 {{/unless }}1071 {{/unless }}1072 </text>1073 }1074 <text>1075 {{#unless preventWebSale}}1076 {{#unless HidePrice}}1077 <div class="{{hideBuyOptions}}">1078 @if (pointShopOnly)1079 {1080 <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"1081 onclick="Cart.AddToCart(event, {1082 id: '{{productId}}',1083 variantId: '{{variantId}}',1084 unitId: '{{UnitId}}',1085 quantity: 1,1086 buyForPoints: true,1087 productInfo: {{productInfo}},1088 }); {{facebookPixelAction}}" {{disabledBuyButton}}>1089 <i class="@cartIcon"></i><span> @Translate("Buy with points")</span>1090 </button>1091 }1092 else1093 {1094 <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"1095 onclick="Cart.AddToCart(event, {1096 id: '{{productId}}',1097 variantId: '{{variantid}}',1098 unitId: '{{unitId}}',1099 quantity: document.getElementById('Quantity_{{id}}').value,1100 productInfo: {{productInfo}},1101 }); {{facebookPixelAction}}" {{disabledBuyButton}}>1102 <i class="@cartIcon"></i>1103 </button>1104 }1105 </div>1106 {{/unless }}1107 {{/unless }}1108 @if (Pageview.AreaID == 1 && Pageview.User == null)1109 {11101111 }1112 else1113 {1114 <text>1115 {{#if preventWebSale}}1116 <p>@Translate("Please call", "Please call")</p>1117 {{/if}}1118 </text>1119 }1120 </text>11211122 if (showViewButton)1123 {1124 //#unless hideViewMore1125 if (Pageview.User == null)1126 {1127 <text>1128 {{#if HidePrice}}1129 <div>1130 <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>1131 </div>1132 {{/if }}1133 </text>1134 }1135 }1136 }1137 else if (showViewButton)1138 {1139 <div>1140 @*<a href="{{link}}" class="btn btn--secondary u-no-margin dw-mod" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="@Translate(viewMoreText)">@Translate(viewMoreText)</a>*@1141 <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>11421143 </div>1144 }1145 @if (showFavoriteButton && Pageview.User != null)1146 {1147 <div class="favorites u-margin {{hasVariants}} dw-mod" {{hasVariants}}>1148 {{#Favorite}}1149 {{>FavoriteTemplate}}1150 {{/Favorite}}1151 </div>1152 <div class="favorites favorites--lg u-hidden {{hasVariants}} dw-mod" {{hasVariants}}>1153 {{#Favorite}}1154 {{>FavoriteListItem}}1155 {{/Favorite}}1156 </div>1157 }1158 @if (showAddToDownloadButton && Pageview.User != null)1159 {1160 <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}}">1161 <i class="fas fa-plus js-button-icon"></i>1162 </button>1163 }1164 </div>1165 </div>1166 {{/.}}1167 </script>1168 }1169 else1170 {1171 <script id="ProductDetailsItem" type="text/x-template">1172 {{#.}}1173 @if (useGoogleTagManager)1174 {1175 <text>{{{googleEnchantImpression 'Product catalogue' currency googleImpression}}}</text>1176 }1177 <input type="hidden" name="ProductLoopCounter{{id}}" value="{{id}}" />1178 <input type="hidden" name="ProductID{{id}}" value="{{productId}}" />1179 <div class="grid__col-12 dw-mod">1180 <div class="grid__cell u-color-light--bg dw-mod">1181 <div class="u-margin">1182 <a href="{{link}}" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}">1183 <h6 class="u-no-margin">{{name}}</h6>1184 </a>1185 <div class="item-number item-number--compressed dw-mod">1186 @if (showNumber)1187 {1188 <div class="item-number dw-mod">{{number}}</div>1189 }11901191 @if (!onlyPreview && showStock)1192 {1193 <span>1194 <span class="stock-icon {{stockState}} u-no-margin dw-mod" title="{{stockText}}"></span>1195 <span> {{stockText}}</span>1196 {{deliveryText}}1197 </span>1198 }1199 </div>1200 @if (showStaticVariants)1201 {1202 <span>1203 {{#Variants}}1204 {{>StaticVariantsTemplate}}1205 {{/Variants}}1206 </span>1207 <text>1208 {{#ifCond variantGroupsCount '>' 1}}1209 <div class="static-variant">1210 @Translate("More options available")1211 </div>1212 {{/ifCond}}1213 </text>1214 }1215 <div class="grid__cell-footer stickers-container stickers-container--row u-margin-top dw-mod">1216 {{#StickersContainers}}1217 {{#Stickers}}1218 {{>MiniSticker}}1219 {{/Stickers}}1220 {{/StickersContainers}}1221 </div>1222 </div>1223 <div class="u-ta-right u-margin-bottom product-list__details-item-price-block dw-mod">1224 @if (pointShopOnly)1225 {1226 <text>1227 {{#if havePointPrice}}1228 <div class="price price--product-list price--micro dw-mod">{{points}} @Translate("points")</div>1229 {{else}}1230 @Translate("Not available")1231 {{/if}}1232 </text>1233 }1234 else1235 {1236 <div class="before-price {{onSale}} before-price--micro dw-mod">{{discount}}</div>1237 <div class="price price--product-list price--micro dw-mod">{{price}}</div>123812391240 }1241 </div>1242 </div>1243 <div class="grid__cell u-color-light--bg dw-mod">1244 <div class="collection u-pull--right u-no-margin u-margin dw-mod">1245 @if (!onlyPreview && showCartButton)1246 {1247 <div>1248 <input type="checkbox" id="UnitOptions_{{id}}" class="dropdown-trigger" />1249 <div class="dropdown u-w120px use-btn-primary-height {{hasUnits}} dw-mod">1250 <label class="dropdown__header dropdown__btn dw-mod" for="UnitOptions_{{id}}">{{unitName}}</label>1251 <div id="unitOptions" class="dropdown__content dw-mod">1252 {{#unitOptions}}1253 {{>UnitOption}}1254 {{/unitOptions}}1255 </div>1256 <label class="dropdown-trigger-off" for="UnitOptions_{{id}}"></label>1257 </div>1258 <input type="hidden" value="{{unitId}}" name="Unit{{id}}" id="Unit_{{id}}" />1259 <input type="hidden" value="{{variantid}}" name="VariantID{{id}}" id="Variant_{{id}}" />1260 </div>1261 }12621263 @if (!onlyPreview && showCartButton)1264 {1265 if (!pointShopOnly)1266 {1267 <div class="{{hideBuyOptions}}">1268 <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">1269 </div>1270 }1271 <div class="{{hideBuyOptions}}">1272 @if (pointShopOnly)1273 {1274 <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"1275 onclick="Cart.AddToCart(event, {1276 id: '{{productId}}',1277 variantId: '{{variantId}}',1278 unitId: '{{UnitId}}',1279 quantity: 1,1280 buyForPoints: true,1281 productInfo: {{productInfo}},1282 }); {{facebookPixelAction}}" {{disabledBuyButton}}>1283 <i class="@cartIcon"></i><span> @Translate("Buy with points")</span>1284 </button>1285 }1286 else1287 {1288 <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"1289 onclick="Cart.AddToCart(event, {1290 id: '{{productId}}',1291 variantId: '{{variantid}}',1292 unitId: '{{unitId}}',1293 quantity: document.getElementById('Quantity_{{id}}').value,1294 productInfo: {{productInfo}},1295 }); {{facebookPixelAction}}" {{disabledBuyButton}}>1296 <i class="@cartIcon"></i>1297 </button>1298 }1299 </div>1300 if (showViewButton)1301 {1302 <text>1303 {{#unless hideViewMore}}1304 <div>1305 <a href="{{link}}" class="btn btn--secondary u-no-margin dw-mod" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="@Translate("View")">@Translate("View")</a>1306 </div>1307 {{/unless}}1308 </text>1309 }1310 }1311 else if (showViewButton)1312 {1313 <div>1314 <a href="{{link}}" class="btn btn--secondary u-no-margin dw-mod" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="@Translate("View")">@Translate("View")</a>1315 </div>1316 }1317 @if (showFavoriteButton && Pageview.User != null)1318 {1319 <div class="favorites u-margin {{hasVariants}} dw-mod" {{hasVariants}}>1320 {{#Favorite}}1321 {{>FavoriteTemplate}}1322 {{/Favorite}}1323 </div>1324 <div class="favorites favorites--lg u-hidden {{hasVariants}} dw-mod" {{hasVariants}}>1325 {{#Favorite}}1326 {{>FavoriteListItem}}1327 {{/Favorite}}1328 </div>1329 }1330 </div>1331 </div>1332 </div>1333 {{/.}}1334 </script>1335 }1336 }1337 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>1338 @using Dynamicweb.Core1339 @using System1340 @using System.Web1341 @using System.Collections.Generic1342 @using Dynamicweb.Rapido.Blocks13431344 @{1345 BlocksPage productListPromotionsBlocksPage = BlocksPage.GetBlockPage("ProductList");13461347 Block productListPromotions = new Block1348 {1349 Id = "Promotions",1350 SortId = 10,1351 Template = RenderProductListPromotions()1352 };1353 productListPromotionsBlocksPage.Add("PageContainer", productListPromotions);1354 }13551356 @helper RenderProductListPromotions()1357 {1358 @*This is part of a script template *@13591360 string listId = HttpContext.Current.Request.QueryString.Get("ListID");1361 bool isFavoriteList = !string.IsNullOrEmpty(listId);1362 string smallDeviceCss = Pageview.Device.ToString() == "Mobile" ? "u-no-padding" : "";1363 string groupName = GetString("Ecom:Group.Name");1364 string groupDescription = GetString("Ecom:Group.Description");1365 string groupPromotionImage = GetString("Ecom:Group:Field.ctaImage.Clean");13661367 if (!isFavoriteList)1368 {1369 switch (Pageview.AreaSettings.GetItem("ProductList").GetList("PromotionBlockDesign").SelectedValue)1370 {1371 case "OnlyText":13721373 <article class="grid__col-12 u-margin-bottom @smallDeviceCss">13741375 <h1>{{groupName}}</h1>1376 {{{groupDescription}}}1377 </article>13781379 break;1380 case "TextAndImage":138113821383 <article class="grid__col-12 u-margin-bottom @smallDeviceCss">1384 <div class="grid grid--bleed">1385 <div class="grid__col-md-6">1386 <h1>{{groupName}}</h1>1387 {{{groupDescription}}}1388 </div>1389 {{#ifCond groupPromotionImage "!==" ""}}1390 <div class="grid__col-md-6">1391 <img src="/Admin/Public/GetImage.ashx?width=600&crop=5&Compression=75&DoNotUpscale=true&image={{groupPromotionImage}}" alt="{{groupName}}" class="background-image__cover" />1392 </div>1393 {{/ifCond}}1394 </div>1395 </article>139613971398 break;1399 case "Banner":1400 <text>1401 {{#ifCond groupPromotionImage "!==" ""}}1402 <article class="grid__col-12 u-margin-bottom @smallDeviceCss">1403 <div class="u-color-light grid center-container center-container--with-background-image grid__col--bg" style="background-image:url('{{groupPromotionImage}}'); background-size: cover;">1404 <div class="grid__col-12 u-middle">1405 <div class="grid__cell">1406 {{{groupDescription}}}1407 </div>1408 </div>1409 </div>1410 </article>1411 {{/ifCond}}1412 </text>1413 break;1414 }1415 }1416 }141714181419 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>1420 @using Dynamicweb.Core1421 @using System1422 @using System.Web1423 @using System.Collections.Generic1424 @using Dynamicweb.Rapido.Blocks14251426 @{1427 BlocksPage productListMenuBlocksPage = BlocksPage.GetBlockPage("ProductList");14281429 if (Pageview.Page.PropertyItem["LeftMenu"] != null && Converter.ToString(Pageview.Page.PropertyItem["LeftMenu"]) == "True" && Pageview.Page.NavigationSettings != null && Pageview.Page.NavigationSettings.UseEcomGroups) {1430 Block productListMenuBlock = new Block1431 {1432 Id = "Menu",1433 SortId = 20,1434 Template = RenderProductListMenu()1435 };14361437 productListMenuBlocksPage.Add("Navigation", productListMenuBlock);1438 }1439 }14401441 @helper RenderProductListMenu()1442 {1443 var navigationMarkup = RenderNavigation(new1444 {1445 id = "leftnav",1446 cssclass = "dwnavigation",1447 startLevel = 1,1448 endlevel = 5,1449 template = "LeftNavigation.xslt",1450 mode = "ecom"1451 });14521453 <h2 class="u-margin-bottom">@Translate("Product categories")</h2>14541455 <div class="u-padding-bottom--lg">1456 @navigationMarkup1457 </div>1458 }1459 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>1460 @using Dynamicweb.Core1461 @using System1462 @using System.Web1463 @using System.Collections.Generic1464 @using Dynamicweb.Rapido.Blocks14651466 @{1467 BlocksPage productListFacetsBlocksPage = BlocksPage.GetBlockPage("ProductList");14681469 string facetsBlockViewMode = !String.IsNullOrEmpty(Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode")) ? Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode").ToLower() : "left";14701471 if (facetsBlockViewMode == "left" && Pageview.Device.ToString() != "Mobile")1472 {1473 Block facetsBlock = new Block1474 {1475 Id = "Facets",1476 SortId = 30,1477 Template = RenderProductListFacets()1478 };1479 productListFacetsBlocksPage.Add("Navigation", facetsBlock);1480 }14811482 if (facetsBlockViewMode == "top" || Pageview.Device.ToString() == "Mobile")1483 {1484 Block facetsBlock = new Block1485 {1486 Id = "Facets",1487 SortId = 10,1488 Template = RenderProductListTopFacets()1489 };1490 productListFacetsBlocksPage.Add("ProductList", facetsBlock);1491 }149214931494 Block facetSelections = new Block1495 {1496 Id = "FacetSelections",1497 SortId = 20,1498 Template = RenderFacetSelections()1499 };1500 productListFacetsBlocksPage.Add("ProductList", facetSelections);1501 }15021503 @helper RenderFacetSelections()1504 {1505 @*This is part of a script template *@1506 <div class="grid">1507 <div class="grid__col-12 grid__col--bleed">1508 <div class="collection u-no-margin" id="selectedFacets">1509 {{#FacetSelections}}1510 {{> (lookup . 'template') }}1511 {{/FacetSelections}}1512 </div>1513 </div>1514 </div>1515 }15161517 @helper RenderProductListFacets()1518 {1519 @*This is part of a script template *@1520 <div class="u-margin-bottom--lg">1521 <h2 class="u-no-margin">@Translate("Filters")</h2>1522 </div>15231524 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" />1525 <div class="facets-container facets-container--left expandable--collapsed dw-mod" data-trigger="CheckFacetGroups">1526 {{#FacetGroups}}1527 <input type="checkbox" id="OptionsGroup_{{name}}" class="expand-trigger js-remember-state" {{defaultState}} />15281529 <div class="expand-container facets-container__box dw-mod js-filter">1530 <label class="expand-container__btn facets-container__header dw-mod" for="OptionsGroup_{{name}}">{{name}}</label>1531 <div class="expand-container__content dw-mod">1532 <div class="u-margin {{showFilter}}">1533 <input type="text" class="u-full-width u-no-margin" onkeyup="Filter.FilterItems(event)" placeholder="@Translate("Search")" />1534 </div>1535 <div class="facets-container__list dw-mod">1536 {{#FacetOptions}}1537 {{#ifCond template "===" "Checkboxes"}}1538 {{>Checkboxes}}1539 {{/ifCond}}1540 {{#ifCond template "===" "Range"}}1541 {{>Checkboxes}}1542 {{/ifCond}}1543 {{#ifCond template "===" "Weight"}}1544 {{>Checkboxes}}1545 {{/ifCond}}1546 {{#ifCond template "===" "Tags"}}1547 {{>Tags}}1548 {{/ifCond}}1549 {{#ifCond template "===" "Colors"}}1550 {{>Colors}}1551 {{/ifCond}}1552 {{/FacetOptions}}1553 </div>1554 </div>1555 </div>1556 {{/FacetGroups}}1557 </div>1558 <label for="CheckFacetGroups" class="btn btn--primary btn--full dw-mod js-expand-hide facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Select filters")</label>1559 <label for="CheckFacetGroups" class="btn btn--primary btn--full dw-mod expandable--collapsed facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Close filters")</label>1560 }15611562 @helper RenderProductListTopFacets()1563 {1564 @*This is part of a script template *@1565 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" />1566 <div class="grid grid--external-bleed-x dw-mod expandable--collapsed facets-container facets-container--top" data-trigger="CheckFacetGroups">1567 {{#FacetGroups}}1568 <div class="grid__col-lg-3 grid__col-md-3 grid__col-sm-4 grid__col-xs-12">1569 <input type="checkbox" id="OptionsGroup_{{counter}}" class="dropdown-trigger" />1570 <div class="dropdown dw-mod js-filter">1571 <label class="dropdown__header dropdown__btn dw-mod" for="OptionsGroup_{{counter}}">{{name}}</label>1572 <div class="dropdown__content dropdown__content--padding dw-mod">1573 <div class="u-margin-bottom {{showFilter}}">1574 <input type="text" class="u-full-width u-no-margin" onkeyup="Filter.FilterItems(event)" placeholder="@Translate("Search")" />1575 </div>1576 {{#FacetOptions}}1577 {{#ifCond template "===" "Checkboxes"}}1578 {{>Checkboxes}}1579 {{/ifCond}}1580 {{#ifCond template "===" "Range"}}1581 {{>Checkboxes}}1582 {{/ifCond}}1583 {{#ifCond template "===" "Weight"}}1584 {{>Checkboxes}}1585 {{/ifCond}}1586 {{#ifCond template "===" "Tags"}}1587 {{>Tags}}1588 {{/ifCond}}1589 {{#ifCond template "===" "Colors"}}1590 {{>Colors}}1591 {{/ifCond}}1592 {{/FacetOptions}}1593 </div>1594 <label class="dropdown-trigger-off" for="OptionsGroup_{{counter}}"></label>1595 </div>1596 </div>1597 {{/FacetGroups}}1598 </div>1599 <label for="CheckFacetGroups" class="btn btn--primary btn--full dw-mod js-expand-hide facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Select filters")</label>1600 <label for="CheckFacetGroups" class="btn btn--primary btn--full dw-mod expandable--collapsed facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Close filters")</label>1601 }16021603 @*Facets*@1604 <script id="Checkboxes" type="text/x-template">1605 <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}}>1606 <label class="{{disabled}} checkbox-facet dw-mod" data-filter-value="{{label}}" for="{{queryParameter}}{{value}}">1607 <span class="checkbox-facet__label dw-mod">{{label}}</span>1608 <span class="checkbox-facet__count dw-mod">({{count}})</span>1609 </label>1610 </script>16111612 <script id="Tags" type="text/x-template">1613 <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}}>1614 {{label}} <span class="facets-group__counter">({{count}})</span>1615 </button>1616 </script>16171618 <script id="Colors" type="text/x-template">1619 <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>1620 </script>16211622 @*Facet selections*@1623 <script id="SelectedFilter" type="text/x-template">1624 <button type="button" class="btn btn--tag" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" title="@Translate("Remove filter")">1625 {{group}}: {{label}} <i class="fas fa-times"></i>1626 </button>1627 </script>16281629 <script id="SelectedColorFilter" type="text/x-template">1630 <button type="button" class="btn btn--tag" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" title="@Translate("Remove filter")">1631 {{group}}: <div class="btn__colorbox" style="background-color: {{label}}"></div> <i class="fas fa-times"></i>1632 </button>1633 </script>16341635 <script id="ResetFilters" type="text/x-template">1636 <button type="button" class="btn btn--tag" onclick="Facets.ResetFacets();">1637 @Translate("Reset all filters") <i class="fas fa-redo"></i>1638 </button>1639 </script>1640 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>1641 @using Dynamicweb.Core1642 @using System1643 @using System.Web1644 @using System.Collections.Generic1645 @using Dynamicweb.Rapido.Blocks16461647 @{1648 BlocksPage productListMoreBlocksPage = BlocksPage.GetBlockPage("ProductList");16491650 Block moreBlock = new Block1651 {1652 Id = "More",1653 SortId = 40,1654 Template = RenderListMore()1655 };16561657 productListMoreBlocksPage.Add("ProductList", moreBlock);1658 }16591660 @helper RenderListMore()1661 {1662 @*This is part of a script template *@1663 string groupID = HttpContext.Current.Request.QueryString.Get("groupid");1664 string listId = HttpContext.Current.Request.QueryString.Get("ListID");1665 bool isFavoriteList = !string.IsNullOrEmpty(listId);1666 string moreFeedFullUrl = GetGlobalValue("Global:Pageview.Url.Raw") + "&feed=true";1667 moreFeedFullUrl += !isFavoriteList ? "&DoNotShowVariantsAsSingleProducts=True" : "";1668 string columnCss = Pageview.Device.ToString() == "Mobile" ? "grid__col--bleed" : "grid__col--bleed-y";16691670 <div class="grid">1671 <div class="grid__col-12 @columnCss">1672 <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>1673 <button type="button" class="btn btn--clean" onclick="window.scroll(0, 0)">@Translate("Return to top")</button>1674 </div>1675 </div>1676 }1677 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>1678 @using Dynamicweb.Core1679 @using System1680 @using System.Web1681 @using System.Collections.Generic1682 @using Dynamicweb.Rapido.Blocks16831684 @{1685 BlocksPage productListBottomSnippetsPage = BlocksPage.GetBlockPage("ProductList");16861687 Block productListStickers = new Block1688 {1689 Id = "Stickers",1690 SortId = 10,1691 Template = RenderStickersTemplates()1692 };1693 productListBottomSnippetsPage.Add("BottomSnippets", productListStickers);16941695 Block productListUnits = new Block1696 {1697 Id = "Units",1698 SortId = 20,1699 Template = RenderUnitTemplates()1700 };1701 productListBottomSnippetsPage.Add("BottomSnippets", productListUnits);17021703 Block productListVariants = new Block1704 {1705 Id = "Variants",1706 SortId = 30,1707 Template = RenderVariantTemplates()1708 };1709 productListBottomSnippetsPage.Add("BottomSnippets", productListVariants);17101711 Block productListFavorites = new Block1712 {1713 Id = "Favorites",1714 SortId = 40,1715 Template = RenderFavoritesTemplates()1716 };1717 productListBottomSnippetsPage.Add("BottomSnippets", productListFavorites);17181719 Block productListPreRender = new Block1720 {1721 Id = "PreRenders",1722 SortId = 50,1723 Template = RenderPreRenderTemplates()1724 };1725 productListBottomSnippetsPage.Add("BottomSnippets", productListPreRender);17261727 Block productListInitializers = new Block1728 {1729 Id = "Initializers",1730 SortId = 60,1731 Template = RenderInitializers()1732 };1733 productListBottomSnippetsPage.Add("BottomSnippets", productListInitializers);1734 }17351736 @helper RenderStickersTemplates() {1737 <script id="StickersContainer" type="text/x-template">1738 <div class="stickers-container stickers-container--{{position}} dw-mod">1739 {{#Stickers}}1740 {{>Sticker}}1741 {{/Stickers}}1742 </div>1743 </script>17441745 <script id="Sticker" type="text/x-template">1746 <div class="stickers-container__tag {{className}} dw-mod">{{text}}</div>1747 </script>17481749 <script id="MiniSticker" type="text/x-template">1750 <div class="stickers-container__tag stickers-container__tag--micro {{className}} dw-mod">{{text}}</div>1751 </script>1752 }17531754 @helper RenderUnitTemplates() {1755 <script id="UnitOption" type="text/x-template">1756 <div class="dropdown__item dw-mod" onclick="HandlebarsBolt.UpdateContent('Product{{id}}', '{{link}}&feed=true&UnitID={{value}}&rid={{id}}')">{{name}}</div>1757 </script>1758 }17591760 @helper RenderVariantTemplates() {1761 <script id="VariantsTemplate" type="text/x-template">1762 {{#.}}1763 <div>1764 <div class="u-bold">{{name}}</div>1765 <div>1766 {{#VariantOptions}}1767 {{>VariantOption}}1768 {{/VariantOptions}}1769 </div>1770 </div>1771 {{/.}}1772 </script>17731774 <script id="VariantOption" type="text/x-template">1775 {{#if color}}1776 <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>1777 {{else}}1778 {{#if image}}1779 <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}}" />1780 {{else}}1781 <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>1782 {{/if}}1783 {{/if}}1784 </script>17851786 <script id="StaticVariantsTemplate" type="text/x-template">1787 {{#.}}1788 {{#if isFirstGroup}}1789 <div>1790 {{#VariantOptions}}1791 {{>StaticVariantOption}}1792 {{/VariantOptions}}1793 </div>1794 {{/if}}1795 {{/.}}1796 </script>17971798 <script id="StaticVariantOption" type="text/x-template">1799 {{#if color}}1800 <div class="static-variant static-variant--color dw-mod" style="background-color: {{color}}" title="{{name}}"></div>1801 {{else}}1802 <div class="static-variant dw-mod">{{name}} </div>1803 {{/if}}1804 </script>18051806 <script id="VariantOptionImage" type="text/x-template">1807 <img data-variant-id="{{variantId}}" data-friends="{{friendsList}}" data-variant-group="{{groupId}}" onclick="MatchVariants.SelectThis(event)" src="/Admin/Public/GetImage.ashx?width=100&amp;height=50&amp;crop=5&amp;Compression=75&amp;image=/Images/{{image}}" alt="{{name}}" title="{{name}}" class="btn btn--tag {{disabled}} {{selected}} js-variant-option" data-check="{{selected}}" {{disabled}} />1808 </script>1809 }18101811 @helper RenderFavoritesTemplates() {1812 <script id="FavoriteTemplate" type="text/x-template">1813 <div class="favorites-list u-ta-left">1814 <label for="FavoriteTrigger_{{id}}" class="u-no-margin js-favorite-btn"><i class="{{favoriteIcon}} fa-1_5x"></i></label>1815 <input type="checkbox" id="FavoriteTrigger_{{id}}" class="dropdown-trigger" />1816 <div class="dropdown dropdown--absolute-position">1817 <div class="dropdown__content dropdown__content--show-left dropdown__content--padding u-w220px dw-mod">1818 <ul class="list list--clean dw-mod">1819 {{#FavoriteLists}}1820 {{>FavoriteListItem}}1821 {{/FavoriteLists}}1822 </ul>1823 </div>1824 <label class="dropdown-trigger-off" for="FavoriteTrigger_{{id}}"></label>1825 </div>1826 </div>1827 </script>18281829 <script id="FavoriteListItem" type="text/x-template">1830 <li>1831 <a href="{{link}}" class="list__link u-no-underline dw-mod" onclick="Scroll.SavePosition(event); {{facebookPixelAction}}"><i class="{{favoriteIcon}}"></i> {{name}}</a>1832 </li>1833 </script>1834 }18351836 @helper RenderPreRenderTemplates() {1837 string facetsViewMode = !String.IsNullOrEmpty(Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode")) ? Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode").ToLower() : "left";18381839 <script id="ProductPreRenderContainer" type="text/x-template">1840 @if (facetsViewMode == "left" && Pageview.Device.ToString() != "Mobile")1841 {1842 <div class="grid__col-3">1843 <div class="pre-render-element pre-render-element--xs"></div>1844 <div class="pre-render-element pre-render-element--md"></div>1845 <div class="pre-render-element pre-render-element--md"></div>1846 <div class="pre-render-element pre-render-element--md"></div>1847 </div>1848 }1849 <div class="grid__col-auto">1850 <div class="pre-render-element pre-render-element--xs"></div>1851 <div class="pre-render-element pre-render-element--lg"></div>1852 <div class="pre-render-element pre-render-element--lg"></div>1853 <div class="pre-render-element pre-render-element--lg"></div>1854 <div class="pre-render-element pre-render-element--lg"></div>1855 </div>1856 </script>1857 }18581859 @helper RenderInitializers() {1860 <script>1861 document.addEventListener("DOMContentLoaded", function (event) {1862 document.getElementById("productList").addEventListener('contentLoaded', function (e) {1863 if (getTarget(e).id === "productList") {1864 Search.Init();1865 Facets.Init("selectedFacets", "productList");1866 }1867 }, false);1868 });1869 </script>1870 }18711872 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>1873 @using Dynamicweb.Core1874 @using System1875 @using System.Web1876 @using System.Linq1877 @using System.Collections.Generic1878 @using Dynamicweb.Rapido.Blocks18791880 @functions {1881 BlocksPage productListActionsBlocksPage = BlocksPage.GetBlockPage("ProductList");1882 }18831884 @{1885 productListActionsBlocksPage.Add("ProductList", new Block1886 {1887 Id = "Actions",1888 SortId = 10,1889 Template = RenderListActions()1890 });18911892 productListActionsBlocksPage.Add("BottomSnippets", new Block() {1893 Id = "ListViewSelectListener",1894 Template = RenderListViewSelectListener()1895 });1896 }18971898 @helper RenderListActions()1899 {1900 @*This is part of a script template *@19011902 bool showSorting = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableSorting");1903 bool onlyPreview = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Pageview.User == null;1904 string listId = HttpContext.Current.Request.QueryString.Get("ListID");1905 bool isFavoriteList = !string.IsNullOrEmpty(listId);1906 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fas fa-shopping-cart";19071908 List<Block> subBlocks = this.productListActionsBlocksPage.GetBlockListById("Views").OrderBy(item => item.SortId).ToList();19091910 <div class="grid u-margin-bottom--lg">1911 @if (!isFavoriteList)1912 {1913 <div class="grid__col--bleed-y grid__col-md-auto u-no-padding-x">1914 <h2 class="u-no-margin"><i class="{{headerIcon}}"></i>{{header}}</h2>1915 </div>1916 }1917 <div class="grid--align-end grid__col--bleed-y grid__col-md-auto u-no-padding-x grid--align-self-center">1918 <div class="collection u-no-margin">1919 @if (showSorting)1920 {1921 if (Pageview.Device.ToString() != "Mobile")1922 {1923 <h5 class="u-inline-block u-margin-right">@Translate("Sort by")</h5>1924 }1925 else1926 {1927 <h5 class="u-inline-block u-margin-right">@Translate("Sort")</h5>1928 }1929 <input type="checkbox" id="ProductSort" class="dropdown-trigger" />1930 <div class="dropdown u-w150px u-w120px--xs u-margin-right u-inline-block dw-mod">1931 <label class="dropdown__header dropdown__btn dropdown__btn--small dw-mod" for="ProductSort">{{selectedSort}}</label>1932 <div class="dropdown__content dw-mod">1933 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: '', SortOrder: '' }, true);">@Translate("Default")</div>1934 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Created', SortOrder: 'DESC'}, true);">@Translate("Newest")</div>1935 @if (!onlyPreview)1936 {1937 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Price', SortOrder: 'ASC' }, true);">@Translate("Price low - high")</div>1938 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Price', SortOrder: 'DESC' }, true);">@Translate("Price high - low")</div>1939 }1940 </div>1941 <label class="dropdown-trigger-off" for="ProductSort"></label>1942 </div>1943 }19441945 @if (subBlocks.Count > 1)1946 {1947 foreach (Block item in subBlocks)1948 {1949 <input type="radio" class="tag-btn-trigger" id="ListViewBtn_@item.Id" name="ViewBtnGroup">1950 <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>1951 }1952 }19531954 @if (isFavoriteList)1955 {1956 if (Pageview.Device.ToString() != "Mobile")1957 {1958 <button type="submit" class="btn btn--primary btn--sm dw-mod u-no-margin">@Translate("Buy all") <i class="@cartIcon"></i></button>1959 }1960 else1961 {1962 <button type="submit" class="btn btn--primary btn--full btn--sm u-margin-top dw-mod">@Translate("Buy all") <i class="@cartIcon"></i></button>1963 }1964 }1965 </div>1966 </div>1967 </div>1968 }19691970 @helper RenderListViewSelectListener()1971 {1972 /* the same block code placed in ProductListFeed.cshtml */1973 Dictionary<string, bool> views = new Dictionary<string, bool>()1974 {1975 { "ProductItemContainer", Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableListView") },1976 { "ProductGridItemContainer", Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableGridView") },1977 { "ProductDetailsItemContainer", Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableDetailsView") }1978 };19791980 string defaultView = Pageview.AreaSettings.GetItem("ProductList").GetList("DefaultListView") != null ? Pageview.AreaSettings.GetItem("ProductList").GetList("DefaultListView").SelectedValue : "";19811982 if (!string.IsNullOrEmpty(defaultView) && views[defaultView])1983 {1984 defaultView = defaultView;1985 }1986 else1987 {1988 defaultView = views.FirstOrDefault(x => x.Value).Key ?? "ProductItemContainer";1989 }19901991 <script>1992 let defaultTemplate = '@defaultView';1993 let container = 'productList';1994 let cookieName = 'ProductsContainerTemplate';19951996 document.addEventListener('DOMContentLoaded', function (event) {1997 document.getElementById(container).addEventListener('contentLoaded', function () {1998 let selectedMode = RememberState.GetCookie(cookieName);1999 let element = document.getElementById('ListViewBtn_' + (selectedMode != null ? selectedMode : defaultTemplate));2000 if (element != null) {2001 element.checked = true;2002 }2003 }, false);2004 });2005 </script>2006 }2007 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/eCom/ProductList/Blocks/Custom__Blocks.cshtml")))2008 {2009 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>2010 @using Dynamicweb.Core2011 @using System2012 @using System.Web2013 @using System.Collections.Generic2014 @using Dynamicweb.Rapido.Blocks20152016 @{2017 BlocksPage customBlocksPage = BlocksPage.GetBlockPage("ProductList");20182019 }</text>2020 }20212022 @if (productListNavigation.BlocksList.Count < 1) {2023 productListNavigation.Design.RenderType = RenderType.Hide;2024 }20252026 <form name="multiForm" id="multiForm" method="post">2027 <input type="hidden" name="CartCmd" id="CartCmd" value="addMulti" />2028 <input type="hidden" name="OrderContext" id="OrderContext" value="ORDERCONTEXT4" />2029 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@2030 @RenderBlockList(productListPage.BlocksRoot.BlocksList)2031 </form>20322033 @helper RenderPageContainer() {2034 string groupid = HttpContext.Current.Request.QueryString["groupid"] == null ? string.Empty : HttpContext.Current.Request.QueryString["groupid"].ToString();2035 string Search = HttpContext.Current.Request.QueryString["Search"] == null ? string.Empty : HttpContext.Current.Request.QueryString["Search"].ToString();2036 List<Block> subBlocks = this.productListPage.GetBlockListById("PageContainer").OrderBy(item => item.SortId).ToList();20372038 string pageUrl = GetGlobalValue("Global:Pageview.Url.Raw");2039 string listId = HttpContext.Current.Request.QueryString.Get("ListID");2040 bool isFavoriteList = !string.IsNullOrEmpty(listId);2041 string feedFullUrl = pageUrl + "&feed=true";2042 feedFullUrl += !isFavoriteList ? "&DoNotShowVariantsAsSingleProducts=True" : "";2043 string smallDeviceCss = Pageview.Device.ToString() == "Mobile" ? "" : "u-padding";20442045 <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>20462047 <script id="ProductContainer" type="text/x-template">2048 {{#each .}}2049 @RenderBlockList(subBlocks)2050 {{else}}2051 @if (!string.IsNullOrEmpty(groupid))2052 {2053 <div class="grid__col-lg-3 grid__col-md-3 grid__col-sm-12 grid__col-xs-12 dw-mod">2054 <h2 class="u-margin-bottom">@Translate("Product categories")</h2>20552056 <div class="u-padding-bottom--lg">20572058 @RenderNavigation(new2059 {2060 id = "leftnav",2061 cssclass = "dwnavigation",2062 startLevel = 1,2063 endlevel = 4,2064 template = "LeftNavigationEcom.xslt",2065 expandmode = "path"2066 })2067 </div>2068 </div>206920702071 var groupService = new Dynamicweb.Ecommerce.Products.GroupService();2072 Dynamicweb.Ecommerce.Products.Group group = null;2073 if (!string.IsNullOrEmpty(groupid))2074 {2075 group = groupService.GetGroup(groupid);2076 }207720782079 <div class="grid__col-auto ">2080 <div class="grid__cell">2081 <h2 class="u-margin-bottom">@group.Name</h2>2082 <div class="grid product-list grid--external-bleed-x dw-mod">20832084 @if (group != null && group.HasChildGroups)2085 {2086 foreach (var g in group.Subgroups)2087 {2088 var link = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?id=2200&groupid=" + g.Id);20892090 if (Pageview.Area.ID == 28)2091 {2092 link = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?id=2200&groupid=" + g.Id);2093 var regex = new Regex(Regex.Escape("products/"));2094 link = regex.Replace(link, "", 1);2095 }20962097 var image = g.LargeImage;2098 if (!string.IsNullOrEmpty(image) && image != "Images/Ecom/Machines/")2099 {2100 if (image.StartsWith("/"))2101 {2102 image = "/Files" + image;2103 }2104 else2105 {2106 image = "/Files/" + image;2107 }2108 }2109 else2110 {2111 image = "/Files/Images/Ecom/Groups/S-web-base.jpg";2112 }2113 <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">2114 <div class="grid__cell product-list__grid-item__image dw-mod ">2115 <a href="@link" title="@g.Name" class="u-block u-position-relative image-hover__wrapper dw-mod">2116 <img class="grid__cell-img grid__cell-img--centered u-padding b-lazy b-loaded" src="/Admin/Public/GetImage.ashx?width=300&amp;height=300&amp;Compression=75&amp;FillCanvas=true&amp;DoNotUpscale=true&amp;image=@image" alt="@g.Name">2117 </a>2118 </div>2119 <div class="grid__cell product-list__grid-item__price-info dw-mod">2120 <a href="@link" title="@g.Name">2121 <h6 class="u-condensed-text">@g.Name</h6>2122 </a>2123 </div>2124 </div>2125 }2126 }21272128 </div>2129 </div>2130 </div>21312132 }2133 else if (!string.IsNullOrEmpty(Search))2134 {2135 <div class="grid__col-auto">2136 @Pageview.AreaSettings.GetItem("Custom").GetString("ProductNotFoundContent");2137 </div>2138 }2139 {{/each}}2140 </script>2141 }21422143 @helper RenderProductList() {2144 @*This is part of a script template *@21452146 List<Block> subBlocks = productListPage.GetBlockListById("ProductList").OrderBy(item => item.SortId).ToList();21472148 string pageId = GetGlobalValue("Global:Page.ID");2149 string pageUrl = GetGlobalValue("Global:Pageview.Url.Raw");2150 string listId = HttpContext.Current.Request.QueryString.Get("ListID");2151 bool isFavoriteList = !string.IsNullOrEmpty(listId);2152 string feedFullUrl = pageUrl + "&feed=true";2153 feedFullUrl += !isFavoriteList ? "&DoNotShowVariantsAsSingleProducts=True" : "";2154 string smallDeviceCss = Pageview.Device.ToString() == "Mobile" ? "" : "";21552156 <div class="grid__col-sm-auto grid__col-xs-12 @smallDeviceCss">2157 @if (isFavoriteList)2158 {2159 string searchPlaceholder = Translate("Search favorite products", "Search favorite products");2160 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? "";21612162 <div class="grid__cell">2163 <div class="u-pull--left">2164 <h2 class="u-no-margin"><i class="{{headerIcon}}"></i>{{header}}</h2>2165 </div>2166 <div class="grid__col--bleed grid__col-6 u-pull--right">2167 <div class="u-margin-bottom">2168 <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">2169 <input type="text" class="typeahead-search-field u-no-margin u-full-width js-typeahead-search-field" placeholder="@searchPlaceholder" value="@searchValue">2170 <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>2171 <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>2172 </div>2173 </div>2174 </div>2175 </div>2176 }21772178 <div class="grid__cell">2179 @RenderBlockList(subBlocks)2180 </div>2181 </div>2182 }