How to use or mysql condition in $collection data of magento

Magento provide  addAttributeToFilter to use and operator in $collection, But using of OR operator is little bit different . I was guess that there must be and OrAttributeToFilter , But I was wrong I think magento forgot to write this function, Lastly I found the solution to use mysql OR in magento . In addAttributeToFilter we have to write the condition in the form of array.
protected function _prepareCollection()
   $collection = Mage::getModel('catalog/product')->getCollection();

use your own attribute name and value to get the data

No comments:

Post a Comment