Add some fictional orders to the database, and then load the admin.php file in your browser. Click the
ORDERS ADMIN menu link, click a Go button to show some orders, and click the View Details button for one
of the orders. The order details administration page will show up, allowing you to edit the order??™s details, as
noted earlier in this chapter.
How It Works: Administering Order Details
The two files you just wrote, admin_order_details.tpl and admin_order_details.php, allow you to view
and update the details of a particular order.
The constructor of the AdminOrderDetails class (the __construct method) ensures that there??™s an OrderId
parameter in the query string, because without it, this componentized template doesn??™t make sense:
// Class constructor
public function __construct()
{
// Get the back link from session
$this->mLinkToOrdersAdmin = $_SESSION['link_to_orders_admin'];
$this->mLinkToAdmin = Link::ToAdmin();
// We receive the order ID in the query string
if (isset ($_GET['OrderId']))
$this->mOrderId = (int) $_GET['OrderId'];
else
trigger_error('OrderId paramater is required');
CHAPTER 14 ?– ACCEPTING CUSTOMER ORDERS 459
$this->mOrderStatusOptions = Orders::$mOrderStatusOptions;
}
The init() method reacts to user??™s actions and calls various business tier methods to accomplish the user??™s
requests.
It populates the form with the data it gets from the Orders::GetOrderInfo() and the
Orders::GetOrderDetails() business tier methods.
Pages:
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578