Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How do I perform an OR search instead of the default AND search? 
 
Lightsource Media
Jr. Member
 
Total Posts:  5
Joined:  2009-01-22
 

I have tried to solve this one for a couple of days but need to hold my hands up and ask for help…

I need to call the search facility from an external script and pass to it several (probably 3 or 4 max) part numbers and I want the search results to display every product whose part number matches (exactly) ANY of those.  (the part number attribute is quick search enabled).

The product numbers are just a few digits long, no spaces.  Very simple, eg 054, 8D40G, 087R etc

If I pass the following search query:

index.php/catalogsearch/result/?q=054+055

I want it to cough up all the products whose part number is 054 OR 055.
At the moment it returns no matches as it is looking for both 054 AND 055.
(As far as I’m aware there is no alternative way of forming the search query to give an OR search?)

I installed the EnhancedSearch extension by Hytechit which improves the standard search by allowing the terms to be in any order, but it still performs an AND search, not an OR search.

Perhaps there is a simple way of modifying this extension?
I’ve taken a look at the code for it but can’t figure out where it does the relevant bit (the regexp stuff is over my head).

Any help will be gratefully received…

(I wasn’t sure whether to post this here or in the programming section...)

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