Skip to content
Snippets Groups Projects
Commit a73b5020 authored by Demian Katz's avatar Demian Katz
Browse files

Smarter cart support in combined controller.

parent e6607e52
Branches issue/20714
No related merge requests found
...@@ -131,9 +131,13 @@ class CombinedController extends AbstractSearch ...@@ -131,9 +131,13 @@ class CombinedController extends AbstractSearch
->get('VuFind\SearchOptionsPluginManager'); ->get('VuFind\SearchOptionsPluginManager');
$config = $this->getServiceLocator()->get('VuFind\Config')->get('combined') $config = $this->getServiceLocator()->get('VuFind\Config')->get('combined')
->toArray(); ->toArray();
$supportsCart = false;
foreach ($config as $current => $settings) { foreach ($config as $current => $settings) {
$this->adjustQueryForSettings($settings); $this->adjustQueryForSettings($settings);
$currentOptions = $options->get($current); $currentOptions = $options->get($current);
if ($currentOptions->supportsCart()) {
$supportsCart = true;
}
list($controller, $action) list($controller, $action)
= explode('-', $currentOptions->getSearchAction()); = explode('-', $currentOptions->getSearchAction());
$combinedResults[$current] = $settings; $combinedResults[$current] = $settings;
...@@ -154,7 +158,8 @@ class CombinedController extends AbstractSearch ...@@ -154,7 +158,8 @@ class CombinedController extends AbstractSearch
array( array(
'results' => $results, 'results' => $results,
'params' => $params, 'params' => $params,
'combinedResults' => $combinedResults 'combinedResults' => $combinedResults,
'supportsCart' => $supportsCart,
) )
); );
} }
......
...@@ -63,8 +63,15 @@ ...@@ -63,8 +63,15 @@
<?=$this->recommend($current)?> <?=$this->recommend($current)?>
<? endforeach; ?> <? endforeach; ?>
<? else: ?> <? else: ?>
<? $viewType = in_array('list', array_keys($params->getViewList())) ? 'list' : $params->getView(); ?> <?
<?=$this->render('search/list-' . $viewType . '.phtml', array('results' => $results, 'params' => $params))?> $viewType = in_array('list', array_keys($params->getViewList()))
? 'list' : $params->getView();
$viewParams = array('results' => $results, 'params' => $params);
if (!$params->getOptions()->supportsCart()) {
$viewParams['hideCartControls'] = true;
}
?>
<?=$this->render('search/list-' . $viewType . '.phtml', $viewParams)?>
<? if ($currentSearch['more_link']): ?> <? if ($currentSearch['more_link']): ?>
<p class="pad text-right"><a href="<?=$moreUrl?>"><?=$this->transEsc($currentSearch['more_link'])?> <i class="icon-long-arrow-right"></i></a></p> <p class="pad text-right"><a href="<?=$moreUrl?>"><?=$this->transEsc($currentSearch['more_link'])?> <i class="icon-long-arrow-right"></i></a></p>
<? endif; ?> <? endif; ?>
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
?> ?>
<?=$this->flashmessages()?> <?=$this->flashmessages()?>
<form class="form-inline" method="post" name="bulkActionForm" action="<?=$this->url('cart-home')?>"> <form class="form-inline" method="post" name="bulkActionForm" action="<?=$this->url('cart-home')?>">
<? if ($this->cart()->isActive()): ?> <? if ($this->supportsCart && $this->cart()->isActive()): ?>
<div class="clearfix"> <div class="clearfix">
<?=$this->context($this)->renderInContext('search/bulk-action-buttons.phtml', array('idPrefix' => ''))?> <?=$this->context($this)->renderInContext('search/bulk-action-buttons.phtml', array('idPrefix' => ''))?>
</div> </div>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment