bug4891 - sort facets in search sidebar (OPAC and staff client)

Signed-off-by: Nicole Engard <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Robin Sheat 2010-12-16 02:50:08 -05:00 committed by Chris Cormack
parent 396c2143d9
commit 13bc505c5f
2 changed files with 13 additions and 0 deletions

View file

@ -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;

View file

@ -422,6 +422,13 @@ elsif (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} } ];
}
}
# use Data::Dumper; print STDERR "-" x 25, "\n", Dumper($results_hashref);
if ($@ || $error) {
$template->param(query_error => $error.$@);