Get product collection in magento

To get product collection we can use following code :

< ?php $_productCollection = Mage::getModel('catalog/product') ->getCollection()
->addAttributeToSort('created_at', 'DESC')
->addAttributeToSelect('*')
->load();
foreach ($_productCollection as $_product){
echo $_product->getId().'';
echo $_product->getName().'';
echo $_product->getProductUrl().'';
echo $_product->getPrice().'';
}
?>

Tags: Magento1,

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *