Posts

Showing posts with the label Custom Query

Magento Collection Query with AND / OR Operators

For those who are new with magento, below post will help them to understand that how  AND & OR operator  should work with Magento to fetch Collection from Database Please Note: A. I am assuming that you are aware about Magento Model. B. In below Examples, lets considered  $salesorderid =9; Ex:1 - Magento SQL Query with - OR Operator $outstandingCollection= Mage::getModel('adminhtmlmodule/adminhtmlmodule')->getCollection()->addFieldToSelect('salesorderid');                 $outstandingCollection->addFieldToFilter(array('salesorderid','paystatus'), array(                   array('salesorderid','eq'=>$salesorderid),                   array('paystatus','eq'=>'0')      ...