Magento Load Product By Id


To load product by id, use the load($id)
function by providing product id as parameter following the Product Model Class Mage_Catalog_Product_Model
.
<?php $id = 12; $product = Mage::getModel('catalog/product')->load($id);
A single product with object array will be loaded. To retrieve data simply use getId(); ?>
For Instance
<?php $product_id = 6; $product = Mage::getModel('catalog/product')->load($id); echo "View <a href='".$product->getUrl()."'>".$product->getName()."</a>";
The output of above code will be : View Demo Product