' each, total cost $' .
number_format($order_detail['subtotal'],
2, '.', '') . $new_line;
$total_cost += $order_detail['subtotal'];
}
// Add shipping cost
if ($this->mOrderInfo['shipping_id'] != -1)
{
$order_details .= 'Shipping: ' . $this->mOrderInfo['shipping_type'] .
$new_line;
$total_cost += $this->mOrderInfo['shipping_cost'];
}
// Add tax
if ($this->mOrderInfo['tax_id'] != -1 &&
$this->mOrderInfo['tax_percentage'] != 0.00)
{
$tax_amount = round((float)$total_cost *
(float)$this->mOrderInfo['tax_percentage'], 2)
/ 100.00;
$order_details .= 'Tax: ' . $this->mOrderInfo['tax_type'] . ', $' .
number_format($tax_amount, 2, '.', '') .
$new_line;
$total_cost += $tax_amount;
}
$order_details .= $new_line . 'Total order cost: $' .
number_format($total_cost, 2, '.', '');
return $order_details;
}
How It Works: Order Processor Modifications
You??™ve made several changes to your Orders and OrderProcessor classes, and you??™ve created quite a few
database stored procedures. This is all infrastructure code that supports implementing the order pipeline, which is
a must for a professional e-commerce site.
CHAPTER 18 ?– IMPLEMENTING THE ORDER PIPELINE: PART 1 591
Summary
We??™ve begun to build the backbone of the application, and we??™ve prepared it for the lion??™s share
of the order pipeline??“processing functionality that we??™ll implement in the next chapter.
Pages:
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710