2017-10-17 37 views
0

我想添加多个addFieldToFilter到我的过滤器。Magento multiple addFieldToFilter?

这是我目前有:

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

这是这样做的正确方法?或者我应该以另一种方式去做吗?

谢谢。

+0

https://stackoverflow.com/questions/3826474/magento-addfieldtofilter-two-fields-match-as-or-not-and < - 像那? – CD001

回答

1

您可以使用多个过滤器像下面

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