dddirk Posted May 4, 2008 Share Posted May 4, 2008 hi guys i'm running a shop with presta version 0.9.7 i've noticed that in the database there is a table to save the searchs the user starts in you shop. unfortunately this feature seems not ready yet but with very little tweak your shop will do this task step 1: change the ps_search table to autoincrement the id column ALTER TABLE `ps_search` CHANGE `id_search` `id_search` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT step 2: add this little line of code after $smarty->assign('query', $query); in the file search.php in the root dir DB::getInstance()->autoExecute(_DB_PREFIX_.'search', array('keyword'=>$query, 'results'=>$nbProducts, 'date'=>date('Y-m-d H:i:s')), 'INSERT'); ready! dont forget to backup your data before you try it for yourself. hope that helps. Link to comment Share on other sites More sharing options...
andrew Posted June 6, 2008 Share Posted June 6, 2008 Great tip d:rk Pity since upgrading to RC3 I cannot get the search to return the correct data any more - but at least I can see what people were searching for - even if they can't find it :-( I guess this will be added to the standard functionality soon. It would also be nice to see whether the search was from the search bar or the tag cloud (where the search does work - even with the same search string) as the search is actually coded twice. - Andrew www.brilliantbikes.co.uk Link to comment Share on other sites More sharing options...
andrew Posted September 2, 2008 Share Posted September 2, 2008 Now that there are also tags (as well as the search) I have added slightly to this functionality.I have added 2 columns to the ps_search table:id_lang - type int - to store the language being searchedsearch_type - type varchar - to store the type of search (there are three types now - search, tag and ref)In the search.php change the code in the three places:For search: DB::getInstance()->autoExecute(_DB_PREFIX_.'search', array('keyword'=>$query, 'results'=>$nbProducts, 'date'=>date('Y-m-d H:i:s'),'id_lang'=>(intval($cookie->id_lang)), 'search_type'=>"search"), 'INSERT'); For tag: DB::getInstance()->autoExecute(_DB_PREFIX_.'search', array('keyword'=>$tag, 'results'=>$nbProducts, 'date'=>date('Y-m-d H:i:s'),'search_type'=>"tag",'id_lang'=>(intval($cookie->id_lang))), 'INSERT'); For ref: DB::getInstance()->autoExecute(_DB_PREFIX_.'search', array('keyword'=>$query, 'results'=>$nbProducts, 'date'=>date('Y-m-d H:i:s'),'search_type'=>"ref",'id_lang'=>(intval($cookie->id_lang))), 'INSERT'); And you will have a table showing what searches were mad on your site - and whether they came from the search box or a tag click.Good luck.- Andrew Link to comment Share on other sites More sharing options...
cloudseat Posted June 7, 2009 Share Posted June 7, 2009 Anyway to use this data to populate the Tags Block? It would be nice to have a Cloud Block containing the most popular search keywords. Link to comment Share on other sites More sharing options...
pneeds Posted June 7, 2009 Share Posted June 7, 2009 How do you view all these files?????I use FastHost, would it be in Mysql? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now