Here , we get all shipping & billing Information , Shipping Method & Payment Method, & also
Item List with Order Subtotal & Grand Total. Let See Below Code
<?php
require_once 'app/Mage.php';
Mage::app('default');
Mage::getSingleton("core/session", array("name" => "frontend"));
?>
<?php
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
// print_r($ordercol);
if($_REQUEST['orderId']!='')
{
$orderid=$_REQUEST['orderId'];
$order = Mage::getModel('sales/order')->load($orderid);
$numorder=count($order);
// get order id or order number
$ordernumber=$order->getIncrementId();
$date=$order->getCreatedAtStoreDate();
$orderdt= str_replace(","," ",$date);
//get order total value:
$orderTotalValue = number_format ($order->getGrandTotal(), 2, '.' , $thousands_sep = '');
$paymentmethod = $order->getPayment()->getMethodInstance()->getCode();
$status= $order->getStatusLabel();
$firstname = $order->getCustomerFirstname();
$lastname = $order->getCustomerLastname();
$billingname=$order->getBillingAddress()->getName();
$billingname=$order->getBillingAddress()->getStreetFull();
//print_r($order->getBillingAddress());
//get Billing Information
$_billingAddress = $order->getBillingAddress();
$billingfname= $_billingAddress->getFirstname();
$billinglname= $_billingAddress->getLastname();
$billingaddres=$_billingAddress->getStreetFull();
$billingregion = $_billingAddress->getRegion();
$billingcity = $_billingAddress->getCity();
$billingpostcode= $_billingAddress->getPostcode();
$billingphone = $_billingAddress->getTelephone();
$billingcountrycode=$_billingAddress->getCountry_id();
// get countryname by country code
$billingcountry = Mage::app()->getLocale()->getCountryTranslation($billingcountrycode);
// get shipping Information
$_shippingAddress = $order->getShippingAddress();
$shippingfname= $_shippingAddress->getFirstname();
$shippinglname= $_shippingAddress->getLastname();
$shippingaddres=$_shippingAddress->getStreetFull();
$shippingregion = $_shippingAddress->getRegion();
$shippingcity = $_shippingAddress->getCity();
$shippingpostcode= $_shippingAddress->getPostcode();
$shippingphone = $_shippingAddress->getTelephone();
$shippingcountrycode=$_shippingAddress->getCountry_id();
// get countryname by country code
$shippingcountry = Mage::app()->getLocale()->getCountryTranslation($shippingcountrycode);
// get shipping Method Details
$shippingdesc=$order->getShippingDescription();
$shippingmethod = $order->getShippingMethod();
//get Order Items Collections
$orderItems = $order->getItemsCollection();
$i=0;
foreach ($orderItems as $item){
$productid = $item->product_id;
$productsku = $item->sku;
$productprice = $item->getPrice();
$productname = $item->getName();
$productqty = $item->getData('qty_ordered');
//echo $productsubtotal = $item->getSubTotal();
$productsubtotal = $productqty * $productprice;
$itemdetail[$i]=array("productId"=>$productid,"productName"=>$productname,"productSku"=>$productsku,"productQty"=>$productqty,"productPrice"=>$productprice,"productSubTotal"=>$productsubtotal);
$i++;
}
// order subtotal
$ordersubtotal=$order->getSubtotal();
// order shipping Amount
$ordershipping=$order->getShippingAmount();
//order grand total
$ordergrandtotal=$order->getGrandTotal();
$data['responseCode']='1';
$data['msg']='successful';
$data['orderDetailOutput']=array("orderNumber"=>$ordernumber,"orderDate"=>$orderdt,"shippingFirstName"=>$shippingfname,"shippingLastName"=>$shippinglname,"shippingAdress"=>$shippingaddres,"shippingRegion"=>$shippingregion,"shippingCity"=>$shippingcity,"shippingPostCode"=>$shippingpostcode,"shippingPhone"=>$shippingphone,"shippingCountry"=>$shippingcountry,"shippingMethod"=>$shippingmethod,"shippingDescription"=>$shippingdesc,"paymentMethod"=>$paymentmethod,"billingFirstName"=>$billingfname,"billingLastName"=>$billinglname,"billingAdress"=>$billingaddres,"billingRegion"=>$billingregion,"billingCity"=>$billingcity,"billingPostCode"=>$billingpostcode,"billingPhone"=>$billingphone,"billingCountry"=>$billingcountry,"itemList"=>$itemdetail,"orderSubTotal"=>$ordersubtotal,"orderShipping"=>$ordershipping,"orderGrandTotal"=>$ordergrandtotal);
}
else
{
$data['responseCode']='0';
$data['msg'] ='Please Select Order Id';
}
}
else
{
$data['responseCode']='0';
$data['msg']='Please Login First';
}
$data2=json_encode($data);
echo $data2;
?>





