EE2.7.2
I have a native relationship field 'related_products' pulling in multiple entries from a products channel. Most products are in 2 top level categories - group_id 1 and group_id 2. I want to pass the category_url_title in my link.
The code below returns both the categories in the url:
{exp:channel:entries channel="featured_products" dynamic="no" limit="1" url_title="featured" status="open" disable="pagination|member_data|category_fields"}
{related_products limit="12"}
<a href="{site_url}brands/{related_products:categories}{category_url_title}{/related_products:categories}/{related_products:url_title}" title="View product details">LINK</a>
{/related_products}
{/exp:channel:entries}
If I add 'related_products:categories limit="1"' to the code as below, it will return just one category - always from only group_id 1.
{exp:channel:entries channel="featured_products" dynamic="no" limit="1" url_title="featured" status="open" disable="pagination|member_data|category_fields"}
{related_products limit="12"}
<a href="{site_url}brands/{related_products:categories limit="1"}{category_url_title}{/related_products:categories}/{related_products:url_title}" title="View product details">LINK</a>
{/related_products}
{/exp:channel:entries}
I can't seem to find a way to filter the 'related_products:categories' to show the second group of categories.
Can anyone help?