Catalog tree

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)
Spam and unrelated posts will be removed immediately!
earosb
Posts: 12
Joined: 13 Jul 2016, 15:30

Catalog tree

Post 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

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Catalog tree

Post 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.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

earosb
Posts: 12
Joined: 13 Jul 2016, 15:30

Re: Catalog tree

Post 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!

Post Reply