tpl to display an ORDERS ADMIN link.
Go through the following exercise to prepare the ground for the administrative features
we??™ll create later in the chapter. Note that, after completing the exercise, admin.php will not be
functional, as it will reference a new business tier script that we??™ll create a bit later.
Exercise: Setting Up the ORDERS ADMIN Page
1. Modify admin.php to include a reference to business/orders.php, which we??™ll create later:
// Load Business Tier
require_once BUSINESS_DIR . 'catalog.php';
require_once BUSINESS_DIR . 'shopping_cart.php';
require_once BUSINESS_DIR . 'orders.php';
CHAPTER 14 ?– ACCEPTING CUSTOMER ORDERS 444
2. In presentation/store_admin.php, modify the StoreAdmin class by adding the highlighted code at
the end of the init() method. This code loads admin_orders.tpl and admin_order_details.tpl:
elseif ($admin_page == 'ProductDetails')
$this->mContentsCell = 'admin_product_details.tpl';
elseif ($admin_page == 'Carts')
$this->mContentsCell = 'admin_carts.tpl';
elseif ($admin_page == 'Orders')
$this->mContentsCell = 'admin_orders.tpl';
elseif ($admin_page == 'OrderDetails')
$this->mContentsCell = 'admin_order_details.tpl';
}
}
}
?>
3. Add the following two methods in the Link class, which you can find in presentation/link.php:
// Create link to orders administration page
public static function ToOrdersAdmin()
{
return self::ToAdmin('Page=Orders');
}
// Create link to the order details administration page
public static function ToOrderDetailsAdmin($orderId)
{
$link = 'Page=OrderDetails&OrderId=' .
Pages:
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562