function setup() { $order_id = getCurrentOrder(); if ($order_id <= 0) { renderError("Order could not be created or obtained by any known method"); } else { $orderline_id = getCurrentOrderline($order_id); if (isset($_GET['return_to_class'])) { $class_id = $_GET['return_to_class']; } else { $class_id = getCurrentClass($orderline_id); } if ($orderline_id > 0) { displayPreviouslySelectedComponentList($orderline_id); displayConfiguredComponentList($class_id, $orderline_id); } else { if ($orderline_id >= 0) { echo "<br/>"; orderError(); echo "<br/><br/>"; } } } }
<?php require_once 'header.php'; require_once 'login.php'; require_once 'customer_functions.php'; if (isLoggedIn()) { $order = getCurrentOrder(); if (!$order) { noItemsInCart(); } else { $database = connectToDatabase(); $query = "SELECT id FROM orderline WHERE order_id=" . $order; $result = mysqlQuery($query, $database); if (mysql_num_rows($result) < 1) { noItemsInCart(); } while ($result_array = mysql_fetch_array($result)) { $orderlines++; displayOrderline($result_array[0], $orderlines); if (!isOrderlineFull($result_array[0])) { $incomplete++; renderError("This item is not full!"); } } if (!$orderlines) { noItemsInCart(); } if (!$incomplete) { orderComplete(0, $order, 1); } else { renderError("Please complete all incomplete items before checking out.");