Value from/to for two fields
The “Value from/to for two fields” filter rule (package filter_range) filters items
based on a value range defined by two separate attributes. The first attribute represents
the start value (“from”), the second attribute the end value (“to”). An item is included
in the result when a given search value lies within the range defined by both attribute
values.
Typical use cases: Validity periods (“Valid from” / “Valid until”), price ranges with separate fields for minimum and maximum price, or event periods.
See also
For comparing a single attribute against a range entered by the visitor,
the filter rule Value from/to for one field is available.
For two date fields, the filter rule Value from/to for two date fields is available.
Installation
The filter rule is installed via the Contao Manager or Composer:
composer require metamodels/filter_range
Settings when Creating the Filter Rule
Setting |
Description |
|---|---|
Type |
Selection of the filter rule type — here: “Value from/to for two fields”. |
Enabled |
Enables or disables this filter rule. |
Comment |
Free text field for describing the purpose of this filter rule. |
Attribute (from) |
The first attribute that contains the start value of the range. |
Attribute 2 (to) |
The second attribute that contains the end value of the range. |
Settings for the Frontend Widget
Setting |
Description |
|---|---|
URL parameter |
The key of the URL parameter for passing the filter value. Without input,
the column name of the attribute is used. With |
URL type for the parameter |
Defines whether the parameter is passed as a slug (friendly URL) or as a GET parameter (from MM 2.4) — see SEO |
Label |
Label of the filter widget. |
Hide label at filter widget |
Suppresses the output of the label. |
Template |
Template for the widget output. Default: |
Placeholder |
Placeholder text in the input fields. |
Filter range type |
Defines how the search range is compared with the attribute values:
|
Greater-than-or-equal (≥) |
The “from” search value is compared inclusively ( |
Less-than-or-equal (≤) |
The “to” search value is compared inclusively ( |
Show from field |
Enables the display of the “from” input field in the widget. |
Show to field |
Enables the display of the “to” input field in the widget. |
CSS ID/class |
Sets a CSS ID or class on the widget element. |
Matching Attributes
The “Value from/to for two fields” filter rule is suitable for attributes with numeric values: