I've been trying to get this working but can't seem to find a solution.
I have two different types of Categories in a commerce project.
- Level One
- Level Two
Examples
- Level One would be Mens, Ladies, Kids etc
- Level Two would be T-Shirts, Jumpers, Shoes etc
When I click on 'Mens' on the navigation, it brings me to the Mens page, I then get a sub navigation on that page which shows me any Level Two categories that are related to the Level One category (Mens).
These are related by using the categories field type.
This is got easily by the following:
{% for subCat in craft.categories.group('levelTwo').relatedTo(category) %}
The problem that I encounter now, is when you click on one of the Level Two categories on that sub nav (T-Shirts for example), it brings me to the t-shirt category page. I want to be able to display the same sub nav that is on Level One (Mens), on the Level Two (T-shirts) page.
{% for subCat in craft.categories.group('levelTwo') %}
The above snippet shows me all the categories in Level Two, which is wrong.
I need to be able to show all the categories in Level Two, that have have the same categories field type. The handle of this categories field type is topLevelConnection.
Any suggestions would be greatly appreciated!