addAttributeToFilter with mutiselect values
-
13-12-2019 - |
Question
I have to apply filter on base of field "status", which is multi select.i.e if I have to filter for following values "Closed,Completed,On Hold",I tied following
$orderCollection = Mage::getModel('sales/order')->getCollection();
$orderCollection->addAttributeToFilter('status', array('in' => array('Closed','Completed','On Hold')));
This is not working,
Solution
use
$orderCollection = Mage::getModel('sales/order')->getCollection()
->addFieldToFilter('status', array('in' => array('closed','complete','holded')));
OTHER TIPS
You can use collection field filter:
$orderCollection->addFieldToFilter('status', array('in' => array('closed','completed','holded')));
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange