I think there are two ways to achieve this: changing CatalogSearch and adding a new block.
Changing CatalogSearch
You can change the Result Block, adding a cms search to the query, union it or just add the results to the result array afterwards. However you do it, you have to take care of the difference between cms page and product results.
To change the catalogSearch I think the best starting point is the Mage_CatalogSearch_Model_Resource_Fulltext_Collection
. The big problem is differ between a product and a cms page. Maybe it is a good idea to extend the Mage_Catalog_Model_Product
class, use it in the collection to initialize new collection items and have a method to distinguish between products and cms pages.
Then you can just check in the block for $item->getType()
or something and handle the output accordingly.
This are just a few ideas, I have no idea wether it works this way. Good luck in trying and please report back!
Adding a second block
You can implement a second block under/over the product search results which searches in the cms pages. Depending on the size of cms pages an index might be a good idea but normal it is not needed, I think.
If you need further informations, tell me, then I'll write more with a better device than an ipad and source code by hand.
Displaying two product collections on one page is certainly possible, though you will have to take care of a few things that the pager works correctly.
First, both toolbar and both pager blocks need to have different names, otherwise both will use the same block instance, rendering the same html.
Then you will need to create your own toolbar class which extends from catalog/product_list_toolbar
for the second list, and set different values for $_pageVarName
, $_orderVarName
, $_directionVarName
, $_modeVarName
and $_limitVarName
.
Alternatively you could hack something with reflection to modify the protected properties, but I advise agains that.
If you use the same toolbar class for both toolbar blocks, they won't know which one should apply a given sorting or ordering. Both will always use the same values, unless they use different HTTP query parameter names.
Thats all, otherwise you should be all good.
Best Answer
Add the change of the template to your local.xml