-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path7day-order-status.php
46 lines (29 loc) · 1.3 KB
/
7day-order-status.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
require_once('core.php');
require_once('config.php');
$ts = date('Y-m-d H:i:s', strtotime('-1 week'));
$te = date('Y-m-d H:i:s', mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y')));
$ys = date('Y-m-d H:i:s', strtotime('-1 week',strtotime('-1 week')));
$ye = date('Y-m-d H:i:s', mktime(date('H'), date('i'), date('s'), date('m'), date('d')-7, date('Y')));
// if (isset($_POST) && isset($_SERVER['PHP_AUTH_USER'])) {
// /* Check API key */
// if ($apiKey === $_SERVER['PHP_AUTH_USER']) {
$currentOrders = getOrders($ts,$te);
$countAtProcessing = countAtProcessing($ts,$te);
$countAtComplete = countAtComplete($ts,$te);
$countAtClosed = countAtClosed($ts,$te);
$ordersRefunded = array("value"=>$countAtClosed, "text"=>"Orders Refunded");
$ordersProcessing = array("value"=>$countAtProcessing, "text"=>"Orders Processing");
$ordersComplete = array("value"=>$countAtComplete, "text"=>"Orders Invoiced");
$response = array("item"=>array($ordersRefunded,$ordersProcessing,$ordersComplete));
$json = json_encode($response);
echo $json;
// } else {
// Header("HTTP/1.1 403 Access denied");
// $data = array('error' => 'Nice try, asshole.');
// echo $data;
// }
// } else {
// Header("HTTP/1.1 404 Page not found");
// }
?>