/** * action list * * @return void */ public function listAction() { $childList = array(); $category = $this->categoryRepository->findByUid($_GET['tx_whoshop_category']['category']); DebuggerUtility::var_dump($category); $this->getCatUidListRecursive($category, $childList); DebuggerUtility::var_dump($childList, 'childList'); if ($category == NULL) { $category = $this->categoryRepository->findByUid($this->settings['defaultCategory']); } $products = $this->productRepository->findByCat($category); $productsArray = $products->toArray(); if (empty($productsArray) && !empty($childList)) { DebuggerUtility::var_dump('products empty'); $products = $this->productRepository->findByCatList($childList); } DebuggerUtility::var_dump($products, 'Produkte'); $this->view->assign('products', $products); $this->view->assign('category', $category); }
private function addChildren(&$parentCats, $maxDepth = 3, $depthCount = 0) { $depthCount++; foreach ($parentCats as $parentCat) { $parentCat->setDepth($depthCount); if ($depthCount < $maxDepth) { $parentCat->setChildren($this->categoryRepository->findAllByParent($parentCat->getUid())); $this->addChildren($parentCat->getChildren(), $maxDepth, $depthCount); } } }