shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

transaction.php (2291B)


      1 <?php
      2 class ControllerMailTransaction extends Controller {
      3 	public function index($route, $args, $output) {
      4 		if (isset($args[0])) {
      5 			$customer_id = $args[0];
      6 		} else {
      7 			$customer_id = '';
      8 		}
      9 		
     10 		if (isset($args[1])) {
     11 			$description = $args[1];
     12 		} else {
     13 			$description = '';
     14 		}		
     15 		
     16 		if (isset($args[2])) {
     17 			$amount = $args[2];
     18 		} else {
     19 			$amount = '';
     20 		}
     21 		
     22 		if (isset($args[3])) {
     23 			$order_id = $args[3];
     24 		} else {
     25 			$order_id = '';
     26 		}
     27 			
     28 		$this->load->model('customer/customer');
     29 						
     30 		$customer_info = $this->model_customer_customer->getCustomer($customer_id);
     31 
     32 		if ($customer_info) {
     33 			$this->load->language('mail/transaction');
     34 
     35 			$this->load->model('setting/store');
     36 
     37 			$store_info = $this->model_setting_store->getStore($customer_info['store_id']);
     38 
     39 			if ($store_info) {
     40 				$store_name = $store_info['name'];
     41 			} else {
     42 				$store_name = $this->config->get('config_name');
     43 			}
     44 
     45 			$data['text_received'] = sprintf($this->language->get('text_received'), $this->currency->format($amount, $this->config->get('config_currency')));
     46 			$data['text_total'] = sprintf($this->language->get('text_total'), $this->currency->format($this->model_customer_customer->getTransactionTotal($customer_id), $this->config->get('config_currency')));
     47 			
     48 			$mail = new Mail($this->config->get('config_mail_engine'));
     49 			$mail->parameter = $this->config->get('config_mail_parameter');
     50 			$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
     51 			$mail->smtp_username = $this->config->get('config_mail_smtp_username');
     52 			$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
     53 			$mail->smtp_port = $this->config->get('config_mail_smtp_port');
     54 			$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
     55 
     56 			$mail->setTo($customer_info['email']);
     57 			$mail->setFrom($this->config->get('config_email'));
     58 			$mail->setSender(html_entity_decode($store_name, ENT_QUOTES, 'UTF-8'));
     59 			$mail->setSubject(sprintf($this->language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8')));
     60 			$mail->setText($this->load->view('mail/transaction', $data));
     61 			$mail->send();
     62 		}
     63 	}		
     64 }