Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Popular Searches In Magento

Tags:

magento

I want to display the top 10 searches on my Magento store. Magento already stores searches made on the store under Admin > Catalog > Search Terms, so it's just a matter of getting it into my view. Does anyone know which helper or function I can access to get this list?

like image 986
cappuccino Avatar asked Feb 24 '23 17:02

cappuccino


1 Answers

You have a setPopularQueryFilter method in the class Mage_CatalogSearch_Model_Mysql4_Query_Collection, after that you only have to set a limit I guess :)

Without trying, it should be something like that :

$searchCollectino=Mage::getModel('catalogsearch/query')->getCollection()
     ->setPopularQueryFilter()
     ->setPageSize($limit);
like image 189
haltabush Avatar answered Mar 05 '23 21:03

haltabush