An error occurred while loading the file. Please try again.
-
* Style the advanced search while keeping the old template unchanged (for now). Multi-selects are handled via the already included SlimSelect scripts. * Add `role="main"` to `main`, which seems redundant, but is required by the Bootstrap theme's advanced search JS, otherwise the search group inputs are missing. * Always display the (simple) search box in the header, even on the advanced search page. * fix type inputs ** Remove SlimSelect from type inputs; ** these fields are cloned, which removes the required handlers. Since they only contain 10 options, they work well without a filter. * add info box ** Display an info box above the search results with an edit link when advanced search is active. * hide range slider
5432d9c7
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
results.phtml 7.35 KiB
<!-- fid_bbi: search - results -->
<?php
$lookfor = $this->results->getUrlQuery()->isQuerySuppressed() ? '' : $this->params->getDisplayQuery();
$recordTotal = $this->results->getResultTotal();
if (isset($this->overrideTitle)) {
$title = $this->overrideTitle;
} elseif (empty($lookfor)) {
$title = $this->transEsc('Search');
} else {
$title = $this->transEsc('Search: %%lookfor%%', ['%%lookfor%%' => $lookfor]);
}
$this->headTitle($title);
$this->layout()->searchbox = $this->context($this)->renderInContext(
'search/searchbox.phtml',
['lookfor' => $lookfor]
);
// Enable cart if appropriate
$this->showBulkOptions = $this->params->getOptions()->supportsCart() && $this->showBulkOptions;
// Checkboxes if appropriate
$this->showCartControls = $this->params->getOptions()->supportsCart() && $this->cart()->isActive()
&& ($this->showBulkOptions || !$this->cart()->isActiveInSearch());
// Enable bulk options if appropriate
$this->showCheckboxes = $this->showCartControls || $this->showBulkOptions;
// Load scripts required for sticky actions/filter sidebar
$this->headScript()->appendFile('../js/vendor/css-element-queries/src/ResizeSensor.js');
$this->headScript()->appendFile('../js/vendor/sticky-sidebar/dist/sticky-sidebar.min.js');
// TODO: Are we still using those?
if ($this->params->getOptions()->getListViewOption() !== 'full') {
$this->headScript()->appendFile("record.js");
$this->headScript()->appendFile("embedded_record.js");
}
// TODO: Are we still using those?
// Load Javascript dependencies into header
$this->headScript()->appendFile("vendor/hunt.min.js");
$this->headScript()->appendFile("check_item_statuses.js");
$this->headScript()->appendFile("check_save_statuses.js");
?>
<div class="results" id="sidebar-container">
<h1 class="sr-only"><?=$this->transEsc('Search Results')?></h1>
<button
class="results_sidebar-toggle"
type="button"
aria-controls="sidebar"
aria-label="<?=$this->transEsc('Show functions & filters')?>"
>
<?=$this->icon('small/filter')?>
<span><?=$this->transEsc('Functions & Filters')?></span>
</button>
<div class="results_list">
<h2 class="sr-only"><?=$this->translate('Search Results')?></h2>
<?=$this->flashmessages()?>
<div class="results_header">
<?=$this->render('search/advanced-search-info.phtml');?>
<div class="results_count">
<?=$this->translate('%%count%% results', ['%%count%%' => $this->localizedNumber($recordTotal)])?>
</div>
<?=$this->render('search/controls/sort.phtml')?>
</div>
<?php if (!$recordTotal): ?>
<p>
<?php if (isset($this->overrideEmptyMessage)): ?>
<?=$this->overrideEmptyMessage?>
<?php else: ?>
<?php $this->layout()->srmessage = $this->translate('nohit_lookfor_html', ['%%lookfor%%' => $this->escapeHtml($lookfor)]); ?>
<?=$this->layout()->srmessage?>
<?php endif; ?>
</p>
<?php if (isset($this->parseError)): ?>
<p class="alert alert-danger"><?=$this->transEsc('nohit_parse_error')?></p>
<?php endif; ?>
<?php foreach (($top = $this->results->getRecommendations('top')) as $index => $current): ?>
<?=$this->recommend($current, 'top', $index)?>
<?php endforeach; ?>
<?php foreach ($this->results->getRecommendations('noresults') as $index => $current): ?>
<?php if (!in_array($current, $top)): ?>
<?=$this->recommend($current, 'noresults', $index)?>
<?php endif; ?>
<?php endforeach; ?>
<?php else: ?>
<?php if ($this->results->getPaginator()->getCurrentPageNumber() > 1): ?>
<?=$this->paginationControl(
$this->results->getPaginator(),
'Sliding',
'search/pagination.phtml',
['results' => $this->results, 'options' => $this->paginationOptions ?? []]
)?>
<?php endif; ?>
<?=$this->render('search/list-' . $this->params->getView() . '.phtml')?>
<?=$this->paginationControl(
$this->results->getPaginator(),
'Sliding',
'search/pagination.phtml',
['results' => $this->results, 'options' => $this->paginationOptions ?? []]
)?>
<?php endif; ?>
</div>
<div id="sidebar" class="sidebar">
<div class="sidebar_header">
<h2><?=$this->transEsc('Functions & Filters')?></h2>
<button
class="-icon-only -small"
type="button"
aria-controls="sidebar"
aria-label="<?=$this->transEsc('Close functions & filters')?>"
>
<?=$this->icon('small/x')?>
<span class="sr-only"><?=$this->transEsc('Close')?></span>
</button>
</div>
<div id="sidebar-inner" class="sidebar_inner">
<?php if ($recordTotal > 0): ?>
<div class="results_actions">
<?php // TODO: Content linked could still be broken, including lightboxes ?>
<?php $cart = $this->cart(); ?>
<?php if ($cart->isActive()): ?>
<a
id="cartItems"
href="<?=$this->url('cart-home')?>"
data-lightbox
>
<?=$this->icon('small/pin')?>
<?=$this->transEsc('Book Bag')?>
<?php // NOTE: Pin count updated via JS, must be <strong> ?>
(<strong><?=count($cart->getItems())?></strong>)
</a>
<?php endif; ?>
<a href="<?=$this->url('myresearch-favorites')?>">
<?=$this->icon('small/star')?>
<?=$this->transEsc('Favorites')?>
</a>
<a href="<?=$this->results->getUrlQuery()->setViewParam('rss')?>">
<?=$this->icon('small/rss')?>
<?=$this->transEsc('RSS Feed')?>
</a>
<a
id="mailSearch<?=$this->escapeHtmlAttr($this->results->getSearchId())?>"
href="<?=$this->url('search-email')?>"
data-lightbox
>
<?=$this->icon('small/mail')?>
<?=$this->transEsc('Email')?>
</a>
<a
href="<?=$this->url('search-history')?>"
data-lightbox
>
<?=$this->icon('small/clock')?>
<?=$this->transEsc('History')?>
</a>
<?php if ($this->accountCapabilities()->getSavedSearchSetting() === 'enabled'): ?>
<?php if (is_numeric($this->results->getSearchId())): ?>
<?php if ($this->results->isSavedSearch()): ?>
<a href="<?=$this->url('myresearch-savesearch')?>?delete=<?=urlencode($this->results->getSearchId())?>">
<?php // TODO: Change icon? ?>
<?=$this->icon('small/save')?>
<?=$this->transEsc('Remove')?>
</a>
<?php else: ?>
<a href="<?=$this->url('myresearch-savesearch')?>?save=<?=urlencode($this->results->getSearchId())?>">
<?=$this->icon('small/save')?>
<?=$this->transEsc('Save')?>
</a>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
</div>
<?php foreach ($this->results->getRecommendations('top') as $index => $current): ?>
<?=$this->recommend($current, 'top', $index)?>
<?php endforeach; ?>
<?php endif; ?>
<?php foreach ($this->results->getRecommendations('side') as $index => $current): ?>
<?=$this->recommend($current, 'side', $index)?>
<?php endforeach; ?>
</div>
</div>
</div>
<!-- fid_bbi: search - results - END -->