Value from/to for one field
The “Value from/to for one field” filter rule (package filter_fromto) filters items
based on a value range for a single numeric or text-based attribute. Visitors can enter a
“from” value, a “to” value, or both in the frontend. The filter rule returns all items
whose attribute value falls within the specified range.
Typical use cases: Price filters (price from X to Y), size or age specifications, or general numeric range filters.
See also
For comparisons across two separate attributes (e.g. “Valid from” and
“Valid until”), the filter rule Value from/to for two fields is available.
For date values, the filter rule Value from/to for one date field is available.
Installation
The filter rule is installed via the Contao Manager or Composer:
composer require metamodels/filter_fromto
Settings when Creating the Filter Rule
Setting |
Description |
|---|---|
Type |
Selection of the filter rule type — here: “Value from/to for one field”. |
Enabled |
Enables or disables this filter rule. |
Comment |
Free text field for describing the purpose of this filter rule. |
Attribute |
The attribute by whose value items should be filtered (e.g. price, age). |
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 displayed in the input fields while they are empty. |
Greater-than-or-equal (≥) |
If this option is active, the “from” value is treated as inclusive ( |
Less-than-or-equal (≤) |
If this option is active, the “to” value is treated as inclusive ( |
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 one field” filter rule is suitable for attributes with numeric or comparable values: