[Koha-patches] [PATCH] bug4891 - sort facets in search sidebar
Robin Sheat
robin at catalyst.net.nz
Thu Jul 1 06:49:16 CEST 2010
---
catalogue/search.pl | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/catalogue/search.pl b/catalogue/search.pl
index 920afb7..42f269a 100755
--- a/catalogue/search.pl
+++ b/catalogue/search.pl
@@ -499,6 +499,12 @@ if (C4::Context->preference('NoZebra')) {
($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
};
}
+# This sorts the facets into alphabetical order
+if ($facets) {
+ foreach my $f (@$facets) {
+ $f->{facets} = [ sort { uc($a->{facet_title_value}) cmp uc($b->{facet_title_value}) } @{ $f->{facets} } ];
+ }
+}
if ($@ || $error) {
$template->param(query_error => $error.$@);
output_html_with_http_headers $cgi, $cookie, $template->output;
--
1.7.0.4
More information about the Koha-patches
mailing list