Magento Get Product Data Programmatically

Magento Get Product Data Programmatically

To retrieve product data programmatically, we will use resource model to get product collection. Resource Models contains the collection query directly with database to behalf of the model.

<?php 
   $collection = Mage::getResourceModel('catalog/product_collection');
   if(count($collection)):
      foreach($collection as $product):
         echo $this->__('Product with %s id %s is loaded successfully',
                                     $product->getName(),$product->getId());
      endforeach;
   else:
      echo $this->__('No Product Selection was found');
   endif;
?>

Leave a Reply

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