|
eZ Publish
[4.0]
|
00001 <?php 00002 // 00003 // Created on: <08-Aug-2006 15:23:10 bjorn> 00004 // 00005 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00006 // SOFTWARE NAME: eZ Publish 00007 // SOFTWARE RELEASE: 4.0.x 00008 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS 00009 // SOFTWARE LICENSE: GNU General Public License v2.0 00010 // NOTICE: > 00011 // This program is free software; you can redistribute it and/or 00012 // modify it under the terms of version 2.0 of the GNU General 00013 // Public License as published by the Free Software Foundation. 00014 // 00015 // This program is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU General Public License for more details. 00019 // 00020 // You should have received a copy of version 2.0 of the GNU General 00021 // Public License along with this program; if not, write to the Free 00022 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00023 // MA 02110-1301, USA. 00024 // 00025 // 00026 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00027 // 00028 00029 /*! \file ezdefaultconfirmorderhandler.php 00030 */ 00031 00032 /*! 00033 \class eZDefaultConfirmOrderHandler ezdefaultconfirmorderhandler.php 00034 \brief The class eZDefaultConfirmOrderHandler does 00035 00036 */ 00037 00038 class eZDefaultConfirmOrderHandler 00039 { 00040 /*! 00041 Constructor 00042 */ 00043 function eZDefaultConfirmOrderHandler() 00044 { 00045 } 00046 00047 function execute( $params = array() ) 00048 { 00049 $ini = eZINI::instance(); 00050 $sendOrderEmail = $ini->variable( 'ShopSettings', 'SendOrderEmail' ); 00051 if ( $sendOrderEmail == 'enabled' ) 00052 { 00053 $this->sendOrderEmail( $params ); 00054 } 00055 } 00056 00057 function sendOrderEmail( $params ) 00058 { 00059 $ini = eZINI::instance(); 00060 if ( isset( $params['order'] ) and 00061 isset( $params['email'] ) ) 00062 { 00063 $order = $params['order']; 00064 $email = $params['email']; 00065 00066 require_once( "kernel/common/template.php" ); 00067 $tpl = templateInit(); 00068 $tpl->setVariable( 'order', $order ); 00069 $templateResult = $tpl->fetch( 'design:shop/orderemail.tpl' ); 00070 00071 $subject = $tpl->variable( 'subject' ); 00072 00073 //include_once( 'lib/ezutils/classes/ezmail.php' ); 00074 //include_once( 'lib/ezutils/classes/ezmailtransport.php' ); 00075 $mail = new eZMail(); 00076 00077 $emailSender = $ini->variable( 'MailSettings', 'EmailSender' ); 00078 if ( !$emailSender ) 00079 $emailSender = $ini->variable( "MailSettings", "AdminEmail" ); 00080 00081 $mail->setReceiver( $email ); 00082 $mail->setSender( $emailSender ); 00083 $mail->setSubject( $subject ); 00084 $mail->setBody( $templateResult ); 00085 $mailResult = eZMailTransport::send( $mail ); 00086 00087 $email = $ini->variable( 'MailSettings', 'AdminEmail' ); 00088 00089 $mail = new eZMail(); 00090 00091 $mail->setReceiver( $email ); 00092 $mail->setSender( $emailSender ); 00093 $mail->setSubject( $subject ); 00094 $mail->setBody( $templateResult ); 00095 $mailResult = eZMailTransport::send( $mail ); 00096 } 00097 } 00098 } 00099 00100 ?>