Skip to content

5. Filtering

ANDI Amine edited this page Feb 21, 2026 · 1 revision

Filtering

JoomCCK's filtering system lets visitors narrow down records by fields, categories, tags, authors, and more. Filters can be displayed via the Filters Module or built as custom URL links.


Setting Up Filters (Admin Guide)

Step 1 — Enable Filtering on Fields

When editing a field, enable the Filter toggle in field parameters. Not all field types support filtering. The table below lists the 17 filterable field types and their available filter display styles.

Field Type Filter Styles
Text Autocomplete, Checkboxes, Select, Text input, Toggle links
Select Autocomplete, Checkboxes, Select, Toggle buttons
Checkbox Autocomplete, Checkboxes, Select, Toggle buttons
Radio Autocomplete, Checkboxes, Select, Toggle buttons
Multiple Select Autocomplete, Checkboxes, Select, Toggle buttons
List Autocomplete Autocomplete, Checkboxes, Select, Toggle buttons
Boolean Default (Yes/No)
Digits Default (range slider)
Date & Time Single date picker, Range date picker
Geo (Address & Map) Default (distance/location)
Status Checkboxes, Select
Email Default
URL Default
Telephone Default
Parent Default
Child Default
Multilevel Select Default

Step 2 — Set Up the Filters Module

Go to Extensions > Modules > New > JoomCCK Filters.

Module configuration reference:

Parameter Options Notes
Section (required) Select the section this filter module applies to
Text Search Enable / Disable Show a text search box at the top of the filter panel
Content Type filter No / Checkboxes / Select Let users filter by content type
Tags filter No / Autocomplete / Checkboxes / Select / Tag Cloud Let users filter by tags
Users filter No / Autocomplete / Checkboxes / Select Let users filter by author
Categories filter No / Autocomplete / Checkboxes / Select / Multiple Select Let users filter by category
Show empty categories Yes / No Disabling can reduce performance on large sites
Show field icons Yes / No Display icons next to filter labels
Fields to exclude (multi-select) Choose fields to hide from the filter panel
Fields template Module / Section Use the module-level or section-level filter template for fields
Show Reset Button Yes / No Display a button to clear all active filters
Custom labels (text fields) Override default labels for each filter group

Step 3 — Choose Filter Display Style Per Field

In the field parameters, select the filter template. There are two versions available — Module (used when the field is displayed inside the Filters Module) and Section (used when the field filter appears in the section's built-in filter bar).

Field Alias (Cross-Type Filtering)

When a section contains multiple content types, filters are shared between types. Fields are grouped by their alias value. Two fields in different types with the same alias (e.g., color) will appear as a single shared filter in the filter panel.

How it works:

  • Edit a field and set the Alias value
  • If the alias is left empty, it auto-generates from the field label
  • The alias must be unique within the same type (auto-suffixed with -2, -3, etc. if duplicated)
  • Fields from different types that share the same alias are merged into one filter

Legacy behavior: Fields without aliases fall back to key-based matching — fields with the same label and the same field type are treated as the same filter.


Using Filters (User Guide)

How Filters Work

  1. Select criteria in the filter module and click Search / Apply
  2. Active filters appear as alert badges above the records list
  3. Click x on any active filter to remove it
  4. Click Reset to clear all filters at once

Filter Logic

  • Multiple values within one filter = OR (records matching any of the selected values are shown)
  • Multiple different filters = AND (records must match all active filters)

Building Filter Links (Developer Guide)

Pre-Ordered Links

Append ordering parameters to any section URL to control the default sort order.

Non-SEF URL:

https://example.com/index.php?option=com_joomcck&view=records&section_id=1&filter_order=r.title&filter_order_Dir=asc

SEF URL:

https://example.com/my-section?filter_order=r.title&filter_order_Dir=asc

Parameter Required Description
filter_order Yes Column to sort by (see table below)
filter_order_Dir Yes asc or desc

Available ordering columns:

Value Description
r.ctime Creation date
r.mtime Modification date
r.extime Expiration date
r.title Record title
name Author's name
username Author's username
r.hits View count
r.comments Comment count
r.favorite_num Bookmark count
r.votes_result Rating

Filter Links (Setting Filters via URL)

You can create links that automatically apply one or more filters when clicked. This is useful for menu items, sidebar links, or "pre-filtered views" such as Events this week or Articles by category.

Base URL:

index.php?option=com_joomcck&task=records.filter&section_id={ID}&Itemid={ID}

Parameter Required Description
section_id Yes Section ID
Itemid Yes Menu item ID (must match the section's Itemid parameter)
cat_id No Category ID to filter within a specific category
filter_name Yes Array of filter names (explained below)
filter_val Yes Array of filter values (explained below)
clean No Set to 1 to reset all existing filters before applying new ones

After the user clicks the link, the filters are applied and the user is redirected to the standard records list URL.

Standard Filters

filter_name value filter_val value Description
filter_cat Category ID Filter by category
filter_user User ID Filter by author
filter_tag Tag ID Filter by tag
filter_type Type ID Filter by content type
filter_search Search text Text search
filter_tpl Template name Switch list template

Example — Show records by user 42 of type 2:

index.php?option=com_joomcck&task=records.filter
  &section_id=2
  &Itemid=126
  &filter_name[0]=filter_type&filter_val[0]=2
  &filter_name[1]=filter_user&filter_val[1]=42

(Should be one line — formatted here for readability.)

Field Filters

The filter name for a field consists of the prefix filter_ plus the field key.

&filter_name[0]=filter_k2hgsd5FdK79H6Gfdt6hxnsgF55fd

Single value:

&filter_val[0]=value%201

Values must be URL-encoded (%20 = space).

Multiple values (OR logic):

&filter_val[0][]=value%201&filter_val[0][]=value%202

Records matching Value 1 OR Value 2 will be shown.

Geo field (coordinates):

&filter_val[0][lat]=41.254587&filter_val[0][lng]=21.265478

Date range:

&filter_val[0][range]=2024-09-01,2024-09-30

The first date is the start, the second is the end.

Boolean:

&filter_val[0]=true

What is a Field Key?

The field key is an MD5 hash generated from the field label and field type:

$field_key = 'k' . md5($field->label . '-' . $field->field_type);

For example, a field with label Year and type digits produces:

$field_key = 'k' . md5('Year-digits');

You can find a field's key in:

  • The key column in the #__js_res_fields database table
  • The key icon tooltip in the Fields list (admin panel)

Resetting Filters via URL

Reset all filters:

index.php?option=com_joomcck&task=records.cleanall&section_id=2&Itemid=123

Reset specific filter(s):

index.php?option=com_joomcck&task=records.clean&clean[filter_search]=1&section_id=2&Itemid=123

Resettable filter names:

Name Description
filter_search Text search
filter_type Content type
filter_tag Tags
filter_user Author
filter_alpha Alpha index
filter_cat Category
filter_{key} Field filter (replace {key} with the field key)

Reset multiple filters at once:

index.php?option=com_joomcck&task=records.clean&clean[filter_type]=1&clean[filter_alpha]=1&section_id=2&Itemid=123


PHP Helper Methods

Use these helper methods in field output templates to generate clickable filter links.

FilterHelper::filterLink()

Generates an anchor tag that applies a filter when clicked.

FilterHelper::filterLink($name, $value, $text, $type, $tip, $section);
Parameter Type Description
$name string Filter name (e.g., filter_k...)
$value string Filter value
$text string Visible link text
$type int Content type ID (used to auto-add a type filter when the section has multiple types)
$tip string Tooltip text
$section object Section object

FilterHelper::filterButton()

Same as filterLink() but renders as an icon button instead of a text link.

FilterHelper::filterButton($name, $value, $type, $tip, $section, $icon);
Parameter Type Description
$name string Filter name
$value string Filter value
$type int Content type ID
$tip string Tooltip text
$section object Section object
$icon string Icon filename from media/com_joomcck/icons/16/ (default: funnel-small.png)