php:
// Returns a string that contains the customer's address
public function GetCustomerAddressAsString()
{
$new_line = "\n";
$address_details = $this->mCustomerInfo['name'] . $new_line .
$this->mCustomerInfo['address_1'] . $new_line;
if (!empty ($this->mOrderInfo['address_2']))
$address_details .= $this->mCustomerInfo['address_2'] . $new_line;
$address_details .= $this->mCustomerInfo['city'] . $new_line .
$this->mCustomerInfo['region'] . $new_line .
$this->mCustomerInfo['postal_code'] . $new_line .
$this->mCustomerInfo['country'];
return $address_details;
}
2. Add GetOrderAsString() to the OrderProcessor class:
// Returns a string that contains the order details
public function GetOrderAsString($withCustomerDetails = true)
{
$total_cost = 0.00;
$order_details = '';
$new_line = "\n";
if ($withCustomerDetails)
{
$order_details = 'Customer address:' . $new_line .
$this->GetCustomerAddressAsString() .
$new_line . $new_line;
$order_details .= 'Customer credit card:' . $new_line .
$this->mCustomerInfo['credit_card']->CardNumberX .
$new_line . $new_line;
}
CHAPTER 18 ?– IMPLEMENTING THE ORDER PIPELINE: PART 1 590
foreach ($this->mOrderDetailsInfo as $order_detail)
{
$order_details .= $order_detail['quantity'] . ' ' .
$order_detail['product_name'] . '(' .
$order_detail['attributes'] . ') $' .
$order_detail['unit_cost'] .
Pages:
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709