It is required to make additional custom tables ( custom created flat models) search, based on basic search query, if filter input box is checked at the layered filter navigation.

If this was persistent requirement I would override _prepareProductIndex of Mage_CatalogSearch_Model_Resource_Fulltext in my module, to add data from my custom tables into index, but this is optional requirement, and I wonder, how to patch the search query properly ?

I came up with idea to register custom value in Mage::registry in custom filter, and if it exists, make modification to the search query.

Any ideas would be appreciated.


It was required to override Mage_CatalogSearch_Model_Resource_Fulltext and simply add some where conditions in prepareResult method.

Also I have added specific flat table check column in catalogsearch_query and used it to proper selecting of query in overridden Mage_CatalogSearch_Model_Resource_Query::loadByQuery method.

So if the filter is on, it sets the column value in prepareResult and saving it, and selecting from catalogsearch_query in loadByQuery by the value of column (filter status).

| improve this answer | |

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.