Схема
public mixed
addReward (
$customer_id, $description = '', $points = '', $order_id = 0 )
Аргументы
| Аргумент |
Возможный тип |
Описание |
| $customer_id |
— |
— |
| $description = '' |
— |
— |
| $points = '' |
— |
— |
| $order_id = 0 |
— |
— |
Описание
Метод пока еще не документирован.
Исходный код
$customer_info = $this->getCustomer($customer_id);
if ($customer_info) {
$this->db->query("INSERT INTO " . DB_PREFIX . "customer_reward SET customer_id = '" . (int)$customer_id . "', order_id = '" . (int)$order_id . "', points = '" . (int)$points . "', description = '" . $this->db->escape($description) . "', date_added = NOW()");
$this->language->load('mail/customer');
if ($order_id) {
$this->load->model('sale/order');
$order_info = $this->model_sale_order->getOrder($order_id);
if ($order_info) {
$store_name = $order_info['store_name'];
} else {
$store_name = $this->config->get('config_name');
}
} else {
$store_name = $this->config->get('config_name');
}
$message = sprintf($this->language->get('text_reward_received'), $points) . "\n\n";
$message .= sprintf($this->language->get('text_reward_total'), $this->getRewardTotal($customer_id));
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($customer_info['email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($store_name);
$mail->setSubject(html_entity_decode(sprintf($this->language->get('text_reward_subject'), $store_name), ENT_QUOTES, 'UTF-8'));
$mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
$mail->send();
}