diff --git a/catalogue/search.pl b/catalogue/search.pl index 13b137b1c2..014d4f6e34 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -265,7 +265,12 @@ if ( $template_type eq 'advsearch' ) { my $secondary_servers_loop;# = displaySecondaryServers(); $template->param(outer_sup_servers_loop => $secondary_servers_loop,); - + + # set the default sorting + my $default_sort_by = C4::Context->preference('defaultSortField')."_".C4::Context->preference('defaultSortOrder') + if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder')); + $template->param($default_sort_by => 1); + # determine what to display next to the search boxes (ie, boolean option # shouldn't appear on the first one, scan indexes should, adding a new # box should only appear on the last, etc. diff --git a/opac/opac-search.pl b/opac/opac-search.pl index ddccb84280..e5e916dc8d 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -179,7 +179,12 @@ if ( $template_type eq 'advsearch' ) { my $secondary_servers_loop;# = displaySecondaryServers(); $template->param(outer_sup_servers_loop => $secondary_servers_loop,); - + + # set the default sorting + my $default_sort_by = C4::Context->preference('OPACdefaultSortField')."_".C4::Context->preference('OPACdefaultSortOrder') + if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder')); + $template->param($default_sort_by => 1); + # determine what to display next to the search boxes (ie, boolean option # shouldn't appear on the first one, scan indexes should, adding a new # box should only appear on the last, etc.