SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 130 | Next

Nirav Mehta

"Mobile Web Development"

We kept a provision for different order statuses when we designed the orders
table. The status field is an enumerated field, and can contain one of the
three values: N for New order, P for orders in Process, and C for Completed
orders. Let's add a function to our Order class to update this field. The
following code shows the function:
public function UpdateStatus($status)
{
$query = "UPDATE ".$this->table." SET status = '$status'
WHERE id = '".$this->_id."'";
if ($GLOBALS["db"]->UpdateQuery($query))
{
$this->status = $status;
return true;
}
return false;
}
2. Next, let's list new orders. For this, we query the orders table for all orders
with status "N". With each item in the list, we will add a checkbox so that
we can mark them as dispatched. Let us make a new file processOrders.
inc.php for this. We also need to add the action "processOrders" to the
$validActions array in index.php. The following code shows the code to
generate this list:
// File to process orders and mark them as dispatched
$prodObj = new Product();
$products = $prodObj->GetAll("categoryId = 1", "priority asc");
$varObj = new Variation();
$varObj = $varObj->GetAll("", "type asc");
$ordObj = new Order($prodObj, $varObj);
// Load all new orders
$pendingOrders = $ordObj->GetAll("status = 'N'", "orderDate asc");
echo '

Process New Orders

';
if (count($pendingOrders) > 0)
{
echo '
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
druga wojna światowa Free English grammar and study guid hotel jelenia góra Russian bride counter strike 1.6