<p>Try to group the entries sorted by size using the <code>group</code> filter:</p>

<pre><code>{% set entriesSorted = entries|supersort('sortAs', '{ size }', SORT_NUMERIC) %}
{% set entriesByBrand = entriesSorted|group('brand.first.title') %}
{% set entriesByBrand = entriesByBrand|supersort('ksort') %}

{% for brand, entriesInBrand in entriesByBrand %}
    {% for entry in entriesInBrand %}
        &lt;li&gt;{{ entry.title }}&lt;/li&gt;
    {% endfor %}
{% endfor %}
</code></pre>

CC BY-SA 3.0
2015-12-02T14:16:40.160Z
Thanks that grouped my entries by brand and ordered them by size. Is there a way to have the grouped brands display alphabetically?
triplethreat23
CC BY-SA 3.0
2015-12-02T16:55:32.397Z
Try to add another Supersort filter using 'ksort' method @triplethreat23!
carlcs
CC BY-SA 3.0
2015-12-02T05:17:23.773Z
2015-12-02T16:54:59.553Z
2015-12-02T16:54:59.553Z
carlcs
<p>I have entries that I would like to sort by 2 fields. First I would like to sort (or group) all of the entries in alphabetical order by a category field (brand), and then within each grouped brand I would like to sort the entries by a number field ascending (size).</p>

<p>I can perform both sorts individually with the syntax below, but I’m having difficulty combining them for a multisort-like function.</p>

<pre><code> entries|supersort('sortAs', '{ brand.first.title }')
 entries|supersort('sortAs', '{ size }', SORT_NUMERIC)
</code></pre>

<sorting><plugin-supersort><sort>
Multisort with supersort plugin
# Multisort with supersort plugin

(Asked by: username_0 on 2015-12-02)

I have entries that I would like to sort by 2 fields. First I would like to sort (or group) all of the entries in alphabetical order by a category field (brand), and then within each grouped brand I would like to sort the entries by a number field ascending (size).
I can perform both sorts individually with the syntax below, but I’m having difficulty combining them for a multisort-like function.
 entries|supersort('sortAs', '{ brand.first.title }')
 entries|supersort('sortAs', '{ size }', SORT_NUMERIC)

**Tags:** sorting, plugin-supersort, sort

---

## 1 answers

### Answer by username_1 on 2015-12-02. Score: 2 | Accepted answer

Try to group the entries sorted by size using the group filter:
{% set entriesSorted = entries|supersort('sortAs', '{ size }', SORT_NUMERIC) %}
{% set entriesByBrand = entriesSorted|group('brand.first.title') %}
{% set entriesByBrand = entriesByBrand|supersort('ksort') %}

{% for brand, entriesInBrand in entriesByBrand %}
    {% for entry in entriesInBrand %}
        {{ entry.title }}
    {% endfor %}
{% endfor %}

> **Comments:**
> **username_0**: Thanks that grouped my entries by brand and ordered them by size. Is there a way to have the grouped brands display alphabetically?  
> **username_1**: Try to add another Supersort filter using 'ksort' method @triplethreat23!  

---

