Magento Load Product By Id

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

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

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