I have a small problem with building up a Wayfinder menu of SimpleCart product categories.
It all works fine except that if a product-resource is clicked to open its detail page, Wayfinder always renders the current category as a folder in Wayfinder tree if we are in first tree level.
This is the rendered tree in its initial state! please have a look at “Feste Fette” - its now rendered correctly with &rowTpl, as it has no sub-categories:
If I now click on “Feste Fette” and then on a product to get to its detail-page the “Feste Fette” menu is rendered like this, using the & parentRowTpl:
I think I know whats the problem but don’t have a solution:
If I change the isfolder setting of the “Feste Fette” category to false, the rendering is correct.
But this setting isn’t static. It automatically changes to true if I create a new product inside this category.
As SimpleCart has a special parent child relation (scCategoryResources + scProductResources), WayFinder decides that the category has child elements and renders as a folder.
it works like expected! At least in my environment.
With the change, Wayfinder doesn’t only check if isfolder = true, it also checks if the resource has childrens available (&& $numChildren) for rendering in the Wayfinder output.
Without the fix, Wayfinder will always determine a menu-item as folder (or parent menu item) even if it has no child items available for output.
Can anyone confirm this? If it works how I think, I’ll submit a pull-request to Wayfinder GitHub repo.
I have checked this and it makes no difference. The &where filter is working in both variants. But Wayfinder uses the wrong chunk.
Applying my Wayfinder fix and it is working again.
Wayfinder shouldn’t render a menu-item as “folder” (or parent item), if there are no child resources included in output.
As SimpleCart products are hidden in the category structure, Wayfinder should respect this.