Plugin: Faceted navigation - custom sort position
Other versions of this plugin may exist. Please ensure you are viewing the documentation for the version that you are currently using. If you are not running the latest version of your plugin we recommend upgrading. See: list of all available versions of this plugin. |
Purpose
This plugin enables you to define the sort order of specified categories at the start and end of the category sort order, with the unspecified categories being sorted by the standard sort options.
Usage
-
Enable the plugin
Enable the facets-custom-sort-position plugin on your results page from the Extensions screen in the administration dashboard or add the following results page configuration to enable the plugin.
plugin.facets-custom-sort-position.enabled=true plugin.facets-custom-sort-position.version=1.0.0
-
Apply custom sorting in the faceted navigation configuration
Edit your faceted navigation configuration for that facet that you wish to apply the defined sort order to.
The sorting method is set using the category sort options. To apply your custom sort, choose custom at the level you wish to apply your custom sort.
e.g. to sort using the custom sort then have the remainder sort alphabetically
-
set first sort by to custom
-
set and then sort by to Label (A-Z)
-
-
Configure the plugin
The following options can be set in the results page configuration to configure the plugin:
-
plugin.facets-custom-sort-position.config.<facet_name>.order.first
: Defines the list of categories, pipe-delimited, to place at the top of the listed facet categories. -
plugin.facets-custom-sort-position.config.<facet_name>.order.last
: Defines the list of categories, pipe-delimited, to place at the bottom of the listed facet categories.
where:
-
<facet_name>
is the facet containing the category that is to be reordered.
-
Examples
Define a custom sort order
Consider the State
facet, which contains categories consisting of Australian states and territories: NT
NSW
WA
Vic
ACT
Tas
SA
Qld
. You wish to order these by population.
Enabling the plugin, applying custom sort to the State facet and setting:
plugin.facets-custom-sort-position.config.State.order.last=NSW|Vic|Qld|WA|SA|Tas|ACT|NT
results in sorting of the categories from most to least populous: NSW
Vic
Qld
WA
SA
Tas
ACT
NT
.
Provide and A-Z facet with an all option
Consider you have a facet that provides and A-Z filter with an all option. You wish to present the A-Z options in alphabetical order followed by numbers, and place the all option as the first option.
Enabling the plugin, applying custom sort to the AZ facet and setting:
plugin.facets-custom-sort-position.config.AZ.order.first=All
plugin.facets-custom-sort-position.config.AZ.order.last=0-9
will result in the following order: All
A
B
C
… X
Y
Z
0-9
If you wish the all option to be presented last then you can set:
plugin.facets-custom-sort-position.config.AZ.order.last=0.9|All
which will result in the following order: A
B
C
… X
Y
Z
0-9
All