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.

$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

 $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

Leave a Reply

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