$orderId = makeOrder($student[0], $workerId, $student[5]);
} else {
    $orderId = makeOrder($student[0], $workerId);
}
if ($orderId == -2) {
    respond(1);
}
$message .= "Order:  Insert: " . ($orderId != -1 ? "Success, Id: {$orderId}" : "Failure") . "\n";
$message .= "WorkerId: {$workerId}\n\n";
$order = array_slice($order, 1);
//Removes the student array order[0] from order. Moves all indexes forward.
foreach ($order as $detail) {
    switch ($detail[0]) {
        case 0:
            //Custom Pizza
            $pizzaId = makeCustomPizza($detail[3], $detail[2]);
            //Size, ToppingArray
            makeOrderDetailPizza($orderId, $detail[1], $pizzaId);
            //orderId, Quantity, pizzaId
            break;
        case 1:
            //Specialty Pizza
            makeOrderDetailPizza($orderId, $detail[1], $detail[2]);
            //orderId, Quantity, pizzaId
            break;
        case 2:
            //Item
            makeOrderDetailItem($orderId, $detail[1], $detail[2]);
            //orderId, Quantity, pizzaId
            break;
    }
Пример #2
0
$student = makeStudent($studentId, $studentInfo[0], $studentInfo[1], $studentInfo[2], $studentInfo[3]);
echo "Creating student. Result: " . ($student ? "Success" : "Failure");
echo "<br>";
//Create an Order for Pickup.
//If deliver, call like:   $orderId = makeOrder($studentId, $hallId, $workerId);
//                    bannerId
$orderId = makeOrder($studentId, $workerId, $studentHall);
echo "Creating order.  Result: " . ($orderId != -1 ? "Success (id: {$orderId})" : "Failure") . "<br>";
//echo "Creating order. Result: " . ($orderId ? "Success" : "Failure");
echo "<br>";
//Insert 3 custom pizzas and their toppings (as defined in the topping arrays above)
echo "Inserting Custom Pizzas...<br>";
$pizza_1 = makeCustomPizza(1, $toppingIds_pizza_1);
//size(0= medium, 1=large)  toppingId array
$pizza_2 = makeCustomPizza(0, $toppingIds_pizza_2);
$pizza_3 = makeCustomPizza(1, $toppingIds_pizza_3);
echo "Pizza 1. result: " . ($pizza_1 != -1 ? "Success (id: {$pizza_1})" : "Failure") . "<br>";
echo "Pizza 2. result: " . ($pizza_2 != -1 ? "Success (id: {$pizza_2})" : "Failure") . "<br>";
echo "Pizza 3. result: " . ($pizza_3 != -1 ? "Success (id: {$pizza_3})" : "Failure") . "<br>";
echo "<br>";
//Create Order_Details for these 3 pizzas to connect them to the order
echo "Making Details for the Pizzas<br>";
$detail_1 = makeOrderDetailPizza($orderId, $quantity_pizza_1, $pizza_1);
$detail_2 = makeOrderDetailPizza($orderId, $quantity_pizza_2, $pizza_2);
$detail_3 = makeOrderDetailPizza($orderId, $quantity_pizza_3, $pizza_3);
echo "Pizza 1 detail result: " . ($detail_1 ? "Success" : "Failure") . "<br>";
echo "Pizza 2 detail result: " . ($detail_2 ? "Success" : "Failure") . "<br>";
echo "Pizza 3 detail result: " . ($detail_3 ? "Success" : "Failure") . "<br>";
echo "<br>";
//Create Order_Details for 3 items to connect them to the order
echo "Making Details for the Items<br>";