<?php include 'variables/orderVariables.php'; $data = array("status" => getStatusOfOrder(0, $language, true), "delivery" => getDeliveryOptionOfOrder(0, $language, true), "paymentMethod" => getPaymentMethodOfOrder(0, $language, true)); $statusMessage = makeStatusMessage(27, "success"); function getStatusOfOrder($o, $l, $showAll = null) { include 'variables/orderStatusVariables.php'; if (isset($showAll)) { return $orderStatus[$l]; } if (isset($orderStatus[$l][$o])) { return $orderStatus[$l][$o]; } else { return $orderStatus["EN"][0]; } } function getDeliveryOptionOfOrder($o, $l, $showAll = null) { include 'variables/orderDeliveryVariables.php'; if (isset($showAll)) { return $orderDelivery[$l]; } if (isset($orderDelivery[$l][$o])) { return $orderDelivery[$l][$o]; } else { return $orderDelivery["EN"][0]; } } function getPaymentMethodOfOrder($o, $l, $showAll = null) {
if ($selQ->getNumberOfResults() < 1) { $statusMessage = makeStatusMessage(57, "error"); mysqli_close($conn); return; } $selQProdNames = new selectSQL($conn); $selQProdNames->select = array("p.name" . $language . " as " . $product[$language], "p.id as " . $pid[$language]); $selQProdNames->tableNames = array("products as p", "ordered_products as op"); $selQProdNames->joins = "p.id = op.productid"; $selQProdNames->joinTypes = "JOIN"; $data = array(); while ($r = $selQ->result->fetch_assoc()) { $productData = array(); $selQProdNames->where = $r[$oid[$language]]; if (!$selQ->executeQuery()) { $statusMessage = $selQ->status; mysqli_close($conn); return; } while ($row = $selQProdNames->result->fetch_assoc()) { $productData = $row; } $r[$status[$language]] = getStatusOfOrder($r[$status[$language]], $language); $r[$payment[$language]] = getPaymentMethodOfOrder($r[$payment[$language]], $language); $r[$delivery[$language]] = getDeliveryOptionOfOrder($r[$delivery[$language]], $language); $data[] = array_merge($r, array("products" => $productData)); unset($productData); } $statusMessage = makeStatusMessage(27, "success"); mysqli_close($conn); return;