.

.

Get Product Detail bt product Id in Magento

<?php
require_once '../app/Mage.php';
Mage::app();
//header("Content-Type: application/json");
?>

<?php
$product_id=502;
$obj = Mage::getModel('catalog/product');
$_product = $obj->load($product_id); // Enter your Product Id in $product_id
//get Product Id

$prodid= $_product->getId();



// get Product's name

$prodName=$_product->getName();


//get product's short description

 $prodshortdesc=$_product->getShortDescription();


//get Product's Long Description

$prodescription= $_product->getDescription();


//get Product's Regular Price

$regularprice=$_product->getPrice();


//get Product's Special price

$specialprice= $_product->getSpecialPrice();


//get Product's Url

$producturl=$_product->getProductUrl();


//get Product's image Url

 $imageurl=$_product->getImageUrl();


// get current currency
 $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();

$productdetail=array("productId"=>$prodid,"productName"=>$prodName,"prodShortDesc"=>$prodshortdesc,"prodLongDesc"=>$prodescription,"regularPrice"=>$regularprice,"specialPrice"=>$specialprice,"currency"=>$currency_code,"productUrl"=>$producturl);

$data['responseCode']="1";
$data['msg']="successful";
$data['result']=$productdetail;
$data2 = json_encode($data);
echo $data2;
?>





EmoticonEmoticon