Entries from different category levels brought together I have an issue with categories with different levels:

I have a group of categories which have a structure like this:

First form:
1.0 Group –
1.1 Subgroup –
1.2 Items in subgroup

Second form:
 - 1.0 Group –
   1.1 Items in Group

In some groups are subgroups in others aren't. But I need to list all the items, regardless if they are in a subgroup or not. How can I adress them correctly. Can I do an if statement like: if there is no 1.2 level, take the 1.1 level and treat it like a 1.2 level?

How can I do this?
What you want is the categories that do not have descendants. I would loop over all the categories, and skip the ones with descendants. The test to skip is:

{% if not category.hasDescendants %} ... {% endif %}


Documentation for hasDescendants.