From 6eb881bc4c35d67f326506b8fc29dbf04b2d2a97 Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Thu, 27 Oct 2011 16:31:56 +0000 Subject: [PATCH] [*] BO : #PSFV-94 - added AdminSearchConfController git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9691 b9a71923-0436-4b27-9f14-aed3839534dd --- .../admin/AdminSearchConfController.php | 73 ++++++++----------- 1 file changed, 31 insertions(+), 42 deletions(-) rename admin-dev/tabs/AdminSearchConf.php => controllers/admin/AdminSearchConfController.php (70%) diff --git a/admin-dev/tabs/AdminSearchConf.php b/controllers/admin/AdminSearchConfController.php similarity index 70% rename from admin-dev/tabs/AdminSearchConf.php rename to controllers/admin/AdminSearchConfController.php index 7c2c859ea..448af1147 100644 --- a/admin-dev/tabs/AdminSearchConf.php +++ b/controllers/admin/AdminSearchConfController.php @@ -1,6 +1,6 @@ className = 'Configuration'; $this->table = 'configuration'; - + parent::__construct(); - - $this->optionsList = array( + + $currentFileName = array_reverse(explode("/", $_SERVER['SCRIPT_NAME'])); + $cron_url = Tools::getHttpHost(true, true).__PS_BASE_URI__.substr($_SERVER['SCRIPT_NAME'], strlen(__PS_BASE_URI__), -strlen($currentFileName['0'])).'searchcron.php?full=1&token='.substr(_COOKIE_KEY_, 34, 8); + list($total, $indexed) = Db::getInstance()->getRow('SELECT COUNT(*) as "0", SUM(indexed) as "1" FROM '._DB_PREFIX_.'product'); + + $this->options = array( + 'indexation' => array( + 'title' => $this->l('Indexation'), + 'icon' => 'search', + 'info' => + $this->l('The "indexed" products have been analysed by PrestaShop and will appear in the results of the front office search.').'
+ '.$this->l('Indexed products:').' '.(int)($indexed).' / '.(int)($total).'. +

+

'.$this->l('Building the product index can take a few minutes or more. If your server stop the process before it ends, you can resume the indexation by clicking "Add missing products".').'

+ -> '.$this->l('Add missing products to index.').'
+ -> '.$this->l('Re-build entire index.').'

+ '.$this->l('You can set a cron job that will re-build your index using the following URL:').' '.$cron_url.'' + ), 'search' => array( 'title' => $this->l('Search'), 'icon' => 'search', @@ -49,6 +63,15 @@ class AdminSearchConf extends AdminPreferences 'PS_SEARCH_MINWORDLEN' => array('title' => $this->l('Minimum word length'), 'desc' => $this->l('Only words from this size will be indexed.'), 'size' => 4, 'validation' => 'isUnsignedInt', 'type' => 'text', 'cast' => 'intval'), 'PS_SEARCH_BLACKLIST' => array('title' => $this->l('Blacklisted words'), 'size' => 35, 'validation' => 'isGenericName', 'desc' => $this->l('Please enter the words separated by a "|".'), 'type' => 'textLang') ), + 'submit' => array() + ), + 'relevance' => array( + 'title' => $this->l('Relevance'), + 'icon' => 'search', + 'info' => + $this->l('The "weight" represents its importance and relevance for the ranking of the products when try a new search.').'
+ '.$this->l('A word with a weight of 8 will have 4 times more value than a word with a weight of 2.').'

+ '.$this->l('That\'s why we advize to set a greater weight for words which appear in the name or reference of a products than the ones of the description of category name. Thus, the search results will be as precised and releant as possible.') ), 'weight' => array( 'title' => $this->l('Weight'), @@ -65,42 +88,8 @@ class AdminSearchConf extends AdminPreferences 'PS_SEARCH_WEIGHT_ATTRIBUTE' => array('title' => $this->l('Attributes weight'), 'size' => 4, 'validation' => 'isUnsignedInt', 'type' => 'text', 'cast' => 'intval'), 'PS_SEARCH_WEIGHT_FEATURE' => array('title' => $this->l('Features weight'), 'size' => 4, 'validation' => 'isUnsignedInt', 'type' => 'text', 'cast' => 'intval') ), + 'submit' => array() ), ); } - - public function displayTopOptionCategory($category, $categoryData) - { - switch ($category) - { - case 'search' : - $currentFileName = array_reverse(explode("/", $_SERVER['SCRIPT_NAME'])); - $cronUrl = Tools::getHttpHost(true, true).__PS_BASE_URI__.substr($_SERVER['SCRIPT_NAME'], strlen(__PS_BASE_URI__), -strlen($currentFileName['0'])).'searchcron.php?full=1&token='.substr(_COOKIE_KEY_, 34, 8); - list($total, $indexed) = Db::getInstance()->getRow('SELECT COUNT(*) as "0", SUM(indexed) as "1" FROM '._DB_PREFIX_.'product'); - echo '
- '.$this->l('Indexation').' -

- '.$this->l('The "indexed" products have been analysed by PrestaShop and will appear in the results of the front office search.').'
- '.$this->l('Indexed products:').' '.(int)($indexed).' / '.(int)($total).'. -

-

'.$this->l('Building the product index can take a few minutes or more. If your server stop the process before it ends, you can resume the indexation by clicking "Add missing products".').'

- -> '.$this->l('Add missing products to index.').'
- -> '.$this->l('Re-build entire index.').'

- '.$this->l('You can set a cron job that will re-build your index using the following URL:').' '.$cronUrl.'. -
-
 
'; - break; - - case 'weight' : - echo '
 
-
- '.$this->l('Relevance').' - '.$this->l('The "weight" represents its importance and relevance for the ranking of the products when try a new search.').'
- '.$this->l('A word with a weight of 8 will have 4 times more value than a word with a weight of 2.').'

- '.$this->l('That\'s why we advize to set a greater weight for words which appear in the name or reference of a products than the ones of the description of category name. Thus, the search results will be as precised and releant as possible.').' -
-
 
'; - break; - } - } }