<?php
include("../config/database.php");
$order_id  = intval($_POST['order_id']);
$sqlOrder  = mysqli_query($cn,"SELECT * FROM `tbl_order` where `order_id`='".$order_id."'");
$count     = mysqli_num_rows($sqlOrder);
if($count > 0)
{	
    $productlist = array();	
    $orderTotal  = 0;
	while($data = mysqli_fetch_array($sqlOrder))
    {			
		$productlist[] = array("product_name"=>productName($data['product_id']), "sku"=>$data['sku'], "unit"=>$data['unit'], "price"=>$data['price'], "qty"=>$data['qty'], "total"=>$data['total']);						   		
		$orderTotal  = $data['order_total'];
	}
    $arr  = array("status"=>true, "order_id"=>str_pad($order_id, 4, "0", STR_PAD_LEFT), "order_total"=>$orderTotal, "productList"=>$productlist);	
}
else
{
    $arr = array("status"=>false, 'msg'=>"Order Not Found.");
}
echo json_encode($arr);		    	
mysqli_close($cn);
?>