Thibault GUILLAUME 25906f0387 header tpl
2015-07-08 12:43:37 +02:00

38 lines
1.0 KiB
PHP

<?php
class BlockSearchOverride extends BlockSearch
{
public function install() {
if (!parent::install() || !$this->registerHook('displaySearchTop'))
return false;
return true;
}
public function hookdisplaySearchTop($params) {
if (Tools::getValue('search_query') || !$this->isCached('blocksearch.tpl', $this->getCacheId()))
{
$this->calculHookCommon($params);
$this->smarty->assign(array(
'blocksearch_type' => 'block',
'search_query' => (string)Tools::getValue('search_query')
)
);
}
Media::addJsDef(array('blocksearch_type' => 'block'));
return $this->display(__FILE__, 'blocksearch.tpl', Tools::getValue('search_query') ? null : $this->getCacheId());
}
private function calculHookCommon($params) {
$this->smarty->assign(array(
'ENT_QUOTES' => ENT_QUOTES,
'search_ssl' => Tools::usingSecureMode(),
'ajaxsearch' => Configuration::get('PS_SEARCH_AJAX'),
'instantsearch' => Configuration::get('PS_INSTANT_SEARCH'),
'self' => dirname(__FILE__),
));
return true;
}
}