From 83aea10f321cf3e68d31f6719aa971516f5c6cb8 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 15 Apr 2020 15:39:35 +0200 Subject: [PATCH] wip #3593 @1 --- app/Templates/Category.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Templates/Category.php b/app/Templates/Category.php index 9d787ba..bf9a23e 100644 --- a/app/Templates/Category.php +++ b/app/Templates/Category.php @@ -72,12 +72,16 @@ class Category extends Base $data['filter_results'] = $filters ? $filters['results'] : []; } + /** + * @param \Cubist\Backpack\app\Magic\Menu\Item $menu + */ public function setMenuChildren($menu) { $products = self::_getProducts($menu->getVariant()); $data = $menu->getPageData(); $cat = $data->get('category'); $filter = $menu->getPageData()->get('filter', ''); + $root = $menu->getRoot(); foreach ($products as $product) { if ($product->product_type != $cat) { continue; @@ -87,8 +91,8 @@ class Category extends Base } $canonical = $href = $product->getSlugOrTitleAttribute(); - if ($filter !== '') { - $href = $cat . '-' . $href; + if ($root->findOneByHref($canonical) !== null) { + continue; } $detail = new PageItem(); -- 2.39.5