This allows me to pull the related categories from a second category group for a given category.
{% set entries = craft.entries.relatedTo(category).find() %}
{% set tags = craft.tags.relatedTo(entries).find() %}
{% set markets = craft.categories.group('markets').relatedTo(entries).find() %}
BUT, it pulls both the parent and descendant categories from markets. And, some markets do not have descendants - so adding `.level(2) would not capture those that only have a level(1) assigned.
I want to list only the last level assigned whether it is level(1) or level(2).
I tried adding .last()
but that generates a CException
error.
{% set markets = craft.categories.group('markets').last().relatedTo(entries).find() %}
What am I missing?
Thanks