shop.balmet.com

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

reward.php (2163B)


      1 <?php
      2 class ControllerMailReward 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 			$points = $args[2];
     18 		} else {
     19 			$points = '';
     20 		}
     21 
     22 		if (isset($args[3])) {
     23 			$order_id = $args[3];
     24 		} else {
     25 			$order_id = 0;
     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/reward');
     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'), $points);
     46 			$data['text_total'] = sprintf($this->language->get('text_total'), $this->model_customer_customer->getRewardTotal($customer_id));
     47 
     48 			$mail = new Mail($this->config->get('config_mail_engine'));
     49 			$mail->protocol = $this->config->get('config_mail_protocol');
     50 			$mail->parameter = $this->config->get('config_mail_parameter');
     51 			$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
     52 			$mail->smtp_username = $this->config->get('config_mail_smtp_username');
     53 			$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
     54 			$mail->smtp_port = $this->config->get('config_mail_smtp_port');
     55 			$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
     56 
     57 			$mail->setTo($customer_info['email']);
     58 			$mail->setFrom($this->config->get('config_email'));
     59 			$mail->setSender(html_entity_decode($store_name, ENT_QUOTES, 'UTF-8'));
     60 			$mail->setSubject(sprintf($this->language->get('text_subject'), html_entity_decode($store_name, ENT_QUOTES, 'UTF-8')));
     61 			$mail->setText($this->load->view('mail/reward', $data));
     62 			$mail->send();
     63 		}
     64 	}
     65 }