<style type=
"text/css"
>
.orderStatusTable {
border:1px solid #CCCCCC;
font-size:11px;
}
.track-order-table td { padding:3px;}
.orderStatusTable td {
padding:8px;
}
.currentStatus {
font-size: 11px;
background-color: #eee;
padding: 10px;
margin: 0 0 15px 0;
line-height: 15px;
border: 1px solid #ccc;
color: #333;
}
.currentStatus span {
font-size: 14px;
line-height: 23px;
color: #000;
}
</style>
<div>
<h3>Check My Order Status</h3>
</div>
<p>Please enter your order number
and
email address to see the status of your order.</p>
<form name=
""
action=
"<?php echo $this->getUrl('track-order');?>"
method=
"get"
>
<table
class
=
"track-order-table"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
<tr style=
"padding:3px 0;display:block;"
>
<td><strong>Order Number:</strong></td>
<td><input type=
"text"
name=
"order_id"
id=
"order_id"
value=
"<?php echo (isset($_GET['order_id'])) ? $_GET['order_id'] : ''; ?>"
/></td>
</tr>
<tr style=
"padding:3px 0;display:block;"
>
<td><strong>Email Address:</strong></td>
<td><input name=
"email_address"
type=
"text"
id=
"email_address"
value=
"<?php echo (isset($_GET['email_address'])) ? $_GET['email_address'] : ''; ?>"
size=
"30"
/></td>
</tr>
<tr style=
"padding:5px 0;display:block;clear:both;margin-top:10px;"
>
<td> </td>
<td><button
class
=
"button"
title=
"Subscribe"
type=
"submit"
><span><span>Submit</span></span></button></td>
</tr>
</table>
</form>
<div></div>
<?php
$live
= true;
$error
=
''
;
$statusMessage
=
''
;
$trackingNumberMessage
=
''
;
$shippingMessage
=
''
;
$orderID
=
''
;
$emailAddress
=
''
;
if
(isset(
$_GET
[
'order_id'
])) {
$orderID
= trim(preg_replace(
'/[^0-9a-zA-Z]*/'
,
''
,
$_GET
[
'order_id'
]));
$emailAddress
= trim(
$_GET
[
'email_address'
]);
try
{
ini_set
(
"soap.wsdl_cache"
,
"0"
);
ini_set
(
"soap.wsdl_cache_enabled"
,
"0"
);
$sessionId
=
$proxy
->login(
'orderviewer'
,
'orderviewer'
);
$orderById
=
$proxy
->call(
$sessionId
,
'sales_order.info'
,
$orderID
);
$items
=
$orderById
[
'items'
];
if
(
$orderById
[
'customer_email'
] ==
$emailAddress
) {
$orderLookup
=
"success"
;
if
(
strtolower
(
$orderById
[
'status'
]) ==
"holded"
) {
$orderById
[
'status'
] =
"On Hold"
;
}
$statusMessage
=
'<span>Your order status is: <strong>'
.ucwords(
str_replace
(
'_'
,
' '
,
$orderById
[
'status'
])).
'</strong></span>'
;
if
(ucwords(
str_replace
(
'_'
,
' '
,
$orderById
[
'status'
])) ==
"Processing"
){
$statusMessage
.=
'<br/><br/><strong>What
does this mean?</strong><br/>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
(
strtolower
(
$orderById
[
'status'
]) ==
"complete"
&&
$orderLookup
==
"success"
) {
$findShipments
=
$proxy
->call(
$sessionId
,
'sales_order_shipment.list'
,
array
(
array
(
'order_id'
=>
array
(
'like'
=>
$orderById
[
'order_id'
]))));
if
(
count
(
$findShipments
) < 1) {
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
{
$thisShipmentID
=
$findShipments
[0][
'increment_id'
];
if
(!
$proxy
->call(
$sessionId
,
'sales_order_shipment.info'
,
$thisShipmentID
)){
$trackingNumberMessage
=
"Shipment ID: <strong>"
.
$thisShipmentID
.
"</strong>"
;
$shippingMessage
=
"Your order was shipped on "
.
$findShipments
[0][
'created_at'
] .
".<br/><br/>"
;
}
else
{
$getShipmentInfo
=
$proxy
->call(
$sessionId
,
'sales_order_shipment.info'
,
$thisShipmentID
);
$shipDate
=
$getShipmentInfo
[
'created_at'
];
$defaultTimeZone
= date_default_timezone_get();
date_default_timezone_set(
'EST'
);
$shippingMessage
=
"Your order was shipped on "
.
date
(
"l, F jS, Y \\a\\t g:i:s a T"
,
strtotime
(
$shipDate
.
' '
.
$defaultTimeZone
)) .
".<br/>"
;
if
(
count
(
$getShipmentInfo
[
'tracks'
]) > 0){
foreach
(
$getShipmentInfo
[
'tracks'
]
as
$temp_track
)
{
$shippingMessage
.=
"Shipped By : "
.
$temp_track
[
'title'
].
" ,Tracking Number :"
.
$temp_track
[
'number'
].
"<br/>"
; }
$shippingMessage
.= 'Check your shipment state by tracking number~.<br>By Fedex : <a target=
"_blank"
href=
"http://www.fedex.com/Tracking"
>Fedex Express</a><br/>
}
$shippingMessage
.=
"<br/>"
;
}
}
}
if
(
$orderLookup
!=
"failure"
){
echo
'<p style="padding: 10px; background:#eee; margin: 10px 0;">'
.
$statusMessage
.
'<br/>'
.
$trackingNumberMessage
.
'</p>'
;
echo
$shippingMessage
;
echo
"<h4>Products in your order:</h4><ul>"
;
foreach
(
$items
as
$item
){
$temp_sku
=
$item
[
'sku'
];
if
(
strpos
(
$temp_sku
,
'-'
))
{
$temp_sku
=
substr
(
$temp_sku
,0,
strpos
(
$temp_sku
,
'-'
));
}
echo
"<li>"
.number_format(
$item
[
'qty_invoiced'
], 0) .
" x <strong>"
.
strtoupper
(
$temp_sku
) .
"</strong> "
.
$item
[
'name'
] .
"</li>"
;
}
echo
"</ul>"
;
}
}
catch
(SoapFault
$fault
) {
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
{
if
(
$live
== false) {
echo
"Error $fault->faultcode: $fault->faultstring"
;
}
else
{
echo
"Error $fault->faultcode: $fault->faultstring"
.
"<hr>"
;
}
}
}
}
?>
<p><br
/><br /><em>For detailed information regarding the
status of your order, please contact our helpful Customer Service
Experts.</em></p>