Magento Forum

   
Searchresult complete array
 
Daim
Sr. Member
 
Total Posts:  172
Joined:  2008-01-08
Germany
 

At the moment i work with (Mage_Catalog_Block_Product_List) /app/design/frontend/default/default/template/catalog/product/list.phtml
When i start a search is in the Object $_productCollection only 5,10,20 or 50 Products .I now because it’s a Filter on the Frontpage that limit the result collection. But i will code a layer navigation for the hole searchresult and i need all founded products in one array. Where i can find this array?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
wdchoi
Jr. Member
 
Total Posts:  20
Joined:  2008-11-17
 

Hi Daim.

If you launch a simple search, you should go see app/code/core/Mage/CatalogSearch/Model/Query.php.

In it you’ll see the getResultCollection() method. This is the one that will return a product collection object (this is not an array, though you can loop in it with a foreach). If you don’t understand how magento collection objects work, ask me.

I hope you don’t have many products, because if you do, loading the entire collection is not a good thing to do. And even if you don’t have many products, performance will be bad. You should try to find other ways to make your navigation.

David

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top