Questions tagged [filtering]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
78 views

Advanced Sprig Filtering

I'm trying to create a filter system where by users can drill down their filtering, so for example they can search whether or not the item is a poster and then in the second search filter, they can ...
user avatar
2 votes
1 answer
37 views

Filtering lists of entries in the control panel by entry type

I’m aware of Filtering/searching for entries by category in the control panel, but that doesn’t work for: entryType:"String" …where ‘String’ is the entry type name or handle, or… typeId:Int ...
user avatar
1 vote
1 answer
94 views

Filter entries based multiple category groups

This is related with Split categories by levels / List categories merged by name which I explain more on detail there, after that I take the suggestion of create separate category groups, so: I have ...
user avatar
1 vote
1 answer
51 views

Filtering entires via tag field and checkbox field using a form

*** Edited the question I have a code that used to work fine on Craft 2 and I don't understand what I need to change to make it work on Craft 3. I am using form to filter through a channel of entries ...
user avatar
1 vote
1 answer
32 views

Craft Commerce: Filter completed orders based on a product category field

I know how to filter entries or products based on a category field with .relatedTo, but how can I filter completed orders based on a product category field? In this specific case, I have an overview ...
user avatar
2 votes
2 answers
549 views

How to create a faceted search/facet filter in Craft Commerce

I want to create these kinds of filters on my Craft Commerce site: I have poked around with the Faceted Navigation plugin, but haven't gotten it to work the way I want yet (posted an issue about high ...
user avatar
  • 617
1 vote
1 answer
264 views

orderBy title, but remove the word "The" from titles

If I have a huge list of TV shows and Movies, many of them have "The" in the title, meaning they all get grouped together if you order by title. Is it possible to "filter out" a ...
user avatar
  • 85
1 vote
1 answer
26 views

Using a Matrix field to create a homepage that shows entries from sections and categories

I have set up 3 channel types - A, B & C and a Category. Each entry type shares the same pool of categories. On the home page, I have created a Matrix field (homeSections) with a block type ...
user avatar
  • 85
1 vote
0 answers
96 views

Sanitize form input

I'm trying to sanitize form input values in my plugin. Yii2 framework provides the following validation method: https://www.yiiframework.com/doc/guide/2.0/en/tutorial-core-validators#filter It says ...
user avatar
1 vote
1 answer
59 views

Order grouped results by dropdown order

Following this topic, I have an additional question. The results are not ordered by the order of the Dropdown Options. How can I get this done? Code: {% set players = entry.myPlayersMatrix %} {% ...
user avatar
1 vote
0 answers
27 views

Filtering Entries based on Amenities (Category)

Hello and thank you in advance. I have a page that lists hotels by region. On the initial load of the page I am able to render all the hotels by region in a tabbed format. This part of the page works ...
user avatar
  • 107
1 vote
1 answer
181 views

How to use checkboxes to filter categories on the front end?

i am trying to filter the various categories i have. Currently my url formats the following : www.site.com/news?cat=industry-news&cat=architecture-design I understand that i have to change this ...
user avatar
1 vote
1 answer
708 views

Arrow functions in twig or craft cms

I tried to use reduce function in template, but got error. It seems twig/craftcms can not work with such functions. Reduce function docs: https://docs.craftcms.com/v3/dev/filters.html#reduce My ...
user avatar
  • 81
4 votes
1 answer
613 views

How to order or filter entries by their author's custom field?

Is it possible to order and/or filter all entries from a section whose author has a custom field value that is set to "X"? Below is the starting code. in Twig: {% set elementQuery = craft.entries()...
user avatar
  • 6,146
1 vote
1 answer
630 views

Filter Entries by Category fields & refresh URL and list with AJAX

I'm finding myself stuck with filtering entries that are related to categories using a category field. I'm looking to build a sub-navigation on a page, where I can select from a select field or from a ...
user avatar
1 vote
1 answer
210 views

How to filter entries by tags array using ['or'] and by category not using or

This works for filtering by tag array {% set relatedToParam = ['or'] %} {% for id in selectedTagIds %} {% set relatedToParam = relatedToParam|merge([{ targetElement: id }]) %} {% ...
user avatar
  • 11
1 vote
1 answer
470 views

Product Filtering with Tags

I've built a product filtering system using tags and currently have 2 available tag groups under different fields. Size and Type Currently if I select 1 tag from both size and type, it shows all ...
user avatar
  • 407
0 votes
0 answers
48 views

Using relatedTo with a string of category ids

I have got a list of product variants being filtered by a string of category ids if there is some data in the category parameter with the following code: (Note that I'm using the + character between ...
user avatar
  • 1,032
1 vote
1 answer
170 views

filter matrix blocks by multiple light switch value, and then merge them

I have a (Craft 3) matrix field with two different block types that each have a similar light switch field that I want to use to create anchor links on my page. I need to be able to test whether any ...
user avatar
  • 950
2 votes
2 answers
2k views

Filter entries by Field value using a variable

How do I filter a list of entries by the value of a field using the value of a variable? e.g. {% set location = block.locationVacancies %} {% set entries = craft.entries.section('careers').search('...
user avatar
1 vote
2 answers
220 views

Filtering by categories AND tags with full match

We're trying to filter by categories AND tags in the one form. However can't seem to get things working as we would like. Essentially, we have a form that pulls in the tags and allows multiple ...
user avatar
  • 21
1 vote
0 answers
135 views

Redactor has destroyed my mailto links, now what?

I migrated from EE > CraftCMS. The email links in my EE WYGWAM fields were encoded as JS. When we imported to CraftCMS we lost all of those links. They now look like this: <a>joe@schmoe.com</...
user avatar
1 vote
0 answers
602 views

How can I filter with facets in algolia with nested structures?

I have a site that currently uses a structure where we have a parent entry and children under it. On the parent page we have entries that have been created with matrix blocks. The structure is as ...
user avatar
1 vote
2 answers
479 views

Sort entries by time part only of DateTime object

I am trying to filter and sort show entries by what time they begin display the current show I have two fields, startTimeand endTime, and while Craft lets me display only the time part in the ...
user avatar
  • 61
1 vote
1 answer
781 views

Pass 'not' category.id to relatedTo in Craft

I have a search page that filters with these params: {% set results = craft.entries({ section: 'properties', price: range, search: query.location, relatedTo: status, order: ...
user avatar
  • 61
1 vote
1 answer
394 views

How can I filter Craft Commerce products by the current price

Building on from this question How can I filter Craft Commerce products by price I have a price filter in the store Using this code works fine for the normal price {% set queryParams = { ...
user avatar
  • 106
2 votes
1 answer
641 views

Only show entries related to category

I am trying to create a category template that shows all entries to show relating to the categories. At the minute the cats are Industry Chemical Medical
user avatar
  • 35
1 vote
1 answer
803 views

How can I filter Craft Commerce products by price

I'm trying to use price as a parameter for filtering my Craft Commerce products, but I cannot get it to work. I think the problem is with the way that I'm referring to the product price, but at the ...
user avatar
1 vote
0 answers
326 views

How to add pagination to a filtered category output?

I've been able to successfully filter a set of entries by category, and also include pagination for the complete set of entries (in this case so 6 are displayed per page). But once a category filter ...
user avatar
  • 439
2 votes
1 answer
531 views

Display entries that meet multiple tag params

how would I go about setting up a route and twig template to filter by multiple tags? Example URL scheme: example.com/tags/tag1/tag2/tag3 where tag1, tag2 and tag3 are tags defined in a tag field ...
user avatar
  • 23
4 votes
1 answer
366 views

Filtering on related entries (with an array query param)

I'm getting myself into a potential pickle here and wanting to know the best way to get apply filters on the current scenario: I have a central business section which is getting populated via an API (...
user avatar
10 votes
4 answers
15k views

Filter Entries by Field Value

How do I filter a list of entries by the value of a field? For example, if I have a lightswitch field called "Featured", how do I output just the featured entries?
user avatar
  • 1,075