From: Vincent Vanwaelscappel Date: Wed, 15 Apr 2020 13:39:35 +0000 (+0200) Subject: wip #3593 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=83aea10f321cf3e68d31f6719aa971516f5c6cb8;p=pmi.git wip #3593 @1 --- 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();