How to configure and adapt Aimeos based shops as developer
Forum rules: Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#3332 by earosb
02 Sep 2016, 14:13
Hi there!

I have a catalog tree that i created from backend admin, I need to show the same tree in frontend but when i search all categories the hasChildren function always return false. This is part of my code

Code: Select all$manager = \Aimeos\MShop\Factory::createManager( $context, 'catalog' );
$search = $manager->createSearch();
$categories = $manager->searchItems($search);

foreach ($categories as $category) {
    if ( $category->hasChildren() ) {
        // code stuff...
    }
}


I'm using typo3 7.6.10, extbase and Aimeos 16.4.3

Thanks in advance
#3333 by aimeos
02 Sep 2016, 14:18
Well single items returned by searchItems() don't have children. Use the getTree() method of the catalog manager instead to get a tree of nodes instead.
#3340 by earosb
02 Sep 2016, 18:59
aimeos wrote:Well single items returned by searchItems() don't have children. Use the getTree() method of the catalog manager instead to get a tree of nodes instead.

Thank you Mr. Aimeos, you are a genius!