Add a new method named GetOrderShortDetails() to the Orders class in business/orders.php:
// Get short details for an order
public static function GetOrderShortDetails($orderId)
{
// Build the SQL query
$sql = 'CALL orders_get_order_short_details(:order_id)';
// Build the parameters array
$params = array (':order_id' => $orderId);
// Execute the query and return the results
return DatabaseHandler::GetAll($sql, $params);
}
3. Modify the UpdateOrder() method of the Orders class as follows:
// Updates order details
public static function UpdateOrder($orderId, $status, $comments,
$authCode, $reference)
{
// Build the SQL query
$sql = 'CALL orders_update_order(:order_id, :status, :comments,
:auth_code, :reference)';
CHAPTER 17 ?– STORING CUSTOMER ORDERS 551
// Build the parameters array
$params = array (':order_id' => $orderId,
':status' => $status,
':comments' => $comments,
':auth_code' => $authCode,
':reference' => $reference);
// Execute the query
DatabaseHandler::Execute($sql, $params);
}
4. Add a new method named GetCustomersList() to the Customer class in business/customer.php:
// Gets all customers names with their associated id
public static function GetCustomersList()
{
// Build the SQL query
$sql = 'CALL customer_get_customers_list()';
// Execute the query and return the results
return DatabaseHandler::GetAll($sql);
}
Modifying the Presentation Tier
Now, we need to update the presentation tier to make use of the new data tier and business
tier features.
Pages:
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663