I'm loading a set of entries related to 'category' and ordering them by the value of a Dropdown field in the entries. This work well using this code:
{% set entries = craft.entries.relatedTo(category).order('myDropdownField') %}
Now I need to change the Dropdown field to a Category field, but I am not able to sort my entries by this new category field by swapping the dropdown with the category field like this:
{% set entries = craft.entries.relatedTo(category).order('myNewCatField') %}
It gives me this error:
CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'departmentCat' in 'order clause'.
I also tried to use the Craft group filter, but I could not make it work in my setting.
Any suggestions are appreciated!