Questions tagged [filtering]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
44 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 ...
1
vote
1answer
41 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 ...
1
vote
1answer
25 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 ...
2
votes
2answers
434 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 ...
1
vote
1answer
153 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 ...
1
vote
1answer
20 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 ...
1
vote
0answers
83 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 ...
1
vote
1answer
55 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 %} {% ...
1
vote
0answers
26 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 ...
1
vote
1answer
164 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 ...
1
vote
1answer
622 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 ...
4
votes
1answer
463 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()...
1
vote
1answer
581 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 ...
1
vote
1answer
170 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 }]) %} {% ...
1
vote
1answer
436 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 ...
0
votes
0answers
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 ...
1
vote
1answer
162 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 ...
2
votes
2answers
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('...
1
vote
2answers
211 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 ...
1
vote
0answers
123 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</...
1
vote
0answers
576 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 ...
1
vote
2answers
455 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 ...
1
vote
1answer
716 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: ...
1
vote
1answer
381 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 = { ...
2
votes
1answer
619 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
1
vote
1answer
762 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 ...
1
vote
0answers
320 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 ...
2
votes
1answer
515 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 ...
4
votes
1answer
350 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 (...
9
votes
4answers
14k 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?