I have an array of products that has already been filtered by a brand category. I want to display them in a list ordered by a size category. This is working, but I think there must be a better way:
{% set productList = craft.entries(params) %}
{# where params includes a relatedTo parameter already #}
{% for size in sizes %}
{% for product in productList %}
{% if product.sizeCategory.first.id == size.id %}
{{ product.title }}<br />
{% endif %}
{% endfor %}
{% endfor %}