// Normalize blocksearch + remove left / right hook during install

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9993 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie committed 2011-11-09 15:12:04 +00:00
1 parent 047efe3e72
commit cff850ed51
1 file changed
+14 -18
+14 -18
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -39,17 +39,14 @@ class BlockSearch extends Module
$this->need_instance = 0; $this->need_instance = 0;
parent::__construct(); parent::__construct();
$this->displayName = $this->l('Quick Search block'); $this->displayName = $this->l('Quick Search block');
$this->description = $this->l('Adds a block with a quick search field.'); $this->description = $this->l('Adds a block with a quick search field.');
} }
public function install() public function install()
{ {
if (!parent::install() OR !$this->registerHook('top') if (!parent::install() || !$this->registerHook('top'))
OR !$this->registerHook('leftColumn')
OR !$this->registerHook('rightColumn')
)
return false; return false;
return true; return true;
} }
@@ -62,36 +59,35 @@ class BlockSearch extends Module
public function hookRightColumn($params) public function hookRightColumn($params)
{ {
$this->_hookCommon($params); $this->calculHookCommon($params);
return $this->display(__FILE__, 'blocksearch.tpl'); return $this->display(__FILE__, 'blocksearch.tpl');
} }
public function hookTop($params) public function hookTop($params)
{ {
$this->_hookCommon($params); $this->calculHookCommon($params);
return $this->display(__FILE__, 'blocksearch-top.tpl'); return $this->display(__FILE__, 'blocksearch-top.tpl');
} }
/** /**
* _hookAll has to be called in each hookXXX methods. This is made to avoid code duplication. * _hookAll has to be called in each hookXXX methods. This is made to avoid code duplication.
* *
* @param mixed $params * @param mixed $params
* @return void * @return void
*/ */
private function _hookCommon($params) private function calculHookCommon($params)
{ {
$this->context->smarty->assign('ENT_QUOTES', ENT_QUOTES); $this->context->smarty->assign('ENT_QUOTES', ENT_QUOTES);
$this->context->smarty->assign('search_ssl', Tools::usingSecureMode()); $this->context->smarty->assign('search_ssl', Tools::usingSecureMode());
$ajaxSearch=(int)(Configuration::get('PS_SEARCH_AJAX'));
$this->context->smarty->assign('ajaxsearch', $ajaxSearch);
$instantSearch = (int)(Configuration::get('PS_INSTANT_SEARCH')); $ajax_search = (int)Configuration::get('PS_SEARCH_AJAX');
$this->context->smarty->assign('instantsearch', $instantSearch); $this->context->smarty->assign('ajaxsearch', $ajax_search);
if ($ajaxSearch)
$instant_search = (int)(Configuration::get('PS_INSTANT_SEARCH'));
$this->context->smarty->assign('instantsearch', $instant_search);
if ($ajax_search)
$this->context->controller->addJqueryPlugin('autocomplete'); $this->context->controller->addJqueryPlugin('autocomplete');
$this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css'); $this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css');
$this->context->controller->addCSS(($this->_path).'blocksearch.css', 'all'); $this->context->controller->addCSS(($this->_path).'blocksearch.css', 'all');
return true;
} }
} }