0

The default search functionality in Magento doesn't seem to offer the 'AND' operator when searching by multiple categories. Hence drilling down a search result by one category and then another doesn't give the desired results. I've figured this is something at the core of the Magento and not an configurable option but don't know where to look to try and alter the operator for this.

1 Answer 1

1

A rewrite of the following class is needed:

Mage_CatalogSearch_Model_Resource_Fulltext

Replace

$likeCond = '(' . join(' OR ', $like) . ')';

with

$likeCond = '(' . join(' AND ', $like) . ')';

See: https://github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php#L355

There is a free extension called Activo_CatalogSearch which implements this rewrite, but it comes with additional advertising. Take a look how they did it (it's a proper rewrite, no core hack and no copy in app/code/local), but you could as well do this by yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.