0

I have a collection and I want to filter like this: WHERE field1 >= '2020-01-01' OR (field2 == 'open' && $field3 == 1).

How can I achieve that?

1 Answer 1

0

Please try this below way

$collection->addFieldToFilter(
                         array('field1',array(
                                          array('attribute'=>'field2', 'eq' => 'open'), 
                                          array('attribute'=>'field3', 'eq'=>'1')
                                        )
                         ), 
                         array( 
                             array('gteq' => '2020-01-01'),
                         )
                     );
1
  • Thank you, Ritesh Santra.
    – Kloppo
    Aug 6, 2020 at 12:33

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.