[BUG] Category breadcrumbs path is missing
Is there an existing issue for this?
- [X] I have searched the existing issues
Current Behavior
Currently useBreadcrumbs() composable only returns names array for category breadcrumbs. Paths are missing so link to category cannot be created.
E.G.
{
"name": "Food"
}
Helper function to get breadcrumbs getCategoryBreadcrumbs() also gather only names:
export function getCategoryBreadcrumbs(
category: Category | null | undefined,
options?: {
/**
* Start at specific index if your navigation
* contains root names which should not be visible.
*/
startIndex?: number;
}
) {
const breadcrumbs =
category?.translated?.breadcrumb || category?.breadcrumb || [];
const startIndex = options?.startIndex || 0;
if (breadcrumbs.length <= startIndex) return [];
return breadcrumbs.slice(startIndex).map((element) => {
return {
name: element,
};
});
}
Breadcrumbs in product.seoCategory / category API response also contain only names. So I think this is issue both in BE and FE parts:

Expected Behavior
As declared in useBreadcrumbs return type I expect category breadcrumb with path returned:
type Breadcrumb = {
name: string;
path?: string;
};
Steps To Reproduce
No response
Environment
- OS:
- Node:
- npm:
Anything else?
No response
Thx for submitting this already known issue (NEXT-24954). We have an discussion with the product area that is responsible to return the path via API. Also good to have this issue here to do not forget it. Will ping you when I have news about this.
Possible solutions:
In this file: src/Core/Content/Category/Service/CategoryBreadcrumbBuilder.php we could add after line 89 this line of code: $criteria->addAssociation('seoUrls'); and then we would have already the seoUrls in the response (slower).
Otherwise we could change public function getPlainBreadcrumb(): array function in src/Core/Content/Category/CategoryEntity.php and instead a flat array we return a super simple object that contains name and path (maybe path is already loaded, did not checked, then this would be faster).
@patzick could we use the same technic we used for "duplicated" seoURL''s calls to solve this issue? Like looking in the list if we have this seoURL already and then adding the link instead of waiting for the changed response? Just an idea.
@StanislovasRamanauskas here is an example of how to solve this in frontends (but this is just a workaround): https://github.com/shopware/frontends/pull/258/files
And I do not know if we will merge this into the demo-store.
For reference: NEXT-24954
@BrocksiNet Is there any news update about this issue 😄.
I am preparing the MR to get the new Endpoints into the Core of Shopware. After that, we can update the composables and have a proper solution. :raised_hands: But I need to find out which version it will be released.
The changes are already in the trunk so we can start with the frontend part. This is not blocked anymore.