Show entire category tree starting from root

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
loeffe1
Posts: 49
Joined: 21 Feb 2020, 10:33

Show entire category tree starting from root

Post by loeffe1 » 18 Jun 2020, 15:59

I have a problem with the category tree.

I have a bunch of nested categories like this:

Categories
|_ Root
|_ Category 1
|_ Category 2
|_ Category 2-1
|_ Category 2-2
|_ Category 2-3
[...]
|_ Category 3
[...]

If I set the tree startid to the id of Category 2, all subcategories of that category will be shown as expected.
However, if I set the startid to the Root category only the first subcategory (Category 1 ) will be shown.

What am I doing wrong?

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

Re: Show entire category tree starting from root

Post by aimeos » 19 Jun 2020, 07:50

Are all other first level categories activated (look at the status of each category in the admin backend)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
loeffe1
Posts: 49
Joined: 21 Feb 2020, 10:33

Re: Show entire category tree starting from root

Post by loeffe1 » 19 Jun 2020, 09:14

Yes, status is set to enabled for all of them.

User avatar
loeffe1
Posts: 49
Joined: 21 Feb 2020, 10:33

Re: Show entire category tree starting from root

Post by loeffe1 » 01 Jul 2020, 08:48

I reimported my categories and now all of them are displayed. However now I am running into a new problem where as first level the root category is shown, so my menu will look like this

Root
|-- Category 1
|-- Category 2
|-- Category 3

If setting the startid to the id of the root category, the root category shouldn't be shown but instead all categories within root.

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

Re: Show entire category tree starting from root

Post by aimeos » 01 Jul 2020, 09:05

To hide the root node, change your template from:

Code: Select all

'nodes' => [$this->treeCatalogTree],
to

Code: Select all

'nodes' => $this->treeCatalogTree->getChildren(),
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
loeffe1
Posts: 49
Joined: 21 Feb 2020, 10:33

Re: Show entire category tree starting from root

Post by loeffe1 » 07 Jul 2020, 11:01

Thanks, this will surely come in handy soon or later. For this current project it made more sense to use a DataProcessor to fetch the info from the mshop_catalog table. The category menu I was displaying needed to be accessible from anywhere on the page, not just from pages within /shop. So I wasn't able to use the catalog tree action because I would be missing the /shop part in my urls for other pages .

Post Reply