Whole thing works great for me !!
I added another bit of code to highlight orders that have been status "on its way" for more than four days (easy to identify which orders can be updated to delivered and/or tracked down if the customer has not recieved it
// begin reverse-sort Pending orders
if ($status == 1)
{ $orders_query_raw = "select o.orders_status, o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by o.orders_id ASC";
}
else
if ($status == 5)
{ $orders_query_raw = "select o.orders_status, o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by o.orders_id ASC";
}
// end reverse-sort Pending orders
<?php
// highlight if orders are Pending status and over 2 days old -->
if ($orders['orders_status'] == '1') {
// convert times to unix timestamp for comparison
$time_since_order_placed = ($today_time - strtotime($orders['date_purchased']) );
// 172800 = 2 days in the unix timestamp format
if ($time_since_order_placed > 172800) {
echo '<font color=red>';
}
}
// highlight if orders are On its way status and over 4 days old -->
if ($orders['orders_status'] == '5'){
// convert times to unix timestamp for comparison
$time_since_order_updated = ($today_time - strtotime($orders['last_modified']) );
// 345600= 4 days in the unix timestamp format
if ($time_since_order_updated > 345600) {
echo '<font color=green>';
}
}
echo $orders['orders_id'];
?>