searchit icon indicating copy to clipboard operation
searchit copied to clipboard

Chaining Filters

Open harrymee123 opened this issue 5 years ago • 2 comments

Hi There,

Is it possible to chain the search string filters?

I have three filters:

{% for entry in craft.entries.section('entries').all() %}
    {{ ({
        filter: {
            relatedTo: {
                element: entry.id,
                field: 'entries'
            }
        },
        label: entry.title
    })|json_encode() }}{{ not loop.last ? ',' }}
{% endfor %}
{% for category in craft.categories.group('categories').all() %}
    {{ ({
        filter: {
            relatedTo: {
                element: category.id,
                field: 'categories'
            }
        },
        label: category.title
    })|json_encode() }}{{ not loop.last ? ',' }}
{% endfor %}
{ "filter":"term1", "label":"Term 1" },
{ "filter":"term2", "label":"Term 2" },

Independently, they all work great. However, I get errors when using the first two filters together. The first one does seem to work with the third one. I tried swapping out the category one for another search term filter. When applying all three, only the first two seem to work.

Is it possible?

harrymee123 avatar Aug 14 '19 16:08 harrymee123

Would be great to have the ability to chain filters

zizther avatar Dec 10 '19 14:12 zizther

+1

Mactory avatar May 24 '22 15:05 Mactory