0

I'd like to add multiple addFieldToFilter to my filter.

This is what I currently have:

$cards = Mage::getModel('giftcards/giftcards')->getCollection()
               ->addFieldToFilter('order_id', $order->getId());
$cards = Mage::getModel('giftcards/giftcards')->getCollection()
               ->AddFieldToFilter('gc_sent', false);

Is this the right way to do this? Or should I be doing it another way?

Thank you.

Pradeep
  • 9,667
  • 13
  • 27
  • 34
James
  • 529
  • 1
  • 7
  • 16
  • https://stackoverflow.com/questions/3826474/magento-addfieldtofilter-two-fields-match-as-or-not-and <- something like that? – CD001 Oct 17 '17 at 14:56

1 Answers1

1

You can use multiple filter like below

$cards = Mage::getModel('giftcards/giftcards')->getCollection()
              ->addFieldToFilter('order_id', $order->getId())
              ->addFieldToFilter('gc_sent', false)
              ->addFieldToFilter('other_field', 'value');
Piyush
  • 457
  • 7
  • 18