ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Views/Catalog/ProductsByTag.cshtml
@model ProductsByTagModel
@inject SeoSettings seoSettings
@inject IPageHeadBuilder pagebuilder
@{
    Layout = "_ColumnsTwo";

    //title
    pagebuilder.AddTitleParts(string.Format(T("PageTitle.ProductsByTag").Text, Model.TagName));

    //canonical URL
    var canonicalUrlsEnabled = seoSettings.CanonicalUrlsEnabled;
    if (canonicalUrlsEnabled)
    {
        var productsByTagUrl = Url.RouteUrl("ProductsByTag", new { productTagId = Model.Id, SeName = Model.TagSeName }, this.Url.ActionContext.HttpContext.Request.Scheme);
        pagebuilder.AddCanonicalUrlParts(productsByTagUrl);
    }
}
@using Grand.Domain.Seo
@using Grand.Web.Models.Catalog;
<div class="page product-tag-page">
    <h2 class="generalTitle">@String.Format(T("Products.Tags.ProductsTaggedWith").Text, Model.TagName)</h2>
    @await Component.InvokeAsync("Widget", new { widgetZone = "productsbytag_top", additionalData = Model.Id })

    @if (Model.Products.Any())
    {
        <partial name="_CatalogSelectors" model="Model.PagingFilteringContext" />
        @await Component.InvokeAsync("Widget", new { widgetZone = "productsbytag_before_product_list", additionalData = Model.Id })
        if (Model.PagingFilteringContext.ViewMode == "grid")
        {
            <div class="product-grid col-12 px-0">
                <div class="form-row flex-grid">
                    @foreach (var product in Model.Products)
                    {
                        <div class="col-lg-4 col-sm-6 col-6 product-container mb-2">
                            <partial name="_ProductBox" model="product" />
                        </div>
                    }
                </div>
            </div>
        }
        else
        {
            <div class="product-grid col-12">
                <div class="row">
                    @foreach (var product in Model.Products)
                    {
                        <partial name="_ProductBoxList" model="product" />
                    }
                </div>
            </div>
        }
    }
    <page-navigation asp-query-param="pagenumber" asp-pagination="Model.PagingFilteringContext" />
</div>
@await Component.InvokeAsync("Widget", new { widgetZone = "productsbytag_bottom", additionalData = Model.Id })


