This one work but is there a better way than this one or it's good

   ->addAttributeToFilter('promo', array('notnull'=>true))
  • 1
    whats the problem with that, you can try this to $_products->addAttributeToFilter('promo', array('neq' => '')); – Murtuza Zabuawala Feb 6 '17 at 10:47
  • Thank you for your replay, there is no problem, I just wanted to make sure if there is a better way than mine. – PЯINCƏ Feb 6 '17 at 10:49

Given that it is an EAV collection (for example product collection), and "promo" is a custom attribute, and you want to filter all entities where this attribute is not null:

This is the right way.

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.