1

ホームページで人気の検索語を取得する方法 ??

次の質問を参照し ました:Magentoで人気のある検索を取得する

したがって、以下のコードと同じコードを使用しました。

$searchCollectino=Mage::getModel('catalogsearch/query')->getCollection()
 ->setPopularQueryFilter()
 ->setPageSize($limit);

彼らは、 ->getItems() を使用して検索語を取得できると言いました。

しかし、コードが正確に何であるかがわかりません..??

このコードの使い方??

4

2 に答える 2

3

次のコードで上位 5 の人気検索語を取得しました :

$searchCollection = Mage::getModel('catalogsearch/query')->getCollection()
 ->setOrder('popularity', 'DESC');
$searchCollection->getSelect()->limit(8);
foreach ($searchCollection as $item)
{  
    echo $item->getData('redirect');
    echo $item->getData('query_text');
}
于 2013-04-29T15:00:50.290 に答える
1
`$searchCollection = Mage::getModel('catalogsearch/query')->getCollection()
 ->setOrder('popularity', 'DESC');
 $searchCollection->getSelect()->limit(5);
 $searchCollection->getItems();`

これにより、人気のある検索が制限付きで取得されます

楽しんでくれると良いです :)

于 2013-04-25T19:57:20.177 に答える