Index: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r3826 -r3851 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 3826) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 3851) @@ -583,6 +583,24 @@ } /** + * Make record to search log + * + * @param string $keywords + * @param int $search_type 0 - simple search, 1 - advanced search + */ + function saveToSearchLog($keywords, $search_type = 0) + { + $sql = 'UPDATE '.TABLE_PREFIX.'SearchLog + SET Indices = Indices + 1 + WHERE Keyword = '.$this->Conn->qstr($keywords).' AND SearchType = '.$search_type; // 0 - simple search, 1 - advanced search + $this->Conn->Query($sql); + if ($this->Conn->getAffectedRows() == 0) { + $fields_hash = Array('Keyword' => $keywords, 'Indices' => 1, 'SearchType' => $search_type); + $this->Conn->doInsert($fields_hash, TABLE_PREFIX.'SearchLog'); + } + } + + /** * Makes simple search for products * based on keywords string * @@ -622,7 +640,9 @@ } $this->Application->StoreVar('keywords', $keywords); - + + $this->saveToSearchLog($keywords, 0); // 0 - simple search, 1 - advanced search + $keywords = strtr($keywords, Array('%' => '\\%', '_' => '\\_')); $event->setPseudoClass('_List');