product_id}
{$obj->mOrderDetails[i].product_name} ({$obj->mOrderDetails[i].attributes})
| {$obj->mOrderDetails[i].quantity} | ${$obj->mOrderDetails[i].unit_cost} | ${$obj->mOrderDetails[i].subtotal} | {/section}
7. Create a new file named admin_order_details.php in the presentation folder, and write the following
code in it:
// Presentation tier class that deals with administering order details
class AdminOrderDetails
{
// Public variables available in smarty template
public $mOrderId;
public $mOrderInfo;
public $mOrderDetails;
public $mEditEnabled;
public $mOrderStatusOptions;
public $mLinkToAdmin;
public $mLinkToOrdersAdmin;
// 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');
$this->mOrderStatusOptions = Orders::$mOrderStatusOptions;
}
CHAPTER 14 ?– ACCEPTING CUSTOMER ORDERS 458
// Initializes class members
public function init()
{
if (isset ($_GET['submitUpdate']))
{
Orders::UpdateOrder($this->mOrderId, $_GET['status'],
$_GET['comments'], $_GET['customerName'], $_GET['shippingAddress'],
$_GET['customerEmail']);
}
$this->mOrderInfo = Orders::GetOrderInfo($this->mOrderId);
$this->mOrderDetails = Orders::GetOrderDetails($this->mOrderId);
// Value which specifies whether to enable or disable edit mode
if (isset ($_GET['submitEdit']))
$this->mEditEnabled = true;
else
$this->mEditEnabled = false;
}
}
?>
8.
Pages:
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577