0

How can i add " AND (at_product_userclass.value IS NULL) OR !FIND_IN_SET('1', at_product_userclass.value)" filter condition using addAttributeToFilter in product collection.

Thanks

1 Answer 1

0

To filter by null values, you can use this:

$collection->addFieldToFilter(
    'name_of_field',
    ['null' => true]
);

To use mysql query in collection, use this:

$collection->where(new \Zend_Db_Expr('[your_sql_expression]'));

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.