7

I'm stuck with this situation:

I have 2 select-type attributes: A and B for example In both of the attributes, I have the same list of Options (but they are different option ids)

For example In attribute A, I have these options: Option_1, option id = 1 Option_2, option id = 2 Option_3, option id = 3

In attribute A, I have these options: Option_1, option id = 4 Option_2, option id = 5 Option_3, option id = 6

Now I have this advanced search query for "Option_1": http://domain/catalogsearch/advanced/result/?A[]=1&B[]=3 But what I want is:

The Product 1 (has A = Option 1, with id 1) The Product 2 (has B = Option 1, with id 4)

Because advanced search use "AND" then this return zero result.

Can it use "OR" to return both Product 1 and Product 2? Or any solution for my situation?

Maybe this also the search Query is ?A[]=1, but it still return the product which has B[]=4

I hope this question is clear.

1

1 Answer 1

0

First copy this file in your code/local with same directory structure app/code/core/Mage/CatalogSearch/Model/Resource/Advanced/Collection.php

Then Replace this code :

if (!is_null($previousSelect)) {
    $select->where('t1.entity_id IN (?)', new Zend_Db_Expr($previousSelect));
}

With (change where => orWhere) :

if (!is_null($previousSelect)) {
    $select->orWhere('t1.entity_id IN (?)', new Zend_Db_Expr($previousSelect));
}
1
  • Looks as though you've given an answer for Magento 1.x, not 2.x. While this would work there, it wouldn't in OP's case. Feb 4, 2020 at 17:54

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.