if (!is_numeric($plength)) {
                     list($length_int, $length_ext) = explode('-', $plength);
                     $plength = $length_int;
                 }
                 $plength = $plength / 10;
             }
         }
         $article_id = $product->getArticleIDFromLength($plength);
     }
     $ean_no = $product->getEAN($article_id);
 }
 $o_detail = Order::getOldOrderFunctionSP()->retrieveDetail('', $order_number);
 if (count($o_detail) > 0) {
     echo "{$order_number}: {$seller_sku} -> {$ean_no}<br/>";
     $sp_type = 'S';
     $result_data = checkProductOnBag($sp_type, $o_detail['jng_sp_orders_id'], $ean_no);
     if ($result_data['status'] == 'MCCHECKPRODUCTONBAG') {
         $bin_type = 'bin_in';
         $order_product_id = $result_data['order_product_id'];
         $result_data = processReturn($bin_type, $sp_type, $order_product_id, 'manual', '0', $return_date);
         if ($result_data['status'] == 'CREATERETURNFAIL') {
             $failed[] = $order_number;
         } else {
             $success[] = $order_number;
         }
         echo "SP-{$order_product_id}: {$result_data['status']}<br/>";
     }
 } else {
     echo "Order Not Found<br/>";
     $not_found[] = $order_number;
 }
$class_jo = new jng_sp_orders();
$class_o = new orders();
$result = array();
if ($process_type == 'PHPSCANPRODUCTCODE') {
} elseif ($process_type == 'PHPDORETURN') {
    $order_product_id = trim(tep_db_prepare_input($_POST['order_product_id']));
    $bin_type = trim(tep_db_prepare_input($_POST['bin_type']));
    $updater = trim(tep_db_prepare_input($_POST['updater']));
    //$order_product_id = trim(tep_db_prepare_input($_GET['order_product_id']));
    //$bin_type = trim(tep_db_prepare_input($_GET['bin_type']));
    //$updater = trim(tep_db_prepare_input($_GET['updater']));
    $result_data = processReturn($bin_type, $sp_type, $order_product_id, $updater, $reason);
} elseif ($process_type == 'PHPCHECKPRODUCTONBAG') {
    $list_return_need_refresh = trim(tep_db_prepare_input($_POST['list_return_need_refresh']));
    //$list_return_need_refresh = trim(tep_db_prepare_input($_GET['list_return_need_refresh']));
    $result_data = checkProductOnBag($sp_type, $order_id, $ean_code, $list_return_need_refresh);
} elseif ($process_type == 'PHPPUTTOBININBOX') {
    $order_product_id = trim(tep_db_prepare_input($_POST['order_product_id']));
    $sp_type = trim(tep_db_prepare_input($_POST['sp_type']));
    //$order_product_id = trim(tep_db_prepare_input($_GET['order_product_id']));
    //$sp_type = trim(tep_db_prepare_input($_GET['sp_type']));
    $new_status = putToBin($order_product_id, $sp_type, $bin_type, $updater);
    $result['new_status'] = $new_status;
    if ($returnable > 0) {
        $status = 'MCSCANPRODUCT';
    } else {
        $status = 'MCSCANRETURNCODE';
    }
    $result['status'] = $status;
    $result_data = $result;
}