Skip to content

Commit

Permalink
VCST-2346: Add catalog as a first element of breadcrumbs (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ljutyj authored Jan 22, 2025
1 parent 05c1815 commit 27963cf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/VirtoCommerce.XCatalog.Core/Extensions/OutlineExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,20 @@ public static IEnumerable<Breadcrumb> GetBreadcrumbsFromOutLine(this IEnumerable
}
#pragma warning restore S2259 // Null pointers should not be dereferenced

var catalog = outlineItems[0];
var catalogSeoInfoForStoreAndLanguage = SeoInfoForStoreAndLanguage(catalog, store.Id, cultureName);
if (catalog.SeoObjectType == "Catalog" && catalogSeoInfoForStoreAndLanguage != null)
{
var breadcrumb = new Breadcrumb(catalog.SeoObjectType)
{
ItemId = catalog.Id,
Title = catalogSeoInfoForStoreAndLanguage.PageTitle?.EmptyToNull() ?? "Catalog",
SemanticUrl = catalogSeoInfoForStoreAndLanguage.SemanticUrl?.EmptyToNull() ?? "catalog",
SeoPath = catalogSeoInfoForStoreAndLanguage.SemanticUrl?.EmptyToNull() ?? "catalog"
};
breadcrumbs.Insert(0, breadcrumb);
}

return breadcrumbs;
}

Expand Down

0 comments on commit 27963cf

Please sign in to comment.