* @license PHP License * @package WB * @subpackage base */ WBClass::load('WBEvent_Handler' , 'WBEvent_Handler_Shop' , 'WBEvent_Handler_Shop_Cart' , 'WBEvent_Handler_Mail' , 'WBShop' , 'WBShop_Cart' , 'patI18n'); /** * WBEvent_Handler_ITS_MailCustomer * * Send e-mail to customer * * @version 1.0.0 * @package Wombat * @subpackage base */ class WBEvent_Handler_Shop_Cart_MailCustomer extends WBEvent_Handler_Shop_Cart { /** * Handler config * * For parameter list see parent class, additional parameter: * * @see WBEvent_Handler_Mail * @var array */ protected $config = array( 'from' => '', 'fromindex' => '', 'rcpt' => '', 'rcptindex' => 'email', 'addrcpt' => '', 'lang' => '', 'langindex' => '', 'tmpl' => 'email', 'eventuser' => 'uid', 'loadcart' => 'id' ); /** * User object * @var WBUser */ private $user; /** * @var WBDictionary_URL */ private $dict; /** * actually send e-mails * @var WBEvent_Handler_Mail */ private $mail; /** * Process event * * Send e-mail to customer * * @param WBEvent $e * @return bool true to continue, false to stop processing * @throws Exception in case of error */ public function process(WBEvent $e) { $data = $e->get(); $this->loadCart($e); // if user is the same, no e-mail required if ($this->cart->getUser() == $e->get($this->config['eventuser'], '')) { return true; } // load owning user of cart $this->user = WBClass::create('WBUser'); if (!$this->user->load($this->cart->getUser())) { return true; } $user = $this->user->getData(); $this->config['rcpt'] = $user['email']; $this->config['lang'] = $user['lang']; $this->mergeCartData($e); $this->mail = WBClass::create('WBEvent_Handler_Mail'); $this->mail->setConfig($this->config); $this->mail->process($e); return true; } }