Question

Does anyone have any idea where I would start regarding having CMS pages show up in search results, not just products on the front end? I know you can do a redirect with a keyword, but I don't want to do that. I want the CMS page to actually show up in the search results.

Was it helpful?

Solution

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.

OTHER TIPS

If you need o search for CMS pages in the search result, you can try this free extension - Magento Free Text Search: http://www.magebuzz.com/free-magento-extensions.html It also has search suggest feature and you can configure the module to search for some product description.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top