Product details Using Product Id in Magento

Get Product details Using Product Id in Magento

This post show how to get all Product details Using Product Id in Magento. In this code get object of Product and get all detail of Product details Using Product Id.

This code will show you all detail of product product added in Magento admin(by Magento admin panel Catalog > Manage Categories). Hear we show some detail like name, short description, Long Description, Regular Price, special Price and other info about get Product details Using Product Id but if you remove comment of print_r($_products), it will show you all detail of product.

$Product_obj = Mage::getModel('catalog/product');
$product_id = "26";
// Product details Using Product Id
// pass produuct id hear
$product_data = $Product_obj->load($product_id); 

// Enter your Product Id in $product_id
// get all Product details Using Product Id
// get details of Product name
echo $product_data->getName();
//get  details of product short description
echo $product_data->getShortDescription();
//get  details of Product Long Description
echo $product_data->getDescription();
//get details of Product Regular Price
echo $product_data->getPrice();
//get details of Product Special price
echo $product_data->getSpecialPrice();
//get details of Product Url
echo $product_data->getProductUrl();
//get details of Product image Url
echo $product_data->getImageUrl();

Get all Product details in Magento

if we have to Get all Product details in Magento, this code will help you to get all information of Product. in this following code for Get all Product details in Magento we get all Product id and after that using product id we get all Product details.

$Product_model = Mage::getModel('catalog/product');

$products_data = Mage::getModel('catalog/product')->getCollection();
// Magento does not load all attributes by default
// Add as many as you like
$products_data->addAttributeToSelect('name');
foreach($products_data as $product_val) 
{
	//do something
	$get_productid =  $product_val->getId();
	$_product = $Product_model->load($get_productid); 
	
	// get product Short Description
	//echo "<br>".$_product->getShortDescription(); 
	// get product Description
	//echo "<br>".$_product->getDescription(); 
	// get product Name
	echo "<br>".$_product->getName(); 
	// get product Price
	echo "<br>".$_product->getPrice(); 
	// get product Special Price
	echo "<br>".$_product->getSpecialPrice(); 
	// get product url
	echo "<br>".$_product->getProductUrl(); 
	// get product Image Url
	echo "<br>".$_product->getImageUrl(); 
	// get product Small Image Url
	echo "<br>".$_product->getSmallImageUrl(); 
	// get product Thumbnail Image Url
	echo "<br>".$_product->getThumbnailUrl(); 
	
}

you may also like Get Product details Using Product sku in Magento