I am trying to get products using price range suppose we i want product with price range of
50-500 then how can get?
You can try below code
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToFilter('price',array('from'=>$from,'to'=>$to));
Try below code:
$model = Mage::getModel('catalog/product')
->getCollection()
->addFieldToFilter('price',array('from' => '50','to' => '500'))->getData();
$productId = array();
foreach($model as $key => $val) {
foreach($val as $v) {
$productId[$key] = $val['entity_id'];
}
}
Hope it helps.
->addAttributeToFilter('price', array(array('from'=>'0','to'=>'5000'), array('from'=>'15000','to'=>'20000')) )