function create_order_edit_dlg()
{
    global $wb;
    include PATH_FORM . "yc_order_edit.form.php";
    //-------- view detail -------
    if ($id = $wb->current_ids) {
        get_order_by_id($winmain, $id);
        //		wb_message_box($wb->mainwin,$id);//implode(",",$all_ctrl)
    }
    if ($wb->current_action == "insert") {
        wb_set_enabled(wb_get_control($winmain, IDC_SAVE), true);
        wb_set_enabled(wb_get_control($winmain, IDC_UPDATE), false);
    } else {
        wb_set_enabled(wb_get_control($winmain, IDC_SAVE), false);
        wb_set_enabled(wb_get_control($winmain, IDC_UPDATE), true);
    }
    wb_set_handler($winmain, "process_order_edit");
    wb_set_visible($winmain, true);
}
Beispiel #2
0
<?php

include "config.php";
// error_reporting(0);
$orders = mysql_query("SELECT DISTINCT  `id` from `order` where status!='paid'") or die(mysql_error());
$orderId = array();
while ($order = mysql_fetch_assoc($orders)) {
    array_push($orderId, $order['id']);
}
function get_order_by_id($id)
{
    $ara = array();
    $results = mysql_query("select * from `order` where id='{$id}'  ORDER BY `order`.`item_id`");
    while ($x = mysql_fetch_assoc($results)) {
        $sara["item_id"] = $x["item_id"];
        $sara["quantity"] = $x["quantity"];
        $sara["price"] = $x["price"];
        $sara["status"] = $x["status"];
        array_push($ara, $sara);
    }
    return $ara;
}
$pura = array();
for ($i = 0; $i < sizeof($orderId); $i++) {
    $nara["id"] = $orderId[$i];
    $nara["total_orders"] = get_order_by_id($orderId[$i]);
    array_push($pura, $nara);
}
echo json_encode($pura);
Beispiel #3
0
<?php

require_once '../includes/admin_header.php';
require_once 'includes/admin_functions.php';
if (intval($_GET['order']) == 0) {
    redirect_to('order_index.php');
} else {
    $sel_order = get_order_by_id($_GET['order']);
    $sel_orderDetail = get_orderDetail_by_id($_GET['order']);
    $sel_orderUser = get_user_by_id($sel_order['user_id']);
    if (isset($_GET['success'])) {
        $message = '<p class="alert alert-success">Order updated successfully.</p>';
    } else {
        $message = '';
    }
}
if (isset($_POST['update'])) {
    $status = trim(mysql_prep($_POST['status']));
    $query = "UPDATE orders SET status ={$status} WHERE id = {$_GET['order']}";
    $result = mysql_query($query, $connection);
    if ($result) {
        $message = '<p class="alert alert-success">Order updated successfully.</p>';
        redirect_to('edit_order.php?success=1&order=' . $_GET['order']);
    } else {
        $message = '<p class="alert alert-warning">The Order could not be updated.</p>';
        $message .= "<br />" . mysql_error();
    }
} else {
    //do something !
}
?>