Beispiel #1
0
 // Функционал выполняющий JSON запросы
 switch ($arFields['action']) {
     case 'new_order':
         // Новый заказ
         $result = NewOrder($arFields);
         if ($result == 'DB_CONNECT_ERROR') {
             $arRequest['STATUS'] = $result;
         } elseif ($result > 0) {
             $arRequest['STATUS'] = 'SUCCESS';
         } else {
             $arRequest['MESSAGE'] = $result;
         }
         break;
     case 'order_complete':
         // Выполенние заказ
         $result = CompleteOrder($arFields['id_order']);
         if (is_bool($result) && $result == true) {
             $arRequest['STATUS'] = 'SUCCESS';
         } elseif ($result == 'DB_CONNECT_ERROR') {
             $arRequest['STATUS'] = $result;
         } elseif ($result == 'ISSET_EXECUTOR') {
             $arRequest['STATUS'] = $result;
             $arRequest['MESSAGE'] = 'Данный заказ уже выполнен. Пожалуйста выберите другой.';
         } else {
             $arRequest['MESSAGE'] = $result;
         }
         break;
     case 'get_balance':
         // Запрос баланса
         $result = GetBalance();
         if ($result == 'DB_CONNECT_ERROR') {
Beispiel #2
0
            break;
        case 'OrderDetails':
            showOrderdItems();
            break;
    }
}
if (isset($_POST['actionnew'])) {
    switch ($_POST['actionnew']) {
        case 'Checkout':
            //This function will push the selected items to newOrderTable
            //echo "actionnew";
            pushToDB();
            break;
        case 'CheckoutCart':
            //This function will CLEAR the CART from Display. And Prints the bill
            CompleteOrder();
            break;
    }
}
function CompleteOrder()
{
    return;
}
function showOrderdItems()
{
    $Ordered_Items = PDO_FetchAll("SELECT * FROM neworder");
    //print_r($All);
    echo "<table id='order' class='table table-striped table-hover'>\r\n\t\t  <thead>\r\n\t\t\t<tr>\r\n\t\t\t  <th>id</th>\r\n\t\t\t  <th>Order type</th>\r\n\t\t\t  <th>Item Name</th>\r\n\t\t\t  <th>TransId</th>\r\n\t\t\t  <th>Price</th>\r\n\t\t\t  \r\n\t\t\t</tr>\r\n\t\t  </thead>";
    echo "<tbody>";
    $completerow = "";
    $i = 1;
function ExecuteOrderCommand($order, $command, $comments, $carrierData, $tracking)
{
    try {
        // to change statuses, we need to unhold if necessary
        if ($order->canUnhold()) {
            $order->unhold();
            $order->save();
        }
        switch (strtolower($command)) {
            case "complete":
                CompleteOrder($order, $comments, $carrierData, $tracking);
                break;
            case "cancel":
                $order->cancel();
                $order->addStatusToHistory($order->getStatus(), $comments);
                $order->save();
                break;
            case "hold":
                $order->hold();
                $order->addStatusToHistory($order->getStatus(), $comments);
                $order->save();
                break;
            default:
                outputError(80, "Unknown order command '{$command}'.");
                break;
        }
        writeStartTag("Debug");
        writeElement("OrderStatus", $order->getStatus());
        writeCloseTag("Debug");
    } catch (Exception $ex) {
        outputError(90, "Error Executing Command. " . $ex->getMessage());
    }
}