Example #1
0
function route_index($mine)
{
    $member = checkAuth();
    set('member', $member);
    $uid = $member['id'];
    if (isset($_GET['o']) && preg_match('/^\\d+$/', $_GET['o'])) {
        $from = get_reverse_pos($_GET['o'], $mine ? $uid : null);
    } else {
        $from = 1;
    }
    $orders = get_orders(-$from, -$from - PAGE_SIZE + 1, $mine ? $uid : null);
    /* AJAX check  */
    if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
        global $i;
        global $page;
        send_header('Content-Type: text/html; charset=utf-8');
        foreach ($orders as $i) {
            include 'templates/_order.php';
        }
        return;
    }
    set('mine', $mine);
    set('orders', $orders);
    // Get queues keys
    set('mine_queue', queue_get_key($uid, $uid));
    if ($mine == null) {
        set('common_queue', queue_get_key($uid, ''));
    }
    global $page;
    ob_start();
    include 'templates/index.php';
    set('content', ob_get_clean());
    include 'templates/_layout.php';
}
Example #2
0
function mw_print_admin_dashboard_orders_btn()
{
    if (get_option('shop_disabled', 'website') == 'y') {
        return;
    }
    $admin_dashboard_btn = array();
    $admin_dashboard_btn['view'] = 'shop/action:orders';
    $admin_dashboard_btn['icon_class'] = 'mw-icon-shop';
    $notif_html = '';
    $notif_count = get_orders('count=1&order_status=[null]&is_completed=y');
    if ($notif_count > 0) {
        $notif_html = '<sup class="mw-notification-count">' . $notif_count . '</sup>';
    }
    $admin_dashboard_btn['text'] = _e("View Orders", true) . $notif_html;
    mw()->ui->module('admin.dashboard.menu', $admin_dashboard_btn);
}
Example #3
0
<?php

include 'model.php';
include 'functions.php';
echo embed('tpl/home.tpl.php', array('header' => embed('tpl/header.tpl.php', array()), 'sidebar_first' => embed('tpl/category.tpl.php', array('result' => get_category())), 'body' => embed('tpl/orders.tpl.php', array('result' => get_orders())), 'sidebar_second' => embed('tpl/top_last_added.tpl.php', array('result' => last_added()))));
Example #4
0
    $cart = new jcart();
}
$email = !empty($_SESSION['email']) ? $_SESSION['email'] : 0;
if ($cart->get_contents()) {
    extract($_POST);
    $orderdate = date("Y-m-d H:i:s");
    foreach ($cart->get_contents() as $item) {
        $total_price[$item['shop']] += $item['price'] * $item['qty'];
    }
    foreach ($cart->get_contents() as $item) {
        $item_id = $item['id'];
        $detail = get_din_details($db, $item_id);
        $item_name = $item['name'];
        $item_price = $item['price'];
        $item_qty = $item['qty'];
        $shopid = $item['shop'];
        $type = get_dintypename($db, $shopid, $detail['dintype']);
        if ($shopid != $shop) {
            $orderid = "3" . $shopid . get_orders($db, $shopid);
            $query = "insert into wm_orders values('{$orderid}{$shopid}','{$email}','{$shopid}','','','','','','','{$orderdate}','','2','{$total_price[$shopid]}','')";
            $db->query($query);
        }
        $sqlquery = "insert into wm_order_items values('{$orderid}{$shopid}','{$item_id}','" . $shopid . "','" . $item['name'] . "','" . $type . "',{$item_qty} ,'" . $item_price * $item_qty . "','" . $item_price . "' , '" . $orderdate . "','')";
        if (!$db->query($sqlquery)) {
            echo "数据操作失误,请联系管理员!电话:15251435057";
            exit;
        }
        $shop = $shopid;
    }
    $cart->empty_cart();
}
Example #5
0
     echo "地址或电话不能为空!<a href='./index.php'>返回首页</a>";
     exit;
 }
 if ($cart->get_contents()) {
     $fee = $cart->get_shopfee();
     $orderdate = date("Y-m-d H:i:s");
     foreach ($cart->get_contents() as $item) {
         $total_price[$item['shop']] += $item['price'] * $item['qty'];
         $contents[$item['shop']][] = $item;
     }
     try {
         $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         $db->beginTransaction();
         foreach ($contents as $shopid => $content) {
             $tprice = $total_price[$shopid] + $fee[$shopid];
             $orderid = "1" . $shopid . get_orders($db, $shopid) . rand(0, 9);
             $query = "insert into wm_orders set `orderid`='{$orderid}',`user_id`='{$email}',`shopid`='{$shopid}',`fee`='{$fee[$shopid]}',`address`='{$address}',`telphone`='{$telphone}',`otherphone`='{$otherphone}',`orderdate`='{$orderdate}',`sctime`='{$deliver_time}',`state`='0',`total_price`='{$tprice}',`beizhu`='{$bzxx}'";
             $db->exec($query);
             $temp .= "<font size='3'><b>" . get_shopname($db, $shopid) . ":订单号为:{$orderid}" . "</b></font><br>";
             /*if($shopid!=1){
             			$msg.=get_shopname($db,$shopid).":订单号为:$orderid";
             		}*/
             $mark[] = $shopid;
             foreach ($content as $item) {
                 $item_id = $item['id'];
                 $detail = get_din_details($db, $item_id);
                 $item_name = $item['name'];
                 $item_price = $item['price'];
                 $item_qty = $item['qty'];
                 $shopid = $item['shop'];
                 $type = get_dintypename($db, $shopid, $detail['dintype']);
Example #6
0
function ask($info, $sellprice, $last_order, $wall = 0, $balancing = 0, $sudden_mode = 0)
{
    global $fake;
    $last_order = order_Add("ask", $info["btc_balance"], $sellprice, $last_order["price"], $last_order["amount"], $fake);
    $last_order["sudden_mode"] = 0;
    if ($last_order == false) {
        return false;
    }
    echo "*** Processing order...";
    global $fake;
    $myorders = get_orders($fake);
    $c = 0;
    global $timeout;
    while (count($myorders["data"]) >= 1 and $c < $timeout) {
        echo "." . $c;
        $myorders = get_orders($fake);
        echo "(" . count($myorders["data"]) . ")";
        sleep(2);
        $c++;
        if ($c >= $timeout) {
            cli_beep();
            cli_beep();
            $cancel = order_cancel($last_order["success"]);
            echo "\n*** Order timeoout! canceled..";
            $last_order["status"] = "cancelled";
            global $fake;
            $infodata = get_infodataf($fake);
            $info = get_infodata($infodata, $fake);
            if ($info['usd_balance'] > 10) {
                echo "\n*** WARNING: transacao processada sim!";
                $last_order["status"] = "notbalanced";
            }
        }
    }
    if ($c < $timeout or $last_order["status"] == "notbalanced") {
        $last_order["sudden_mode"] = 0;
        if ($last_order["status"] == "notbalanced") {
            $last_order["sudden_mode"] = 1;
        }
        $last_order["status"] = "processed";
    } else {
        if ($sudden_mode == 1) {
            $last_order["sudden_mode"] = 1;
        }
    }
    return $last_order;
}
 public function list_nodes($filters = '')
 {
     return get_orders($filters);
 }
Example #8
0

</script>
<style>

.main-admin-row, .mw-simple-rotator{
  max-width: 1200px;
}

</style>
<?php 
$is_orders = get_orders('order_completed=1&count=1');
?>

<?php 
$latest_orders = get_orders('order_completed=1&count=1&order_status=pending');
?>



<div class="mw-table-sorting-controller">
	<div class="section-header">
    	<div class="mw-ui-row valign" style="margin-bottom: 20px;">
            <div class="mw-ui-col">
                <div class="mw-ui-row" style=" width: auto">
                    <div class="mw-ui-col">
                        <div class="mw-ui-col-container">
                            <a class="ordersnum" href="#orderstype=completed"><?php 
print $latest_orders;
?>
</a>
Example #9
0
if ($siteid)
{
// get site_parameters
	$site_params = new Ecom_site($db);
	if ($site_params->fetch($siteid,$user) < 0) 
	{
		print "erreur lecture site ".$site_params->error;
		return -2;
	}
}
		
switch ($action = $argv[1])
{
	case 'order':
		print "traitement des commandes\n";
		if ($res = get_orders($siteid, $db, $user) > 0) print "traitement des commandes réussi $res\n";
		else print "Erreur traitement des commandes \n";
		$res = import_orders($siteid, $db, $user);
		if ($res < 0) print "Erreur import des commandes"."\n";
		elseif ($res == 0) print "aucune commande à traiter"."\n";
		else  print $res." commandes importées"."\n"; 
		break;
	case 'product':
		print "traitement des produits"."\n";
		print "étape 1 liste des nouveaux produits"."\n";
		// traitement de la limite
		if (! isset($argv[3])) $limit = 0;
		elseif ($argv[3] > 0 ) $limit = $argv[3];
		else $limit = 100; // on limite

		// pour ne pas re-traiter les produits en erreur
Example #10
0
 $times = date('i', strtotime($hora[0]));
 $hora_old = $times;
 wfilew($datachart, $line);
 $voll = vol_anormal(1);
 if ($voll != false) {
     echo "\n*** High volume detected! " . $voll;
     if ($enable_tweet) {
         tweet($tmhOAuth, "High volume detected! " . $voll . " {$twitter_users}");
     }
 }
 $last_order = get_lasttrade_local($last_two_orders);
 $ticker = get_tickerf($fake);
 $ticker = get_ticker($ticker, $fake);
 if (1 == 1) {
     echo "\n*** Checking for open orders... ";
     $myorders = get_orders($fake);
     if (count($myorders["data"]) >= 1) {
         echo "waiting " . count($myorders["data"]) . " orders to process.";
     } else {
         echo " no orders.";
         $transa = false;
         $wall = false;
         if ($info["trade_mode"] == "ask") {
             if ($reverse_prices == 1) {
                 $ticker["ticker_sell"] = $ticker["ticker_buy"];
             }
             $range = $ticker["ticker_sell"] - ($last_order["price"] + $up_diff);
             //$updown=
             $direction = "<" . market_direction($dire, true, $ema) . "/down>";
             $next_price = $last_order["price"] + $up_diff;
             $stoploss = $last_order["price"] - $up_diff_inv;
Example #11
0
<?php

@session_start();
header('Content-Type:text/html;charset=gb2312');
include "../global.php";
$unex = explode('|', $_SESSION['uname']);
$sid = $unex[0];
//查看3分钟内有木有未接受的订单
if (0) {
    $sql = "SELECT * FROM `wm_orders` WHERE UNIX_TIMESTAMP( `orderdate` ) < ( UNIX_TIMESTAMP( now( ) ) -150 ) AND `state` = '0'";
    $unorders = $db->query($sql)->fetchall();
    if (!empty($unorders)) {
        foreach ($unorders as $row) {
            $msg = "抱歉!您的订单:" . $row['orderid'] . ",商家未能接受,系统将自动关闭,请重新选订!我饿啦外卖【welwm.com】";
            $telphone = $row['telphone'];
            sendSMS($uid, $pwd, $telphone, $msg);
            $updatesql = "update `wm_orders` set `state`='4' WHERE `orderid`='" . $row['orderid'] . "'";
            $db->query($updatesql);
        }
    }
}
$b = get_orders($db, $sid);
$a = get_orderadmin($db, $sid);
if ($a != $b) {
    echo "0";
    update_od($db, $b, $sid);
} else {
    echo "1";
}
Example #12
0
 public function export_orders1()
 {
     $data = get_orders('no_limit=true&order_completed=1');
     if (!$data) {
         return array('error' => 'You do not have any orders');
     }
     $csv_output = '';
     $head = reset($data);
     foreach ($head as $k => $v) {
         $csv_output .= $this->app->format->no_dashes($k) . ',';
         // $csv_output .= "\t";
     }
     $csv_output .= "\n";
     foreach ($data as $item) {
         foreach ($item as $k => $v) {
             $csv_output .= $this->app->format->no_dashes($v) . ',';
             //  $csv_output .= "\t";
         }
         $cart_items = mw()->shop_manager->order_items($item['id']);
         if (!empty($cart_items)) {
         }
         dd($cart_items);
         $csv_output .= "\n";
     }
     //dd($csv_output);
     $filename = 'orders' . '_' . date('Y-m-d_H-i', time()) . uniqid() . '.csv';
     $filename_path = userfiles_path() . 'export' . DS . 'orders' . DS;
     $filename_path_index = userfiles_path() . 'export' . DS . 'orders' . DS . 'index.php';
     if (!is_dir($filename_path)) {
         mkdir_recursive($filename_path);
     }
     if (!is_file($filename_path_index)) {
         @touch($filename_path_index);
     }
     $filename_path_full = $filename_path . $filename;
     file_put_contents($filename_path_full, $csv_output);
     $download = $this->app->url_manager->link_to_file($filename_path_full);
     return array('success' => 'Your file has been exported!', 'download' => $download);
     dd('export_orders');
 }
Example #13
0
function get_order_detail($values)
{
    if (!isset($values['order_id'])) {
        throw new Exception("Must provide order_id");
    }
    $dbh = new PDOConnection();
    //get header information - this returns array of orders, so just grab the first one
    $result = get_orders(array('order_id' => $values['order_id'], 'details' => 1));
    $orderHeader = $result['orders'][0];
    $query = "SELECT \n            od.id line_key, \n            od.line_id,\n            od.price unit_price, \n            quantity, \n            p.id product_id, \n            p.code product_code, \n            p.description product_description, \n            unit_id, \n            u.code unit_code, \n            u.description unit_description,\n            (od.price * od.quantity) line_price\n        FROM order_details od \n        LEFT JOIN products p ON od.product_id = p.id \n        LEFT JOIN units u ON unit_id = u.id \n        WHERE order_id = :order_id ";
    $sth = $dbh->prepare($query);
    $sth->bindParam(':order_id', $values['order_id']);
    $detailArray = array();
    if (!$sth->execute()) {
        throw new Exception("ERROR: Could not retrieve order lines - " . $sth->errorInfo[2]);
    }
    foreach ($sth->fetchAll(PDO::FETCH_ASSOC) as $row) {
        $detailArray[] = $row;
    }
    $orderDetails = $orderHeader;
    $orderDetails['lines'] = $detailArray;
    return $orderDetails;
}
Example #14
0
     break;
 case 'submit_order':
     include_once __DIR__ . '/orders/submit_order.php';
     $responseArray['response'] = submit_order($values);
     $responseArray['status'] = 'success';
     $responseArray['message'] = 'Order successfully submited';
     break;
 case 'add_order':
     include_once __DIR__ . '/orders/add_order.php';
     $responseArray['response'] = add_order($values);
     $responseArray['status'] = 'success';
     $responseArray['message'] = 'Added order';
     break;
 case 'get_orders':
     include_once __DIR__ . '/orders/get_orders.php';
     $responseArray['response'] = get_orders($values);
     $responseArray['status'] = 'success';
     $responseArray['message'] = 'Orders successfully read';
     break;
 case 'get_order_detail':
     include_once __DIR__ . '/orders/get_orders.php';
     $responseArray['response'] = get_order_detail($values);
     $responseArray['status'] = 'success';
     $responseArray['message'] = 'Order details successfully read';
     break;
 case 'get_delivery_options':
     include_once __DIR__ . '/orders/get_delivery_options.php';
     $responseArray['status'] = 'success';
     $responseArray['message'] = 'This feature is not implemented, but always will return \'pickup\' for now';
     $responseArray['response'] = get_delivery_options($values);
     break;
Example #15
0
        <form id="addorder-form" onsubmit="return submitCreateOrder()" method="post">
            user id: <input type="text" name="user_id" id="user_id" value=123>
            type (ship/pickup): <input type="text" name="type" id="type" value="pickup">
            ship/pickup date: <input type="text" name="ship_date" id="ship_date" value="2016-02-10">
            product code: <input type="text" name="detail[0][product_code]" id="product_code" value="zoe"><br>
            <input type="submit" id="login-btn">
        </form>
    </div>
    <div id="login-info">
        <p>Orders:</p>
    </div>
<div>
<?php 
include "../controllers/get_orders.php";
$getUser['email'] = "*****@*****.**";
$orders = (array) get_orders($getUser, $error);
echo "<script>console.log('{$error}');</script>";
echo "<table border=\"1\">";
echo "<tr>";
echo "<th>order_id</th>";
echo "<th>user_id</th>";
echo "<th>status</th>";
echo "<th>order_date</th>";
echo "<th>ship_date</th>";
echo "<th>products</th>";
echo "</tr>";
foreach ($orders as $o) {
    echo "<tr>";
    echo "<td>" . $o['order_id'] . "</td>";
    echo "<td>" . $o['user_id'] . "</td>";
    echo "<td>" . $o['status'] . "</td>";
Example #16
0
<?php

require "secure/session.inc.php";
require "../inc/lib.inc.php";
require "../inc/db.inc.php";
?>
<html>
<head>
    <title>Поступившие заказы</title>
</head>
<body>
<h1>Поступившие заказы:</h1>
<pre>
<?php 
$orders = get_orders();
foreach ($orders as $order) {
    $d = (int) $order['dt'];
    ?>
</pre>
<hr>
<h2>Заказ номер: <?php 
    echo $order['orderid'];
    ?>
</h2>
<p><b>Заказчик</b>: <?php 
    echo $order['name'];
    ?>
</p>
<p><b>Email</b>: <?php 
    echo $order['email'];
    ?>
Example #17
0
<?php

only_admin_access();
if (isset($params['order-id']) == true) {
    $client = get_orders('one=1&id=' . intval($params['order-id']));
    $orders = get_orders('order_by=created_at desc&order_completed=1&email=' . $client['email']);
    ?>
<script type="text/javascript">
mw.require('forms.js');
</script>
<script type="text/javascript">



mw.client_edit = {
   enable:function(e){
     mw.$('.mw-client-information').removeClass('nonactive');
     mw.$('.mw-client-information input').eq(0).focus();
   },
   disable:function(){
      mw.$('.mw-client-information').addClass('nonactive');
   },
   save:function(){
        var URL = '<?php 
    print api_link('shop/update_order');
    ?>
';
        if(!mw.$('.mw-client-information').hasClass('nonactive')){
           var obj = mw.form.serialize('.mw-client-information');
           $.post(URL, obj ,function(data) {
            mw.reload_module('<?php 
Example #18
0
            ?>
</td>
      <td><?php 
            print $order['phone'];
            ?>
</td>
      <td><?php 
            print $order['country'];
            ?>
</td>
      <td><?php 
            print $order['city'];
            ?>
</td>
      <td><?php 
            $total_ord = get_orders('count=1&email=' . $order['email'] . '&is_completed=1');
            ?>
        <?php 
            print $total_ord;
            ?>
</td>
      <td width="115"><span class="show-on-hover mw-icon-close" onclick="mw_delete_shop_client('<?php 
            print $order['email'];
            ?>
');"></span> <a class="show-on-hover mw-ui-btn mw-ui-btn-invert mw-ui-btn-small" href="#?clientorder=<?php 
            print $order['id'];
            ?>
">
        <?php 
            _e("View client");
            ?>
Example #19
0









<?php 
if (is_logged() == false) {
    return mw()->url_manager->redirect(login_url());
}
$orders_params = array('created_by' => user_id(), 'order_by' => 'updated_at desc');
$orders = get_orders($orders_params);
include THIS_TEMPLATE_DIR . "header.php";
?>


<script>

$(document).ready(function(){
    mw.on.hashParam('section', function(){
        if(this == false){
            mw.url.windowHashParam('section', 'profile');
        }
        else{
            $(".profile-tab").removeClass('active');
            $(".profile-tab-" + this).addClass('active');
            $(".ptab").hide();
Example #20
0
$dbconnection->connect($dbName);
$mysqli = $dbconnection->connection;
$query = "insert ignore into shedfulfillments(createdat, fulfillmentid, orderid, updatedat) values (?,?,?,?)";
if ($stmt = $mysqli->prepare($query)) {
    $stmt->bind_param("siis", $createdat, $fulfillmentid, $orderid, $updatedat);
} else {
    printf("query error: %s\n", $mysqli->error);
}
$ordercount = get_order_counts($api_key, $passwd, $countpath, $filters);
$count = json_decode($ordercount, true);
print_r($count);
$pages = ceil($count["count"] / 250);
echo $pages;
$mysqli->query("start");
for ($i = 1; $i <= $pages; ++$i) {
    $orders = get_orders($api_key, $passwd, $path, $filters, $i);
    $orderarray = json_decode($orders, true);
    //print_r($orderarray);
    foreach ($orderarray['orders'] as $order) {
        $fulfillments = $order['fulfillments'];
        foreach ($fulfillments as $fulfillment) {
            $createdat = date("Y-m-d H:i:s", strtotime($fulfillment['created_at']));
            $fulfillmentid = $fulfillment['id'];
            $orderid = $fulfillment['order_id'];
            $updatedat = date("Y-m-d H:i:s", strtotime($fulfillment['updated_at']));
            printf("Inserted: %s.\n", $createdat);
            $stmt->execute();
        }
    }
    sleep(2);
    printf("at page: %s.\n", $i);
Example #21
0
        ?>
" target="_blank"><?php 
        _e("Recover");
        ?>
</a>
            </div>
          </td>
      </tr>

    </tbody>
  </table><?php 
    }
    ?>
    <?php 
    $abandoned_carts = get_cart('count=1&no_session_id=true&order_completed=0&group_by=session_id');
    $completed_carts = get_orders('count=1&order_completed=1');
    ?>
  <script>mw.lib.require("morris");</script> 
  <script>
      $(document).ready(function(){
         mw.on.moduleReload("<?php 
    print $params['id'];
    ?>
", function(){
             OrdersChart = Morris.Donut({
                element: 'orders_stat',
                data: [
                  {label: "Completed Carts", value: <?php 
    print intval($completed_carts);
    ?>
},
Example #22
0
function getOrders()
{
    global $is_logged_in;
    $orders = get_orders();
    return array("status" => "OK", "orders" => $orders);
}