0

I want to read to top 10 search terms from magento. This works:

$items = Mage::getModel( 'catalogsearch/query' )
    ->getCollection()
    ->setOrder("popularity")
    ->setPageSize( 10 )
    ->getItems();

foreach ( $items as $item )
{
    echo sprintf("%s\n", $item->getQueryText());
}

But how can I get the results for each store-id?

2

Just Add setStoreId in your code.

i.e,

$items = Mage::getModel( 'catalogsearch/query' )
    ->getCollection()
    ->setOrder("popularity")
    ->setPageSize(10)
    ->setStoreId(1) //your store id
    ->getItems();

Refer this file

| improve this answer | |
  • That was my first guess, but the results are the same for every storeId – Thomas W Sep 28 '15 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.