Magento, How to fetch product collection using product id ?

Question & AnswersCategory: Magento1.9Magento, How to fetch product collection using product id ?
Ranjith Staff asked 12 months ago
Please follow and like us:
1 Answers
Ranjith Staff answered 9 months ago

//use product ids that you need to show in this array
$productIds = array(11, 12, 1, 4);
//loads collection based on Ids
$collection = Mage::getModel(‘catalog/product’)->getCollection()
->addAttributeToFilter(‘entity_id’, array(‘in’ => $productIds));
->load();

//loop through custom collection in order to grab data
foreacch ($collection as $item) {
$item->getName();
}

Please follow and like us:

Please login and answer : Click here