<?php

use_class('orders');
$class_o = new orders();
//AJAX ACTION
if (isset($_POST['me_action']) && $_POST['me_action'] != '') {
    if ($_POST['me_action'] == 'SEARCHORDERS') {
        $search_field = tep_db_prepare_input($_POST['search_field']);
        $search_keywords = tep_db_prepare_input(utf8_decode($_POST['search_keywords']));
        $orders = $class_o->searchOrders($search_field, $search_keywords, "op.status NOT IN (9,10,11,12)");
        $result = '';
        if (count($orders) > 0) {
            $itemStatus = $class_o->productStatusName();
            $table = array();
            $t = array();
            $t['c'] = 'Order Info';
            $t['a'] = 'Product Code';
            $t['r'] = 'Cancel by';
            $t['t'] = 'Action';
            $table[] = $t;
            foreach ($orders as $row) {
                $order_date = strtotime($row['date_purchased']);
                $item_count = "{$row['order_item_count']}/{$row['order_item_total']}";
                $t = array();
                $info = array();
                $info[] = 'No: <a href="?open=order&amp;id=' . $row['orders_id'] . '" target="_blank" title="View Order Detail">' . $row['orders_no'] . '</a> <span class="notice">(' . $item_count . ')</span>';
                $info[] = 'Date: ' . date('d-M-y', $order_date);
                $info[] = 'Cust: <a href="?open=customer&amp;id=' . $row['customers_id'] . '" target="_blank" title="View Customer Detail" >' . $row['customers_name'] . '</a> <span class="notice">(' . $row['customers_order_count'] . ')</span>';
                $info[] = 'Product: <a href="?open=product-detail&amp;products_id=' . $row['products_id'] . '" target="_blank" title="View product detail">' . $row['products_model'] . '</a>';
                $info[] = 'Qty: ' . $row['products_quantity'];
                $info[] = 'Price: ' . $row['final_price'];
<?php

use_class('orders');
use_class('payone');
$class_o = new orders();
$default_comment = 'Comment...';
//AJAX ACTION
if (isset($_POST['me_action']) && $_POST['me_action'] != '') {
    if ($_POST['me_action'] == 'SEARCHORDERS') {
        $search_field = tep_db_prepare_input($_POST['search_field']);
        $search_keywords = tep_db_prepare_input(utf8_decode($_POST['search_keywords']));
        $orders = $class_o->searchOrders($search_field, $search_keywords, "op.status IN (9,11)");
        $result = '';
        $table = array();
        if (count($orders) > 0) {
            $t = array();
            $t['c'] = 'Order Info';
            $t['a'] = 'Product Code';
            $t['r'] = 'Return Info';
            $t['t'] = 'Action';
            $table[] = $t;
            foreach ($orders as $row) {
                $existing_return = $class_o->productReturnTotalQty($row['orders_products_id']);
                if ($existing_return < $row['products_quantity']) {
                    $order_date = strtotime($row['date_purchased']);
                    $item_count = "{$row['order_item_count']}/{$row['order_item_total']}";
                    $t = array();
                    $info = array();
                    $info[] = 'No: <a href="?open=order&amp;id=' . $row['orders_id'] . '" target="_blank" title="View Order Detail">' . $row['orders_no'] . '</a>';
                    $info[] = 'Date: ' . date('d-M-y', $order_date);
                    $info[] = 'Cust: <a href="?open=customer&amp;id=' . $row['customers_id'] . '" target="_blank" title="View Customer Detail" >' . $row['customers_name'] . '</a> <span class="notice">(' . $row['customers_order_count'] . ')</span>';