Check My Order Status
Please enter your order number and email address to see the status of your order.
login('apiusername', 'apikey');
//******************************************************************/
//find all orders related to this id
$orderById = $proxy->call($sessionId, 'sales_order.info', $orderID);
$items = $orderById['items'];
if($orderById['customer_email'] == $emailAddress) {
//we are setting this variable for use later
$orderLookup = "success";
if (strtolower($orderById['status']) == "holded") {
$orderById['status'] = "On Hold";
}
$statusMessage = 'Your order status is: '.ucwords(str_replace('_', ' ', $orderById['status'])).'';
if(ucwords(str_replace('_', ' ', $orderById['status'])) == "Processing"){
$statusMessage .= '
What does this mean?
Processing Time is the time it takes from when you submit your order to when the product leaves the Distribution Center.';
}
} else {
$orderLookup = "failure";
echo "We were unable to find your order information. Please verify your Order Number and Email Address are correct.";
}
//if the order status is complete we look up shipping information
if(strtolower($orderById['status']) == "complete" && $orderLookup == "success") {
//we look for all shipments related to this order id using internal magento order id
$findShipments = $proxy->call($sessionId, 'sales_order_shipment.list', array(array('order_id'=>array('like'=>$orderById['order_id']))));
if (count($findShipments) < 1) { //if $findShipments is not an array
echo "There was an unknown error and your shipment information could not be found. Please contact Customer Service to get the current status of your order.";
} else {
//we pull the increment id for the shipment
$thisShipmentID = $findShipments[0]['increment_id'];
//now we pull all shipment info that specific shipment id
$getShipmentInfo = $proxy->call($sessionId, 'sales_order_shipment.info', $thisShipmentID);
$allowedCarriers = $proxy->call($sessionId, 'sales_order_shipment.getCarriers', $thisShipmentID);
//set each variable
$shipDate = $getShipmentInfo['created_at'];
$service = $allowedCarriers[$getShipmentInfo['tracks'][0]['carrier_code']];
if($service == "Custom Value") $service = "Truck Freight";
$trackingNumber = $getShipmentInfo['tracks'][0]['number'];
$defaultTimeZone = date_default_timezone_get();
date_default_timezone_set('EST');
//print_r($getShipmentInfo);
if($service == "ups") {
$trackingNumberMessage = "Tracking Number: ".$trackingNumber."";
} else {
$trackingNumberMessage = "Tracking Number: ".$trackingNumber."";
}
//and echo the data to screen
$shippingMessage = "Your order was shipped on " . date("l, F jS, Y \\a\\t g:i:s a T", strtotime($shipDate . ' ' . $defaultTimeZone)) . " via " . $service . ".
";
} //no errors
}
if($orderLookup != "failure"){
echo ''.$statusMessage.'
'.$trackingNumberMessage.'
';
echo $shippingMessage;
echo "Products in your order:
";
foreach($items as $item){
echo "- ".number_format($item['qty_invoiced'], 0) . " x " . strtoupper($item['sku']) . " " . $item['name'] . "
";
}
echo "
";
}
} catch (SoapFault $fault) {
//this is a basic implementation of error checking. I am using try to stop the error from showing a nasty magento error page
if($fault->faultcode == "100") {
echo "That Order Number was not found in our system.";
} elseif ($fault->faultcode == "http") {
echo "Request timed out. Please try again later.";
} else {
//leave this on for testing so we can see SOAP status codes; turn off for live
if ($live == false) {
echo "Error $fault->faultcode: $fault->faultstring";
} else {
echo "There was an unknown error. Please try again later, or contact us.";
}
}
}
} // end if
?>
For detailed information regarding the status of your order, please contact our helpful Customer Service Experts.