From 27963cf45c7c8350fc2de595d6c23f28c8257578 Mon Sep 17 00:00:00 2001 From: Evgenii Kolosov <108291208+Ljutyj@users.noreply.github.com> Date: Wed, 22 Jan 2025 19:02:49 +0300 Subject: [PATCH] VCST-2346: Add catalog as a first element of breadcrumbs (#25) --- .../Extensions/OutlineExtensions.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/VirtoCommerce.XCatalog.Core/Extensions/OutlineExtensions.cs b/src/VirtoCommerce.XCatalog.Core/Extensions/OutlineExtensions.cs index 9d99183..558dc6a 100644 --- a/src/VirtoCommerce.XCatalog.Core/Extensions/OutlineExtensions.cs +++ b/src/VirtoCommerce.XCatalog.Core/Extensions/OutlineExtensions.cs @@ -155,6 +155,20 @@ public static IEnumerable 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; }