Following code load product useing ids.
$productIds = array(5, 22, 45, 75, 88); $attributes = Mage::getSingleton('catalog/config')->getProductAttributes(); $_productCOllection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToFilter('entity_id', array('in' => $productIds)) ->addAttributeToSelect($attributes);// $attributes or '*'or collection within a range
$_productCOllection = Mage::getModel('catalog/product')->getCollection() ->addAttributeToSelect('*') ->addAttributeToFilter('entity_id', array( 'from' => $startPrOID, 'to' => $EndPrOID )) ->load();Following code load product useing SKUs.
$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);
No comments:
Post a Comment