@model CategoryNavigationModel @using Nop.Core.Domain.Catalog @functions { bool BreadCrumbContainsCurrentCategoryId(CategorySimpleModel category) { if (Model.CurrentCategoryId == 0) return false; if (category.Id == Model.CurrentCategoryId) return true; foreach (var subCategory in category.SubCategories) { if (BreadCrumbContainsCurrentCategoryId(subCategory)) { return true; } } return false; } async Task CategoryLine(CategoryNavigationModel.CategoryLineModel lineModel) { var active = lineModel.Category.Id == lineModel.CurrentCategoryId || lineModel.Category.SubCategories.Count(BreadCrumbContainsCurrentCategoryId) > 0; var last = lineModel.Category.Id == lineModel.CurrentCategoryId; var liClass = active ? "active" : "inactive"; if (last) { liClass += " last"; }
  • @lineModel.Category.Name @if (lineModel.Category.NumberOfProducts.HasValue) { @T("Categories.TotalProducts", lineModel.Category.NumberOfProducts.Value) } @{ if (lineModel.Category.Id == lineModel.CurrentCategoryId || lineModel.Category.SubCategories.Count(BreadCrumbContainsCurrentCategoryId) > 0) { if (lineModel.Category.SubCategories.Count > 0) { } } }
  • } } @if (Model.Categories.Count > 0) {
    @T("Categories")
    }