`I will try this again.
I have an index page for each category within category group 1 (markets
).
I loop through the descendants of the given category to create filter buttons.
How do i pull all the categories from a 2nd category group (country
) assigned to each market
from markets
- listing them only once
For the market
from category group-1 (markets
), I am using:
{% set segments = craft.categories.descendantOf(category) %}
{% for category in segments %}
button html using {{ category.title }}
``{% endfor %}
For the countries
from category group-2 (country
), I tried using:
{% set name = craft.categories.group('country').relatedTo(category) %}
{% for nation in name %}
button html with {{ nation.countryName }}
{% endear %}
Where countryName
is the field name for the country
group.
I did not get a template error. But nothing printed.