From a9c878f07e2646a982a78ae3c9bbf85634f55099 Mon Sep 17 00:00:00 2001 From: Robin Sheat Date: Mon, 14 Jun 2010 11:17:57 +1200 Subject: [PATCH] bug4891 - sort facets in search sidebar --- 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