Prev | Current Page 683 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

php and
presentation/admin_orders.php to process an order */
public function Process()
{
// Configure processor
$this->mContinueNow = true;
// Log start of execution
$this->CreateAudit('Order Processor started.', 10000);
// Process pipeline section
try
{
while ($this->mContinueNow)
{
$this->mContinueNow = false;
$this->_GetCurrentPipelineSection();
$this->_mCurrentPipelineSection->Process($this);
}
}
catch(Exception $e)
{
$this->MailAdmin('Order Processing error occurred.',
'Exception: "' . $e->getMessage() . '" on ' .
$e->getFile() . ' line ' . $e->getLine(),
$this->_mOrderProcessStage);
CHAPTER 18 ?–  IMPLEMENTING THE ORDER PIPELINE: PART 1 577
$this->CreateAudit('Order Processing error occurred.', 10002);
throw new Exception('Error occurred, order aborted. ' .
'Details mailed to administrator.');
}
$this->CreateAudit('Order Processor finished.', 10001);
}
// Adds audit message
public function CreateAudit($message, $code)
{
Orders::CreateAudit($this->mOrderInfo['order_id'], $message, $code);
}
// Builds e-mail message
public function MailAdmin($subject, $message, $sourceStage)
{
$to = ADMIN_EMAIL;
$headers = 'From: ' . ORDER_PROCESSOR_EMAIL . "\r\n";
$body = 'Message: ' . $message . "\n" .
'Source: ' . $sourceStage . "\n" .
'Order ID: ' . $this->mOrderInfo['order_id'];
$result = mail($to, $subject, $body, $headers);
if ($result === false)
{
throw new Exception ('Failed sending this mail to administrator:' .


Pages:
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695
noclegi w górach judo łódź meble biurowe Poker Porady bukmacher