Suppose, you have ID of some products and you want to load them at once in Magento, then here is a solution:-
Suppose, you have 5 products ID: 5, 22, 45, 75, 88
You can store them in one array:
$productIds = array(5, 22, 45, 75, 88);
Then, you can use MySQL’s IN() clause for loading multiple product ids:
addAttributeToFilter('entity_id', array('in' => $productIds))
Here is the complete code:-
$productIds = array(5, 22, 45, 75, 88);
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
$collection = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToFilter('entity_id', array('in' => $productIds))
->addAttributeToSelect($attributes);
Similarly, if you have product SKU instead of product ID, then also you can use the same code for loading the products.
Here is the code:-
$productSku = array('1111', '1112', '1113', 'HTC Touch Diamond', 'microsoftnatural');
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
$collection = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToFilter('sku', array('in' => $productSku))
->addAttributeToSelect($attributes);
Hope it helps. Thanks.