Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Advanced Attribute Search to use AND?


Recommended Posts

Hi, I am using the Advanced Attribute Search contribution (http://www.oscommerce.com/community/contributions,2337/) which adds drop down boxes to the advanced search page and pulls in the search options from the product attributes set up in the system.


I was wondering if anyone knows how to set this up so it displays results using the AND operator, rather than OR?


For example I have 3 attribute sets: type, size and colour.


If I select type->1 and colour->blue on the search page, the results returned are all type 1 products regardless of their colour, together with all blue products regardless of their type.


I would like this to return only products that have both attributes (ie. only type 1 products that are blue) but I can't work it out...


Any help would be greatly appreciated. Thanks.

Link to comment
Share on other sites

  • 2 years later...

I'm having the exact same problem with that contribution.


Like the original poster I have three attributes, but instead of reporting back products that match ALL three selected attributes, it lists all the products that have EITHER attribute a, OR b, OR c.



I'm not 100% sure, but I think this is the relevant part of the MySQL select from .... where...query:


pa.products_id = p.products_id and pa.options_values_id in (33,71,91)


The PHP code is posted in this thread:



Any help/suggestions would be greatly appreciated. Thanks a lot!!!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...