public function resetPasswordMail($email, $password) { $customer = $this->getCustomerByEmail($email); $data = array('firstname' => $customer['firstname'], 'lastname' => $customer['lastname'], 'email' => $customer['email'], 'password' => $password); #Reset Password id = 3 $subject = $this->emailtemplate->getSubject('Customer', 'customer_3', $data); $message = $this->emailtemplate->getMessage('Customer', 'customer_3', $data); $mail = new Mail($this->config->get('config_mail')); $mail->setTo($data['email']); $mail->setFrom($this->config->get('config_email')); $mail->setSender($this->config->get('config_name')); $mail->setSubject($subject); $mail->setHTML($message); $mail->send(); }
public function sendCustomerRegisterMail($data) { if (isset($data['customer_group_id']) && is_array($this->config->get('config_customer_group_display')) && in_array($data['customer_group_id'], $this->config->get('config_customer_group_display'))) { $customer_group_id = $data['customer_group_id']; } else { $customer_group_id = $this->config->get('config_customer_group_id'); } $this->load->model('sale/customer_group'); $customer_group_info = $this->model_sale_customer_group->getCustomerGroup($customer_group_id); #Get Email Template if (!$customer_group_info['approval']) { #Customer Registration Register $subject = $this->emailtemplate->getSubject('Customer', 'customer_1', $data); $message = $this->emailtemplate->getMessage('Customer', 'customer_1', $data); } else { #Customer Registration Approve $subject = $this->emailtemplate->getSubject('Customer', 'customer_2', $data); $message = $this->emailtemplate->getMessage('Customer', 'customer_2', $data); } $mail = new Mail($this->config->get('config_mail')); $mail->setTo($data['email']); $mail->setFrom($this->config->get('config_email')); $mail->setSender($this->config->get('config_name')); $mail->setSubject($subject); $mail->setHTML($message); $mail->send(); // Send to main admin email if new account email is enabled if ($this->config->get('config_account_mail')) { $mail->setTo($this->config->get('config_email')); $mail->send(); $emails = explode(',', $this->config->get('config_alert_emails')); foreach ($emails as $email) { if (strlen($email) > 0 && preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/i', $email)) { $mail->setTo($email); $mail->send(); } } } }
public function resetPasswordMail($email, $password) { $affiliate = $this->getAffiliateByEmail($email); $data = array('firstname' => $affiliate['firstname'], 'lastname' => $affiliate['lastname'], 'email' => $affiliate['email'], 'password' => $password); $subject = $this->emailtemplate->getSubject('Affiliate', 'affiliate_3', $data); $message = $this->emailtemplate->getMessage('Affiliate', 'affiliate_3', $data); $mail = new Mail($this->config->get('config_mail')); $mail->setTo($data['email']); $mail->setFrom($this->config->get('config_email')); $mail->setSender($this->config->get('config_name')); $mail->setSubject($subject); $mail->setHTML($message); $mail->send(); }
public function suporte() { $assunto = $this->request->get['suporteAssunto']; $mensagem = $this->request->get['suporteMensagem']; $mensagem .= '<br/><br/>Site: ' . HTTP_CATALOG; $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('*****@*****.**'); $mail->setFrom($this->config->get('config_email')); $mail->setSender($this->config->get('config_name')); $mail->setSubject($assunto); $mail->setHTML($mensagem); $mail->send(); }
public function addOrderHistory($order_id, $order_status_id, $comment = '', $notify = false) { $this->trigger->fire('pre.order.history.add', $order_id); $order_info = $this->getOrder($order_id); if ($order_info) { // Fraud Detection $this->load->model('account/customer'); $customer_info = $this->model_account_customer->getCustomer($order_info['customer_id']); if ($customer_info && $customer_info['safe']) { $safe = true; } else { $safe = false; } if ($this->config->get('config_fraud_detection')) { $this->load->model('checkout/fraud'); $risk_score = $this->model_checkout_fraud->getFraudScore($order_info); if (!$safe && $risk_score > $this->config->get('config_fraud_score')) { $order_status_id = $this->config->get('config_fraud_status_id'); } } // Ban IP if (!$safe) { $status = false; if ($order_info['customer_id']) { $results = $this->model_account_customer->getIps($order_info['customer_id']); foreach ($results as $result) { if ($this->model_account_customer->isBanIp($result['ip'])) { $status = true; break; } } } else { $status = $this->model_account_customer->isBanIp($order_info['ip']); } if ($status) { $order_status_id = $this->config->get('config_order_status_id'); } } $this->db->query("UPDATE `" . DB_PREFIX . "order` SET order_status_id = '" . (int) $order_status_id . "', date_modified = NOW() WHERE order_id = '" . (int) $order_id . "'"); $this->db->query("INSERT INTO " . DB_PREFIX . "order_history SET order_id = '" . (int) $order_id . "', order_status_id = '" . (int) $order_status_id . "', notify = '" . (int) $notify . "', comment = '" . $this->db->escape($comment) . "', date_added = NOW()"); // If current order status is not processing or complete but new status is processing or complete then commence completing the order if (!in_array($order_info['order_status_id'], array_merge($this->config->get('config_processing_status'), $this->config->get('config_complete_status'))) && in_array($order_status_id, array_merge($this->config->get('config_processing_status'), $this->config->get('config_complete_status')))) { // Stock subtraction $order_product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int) $order_id . "'"); foreach ($order_product_query->rows as $order_product) { $this->db->query("UPDATE " . DB_PREFIX . "product SET quantity = (quantity - " . (int) $order_product['quantity'] . ") WHERE product_id = '" . (int) $order_product['product_id'] . "' AND subtract = '1'"); $order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int) $order_id . "' AND order_product_id = '" . (int) $order_product['order_product_id'] . "'"); foreach ($order_option_query->rows as $option) { $this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET quantity = (quantity - " . (int) $order_product['quantity'] . ") WHERE product_option_value_id = '" . (int) $option['product_option_value_id'] . "' AND subtract = '1'"); } } // Redeem coupon, vouchers and reward points $order_total_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_total` WHERE order_id = '" . (int) $order_id . "' ORDER BY sort_order ASC"); foreach ($order_total_query->rows as $order_total) { $this->load->model('total/' . $order_total['code']); if (method_exists($this->{'model_total_' . $order_total['code']}, 'confirm')) { $this->{'model_total_' . $order_total['code']}->confirm($order_info, $order_total); } } // Add commission if sale is linked to affiliate referral. if ($order_info['affiliate_id'] && $this->config->get('config_affiliate_auto')) { $this->load->model('affiliate/affiliate'); $this->model_affiliate_affiliate->addCommission($order_info['affiliate_id'], $order_info['commission'], $order_id); } } // If old order status is the processing or complete status but new status is not then commence restock, and remove coupon, voucher and reward history if (in_array($order_info['order_status_id'], array_merge($this->config->get('config_processing_status'), $this->config->get('config_complete_status'))) && !in_array($order_status_id, array_merge($this->config->get('config_processing_status'), $this->config->get('config_complete_status')))) { // Restock $product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int) $order_id . "'"); foreach ($product_query->rows as $product) { $this->db->query("UPDATE `" . DB_PREFIX . "product` SET quantity = (quantity + " . (int) $product['quantity'] . ") WHERE product_id = '" . (int) $product['product_id'] . "' AND subtract = '1'"); $option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int) $order_id . "' AND order_product_id = '" . (int) $product['order_product_id'] . "'"); foreach ($option_query->rows as $option) { $this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET quantity = (quantity + " . (int) $product['quantity'] . ") WHERE product_option_value_id = '" . (int) $option['product_option_value_id'] . "' AND subtract = '1'"); } } // Remove coupon, vouchers and reward points history $this->load->model('account/order'); $order_total_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_total` WHERE order_id = '" . (int) $order_id . "' ORDER BY sort_order ASC"); foreach ($order_total_query->rows as $order_total) { $this->load->model('total/' . $order_total['code']); if (method_exists($this->{'model_total_' . $order_total['code']}, 'unconfirm')) { $this->{'model_total_' . $order_total['code']}->unconfirm($order_id); } } // Remove commission if sale is linked to affiliate referral. if ($order_info['affiliate_id']) { $this->load->model('affiliate/affiliate'); $this->model_affiliate_affiliate->deleteCommission($order_id); } } $this->cache->delete('product'); if (in_array($order_status_id, array_merge($this->config->get('config_processing_status'), $this->config->get('config_complete_status'))) || $notify) { $order_status = $this->db->query("SELECT name FROM " . DB_PREFIX . "order_status WHERE order_status_id = '" . (int) $order_status_id . "' AND language_id = '" . (int) $order_info['language_id'] . "'"); if ($order_status->num_rows) { $order_status = $order_status->row['name']; } else { $order_status = ''; } // Account Href $order_href = ''; if ($order_info['customer_id']) { $order_href = $order_info['store_url'] . 'index.php?route=account/order/info&order_id=' . $order_info['order_id']; } #Address Shipping and Payment $totals = array(); $tax_amount = 0; if (strlen($order_info['shipping_firstname']) != 0) { $address = $order_info['shipping_firstname'] . ' ' . $order_info['shipping_lastname'] . '<br />' . (strlen($order_info['shipping_company']) != 0 ? $order_info['shipping_company'] . '<br />' : '') . '' . $order_info['shipping_address_1'] . '<br />' . $order_info['shipping_city'] . ' ' . $order_info['shipping_postcode'] . '<br />' . $order_info['shipping_zone'] . ' ' . $order_info['shipping_country']; } else { $address = ''; } if (strlen($order_info['payment_firstname']) != 0) { $payment_address = $order_info['payment_firstname'] . ' ' . $order_info['payment_lastname'] . '<br />' . (strlen($order_info['payment_company']) != 0 ? $order_info['payment_company'] . '<br />' : '') . '' . $order_info['payment_address_1'] . '<br />' . $order_info['payment_city'] . ' ' . $order_info['payment_postcode'] . '<br />' . $order_info['payment_zone'] . ' ' . $order_info['payment_country']; } else { $payment_address = ''; } $order_total = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_total` WHERE order_id = '" . (int) $order_info['order_id'] . "'"); foreach ($order_total->rows as $total) { $totals[$total['code']][] = array('title' => $total['title'], 'text' => $this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']), 'value' => $total['value']); if ($total['code'] == 'tax') { $tax_amount += $total['value']; } } $special = NULL; $data = array('template_id' => 'order_' . (int) $order_status_id, 'order_info' => $order_info, 'address' => $address, 'payment_address' => $payment_address, 'special' => $special, 'order_href' => $order_href, 'order_status' => $order_status, 'totals' => $totals, 'tax_amount' => $tax_amount, 'invoice_no' => !empty($invoice_no) ? $invoice_no : ''); $subject = $this->emailtemplate->getSubject('OrderAll', 'order_' . (int) $order_status_id, $data); $message = $this->emailtemplate->getMessage('OrderAll', 'order_' . (int) $order_status_id, $data); $getTotal = $order_total->rows; $textData = array('order_info' => $order_info, 'order_id' => $order_id, 'order_status' => $order_status, 'comment' => $comment, 'notify' => $notify, 'getProdcuts' => $this->getOrderProducts($order_id), 'getVouchers' => $this->getOrderVouchers($order_id), 'getTotal' => $getTotal); $text = $this->emailtemplate->getText('Order', 'order', $textData); #Send Email if (!$order_info['order_status_id'] && $order_status_id || $order_info['order_status_id'] && $order_status_id && $notify) { $mail = new Mail($this->config->get('config_mail')); $mail->setTo($order_info['email']); $mail->setFrom($this->config->get('config_email')); $mail->setSender($order_info['store_name']); $mail->setSubject($subject); $mail->setHtml($message); $mail->setText($text); $mail->send(); } if ($this->config->get('config_order_mail')) { if (!isset($mail)) { $mail = new Mail($this->config->get('config_mail')); $mail->setTo($order_info['email']); $mail->setFrom($this->config->get('config_email')); $mail->setSender($order_info['store_name']); } $mail->setHTML($message); $mail->setText($text); $mail->setTo($this->config->get('config_email')); $mail->send(); $emails = explode(',', $this->config->get('config_alert_emails')); foreach ($emails as $email) { if ($email && preg_match('/^[^\\@]+@.*\\.[a-z]{2,6}$/i', $email)) { $mail->setTo($email); $mail->send(); } } } #If select admin send mail AddOrderHistory /*if (($order_info['order_status_id'] && $order_status_id && $notify)) { $mail->setHTML($message); $mail->setText($text); $mail->setTo($this->config->get('config_email')); $mail->send(); $emails = explode(',', $this->config->get('config_alert_emails')); foreach ($emails as $email) { if ($email && preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $email)) { $mail->setTo($email); $mail->send(); } } }*/ } } // If order status in the complete range create any vouchers that where in the order need to be made available. if (!in_array($order_info['order_status_id'], $this->config->get('config_complete_status')) && in_array($order_status_id, $this->config->get('config_complete_status'))) { // Send out any gift voucher mails $this->load->model('checkout/voucher'); $this->model_checkout_voucher->confirm($order_id); } $this->trigger->fire('post.order.history.add', $order_id); }
public function addReturnHistory($return_id, $data) { $this->query("UPDATE PREFIX_return\n SET return_status_id = :status_id,\n date_modified = :date\n WHERE return_id = :id", array('status_id' => $data['return_status_id'], 'date' => date('Y-m-d H:i:s'), 'id' => $return_id)); if (!isset($data['notify'])) { $data['notify'] = 0; } $data['date'] = date('Y-m-d H:i:s'); $data['return_id'] = $return_id; $this->query("INSERT INTO PREFIX_return_history\n SET return_id = :return_id,\n return_status_id = :return_status_id,\n notify = :notify,\n comment = :comment,\n date_added = :date", $data); if ($data['notify']) { $return_data = $this->getReturn($return_id); Mailer::setCustomer($return_data); Mailer::setReturn($return_data); $mail = Mailer::getTemplate('update_return_status_' . $data['return_status_id']); if (!empty($data['comment'])) { $mail['content'] = str_replace('{hasComments}', $data['comment'] . '<br /><br />', $mail['content']); } else { $mail['content'] = str_replace('{hasComments}', '', $mail['content']); } Mail::setTo($return_data['email']); Mail::setSubject($mail['title']); Mail::setHTML($mail['content']); Mail::send(); } Cache::removeAll(); }
echo json_encode($_RETURN); if ($userId != 0 && $_GET['sendMessage'] == 'true') { require_once _ENGINE . 'Mail.class.php'; require_once _ENGINE . 'Auth.class.php'; require_once _ENGINE . 'HTML.class.php'; $Auth = new Auth($Db); $HTML = new HTML(); $HTML->get('template/activationMail.html'); $code = $Auth->generateCode(40); $isAdd = $Db->insert('userActivation', array('code', 'user'), array($code, $userId)); $HTML->replace(array('siteName', 'siteUrl', 'code'), array(_SITENAME, _SITEURL, $code)); $MailSender = new Mail(); $headers = array('From: Blinnaya76 <blinnaya76.ru>'); $MailSender->setHeaders($headers); $MailSender->sendTo($data->mail); $MailSender->setHTML($HTML->get()); $MailSender->sendMail(); } } /** * Пользователи * @method: Получить данные пользователя по ид * @params: ID пользователя * */ if ($_a == 'getUser') { $id = $_GET['id']; $res = $Db->select('SELECT id, login, f, i, o, type, email FROM user WHERE id = ' . $Db->quote($id)); if ($res) { $_RETURN['status'] = 1; $_RETURN['data'] = $res[0]; } else {
public function updateStatus($order_id, $status_id, $sendMail = null, $comment = null) { $this->query("UPDATE PREFIX_orders SET order_status = :status WHERE order_id = :id", array('id' => $order_id, 'status' => $status_id)); if ($sendMail == null) { $sendMail = $this->config->get('customer_notify_email'); } if ($sendMail) { $order_info = $this->getOrder($order_id); Mailer::setOrder($order_info); Mailer::setCustomer($order_info['customer']); //$template = Mailer::getTemplate('update_order_status_' . $status_id, !empty($order_info['customer']['language_id']) ? $order_info['customer']['language_id'] : null); $template = Mailer::getTemplate('update_order_status_' . $status_id, null); Mail::setTo($order_info['customer']['email']); Mail::setSubject($template['title']); if ($comment != null) { $template['content'] = str_replace('{hasComments}', $comment, $template['content']); } else { $template['content'] = str_replace('{hasComments}', '', $template['content']); } Mail::setHTML($template['content']); Mail::send(); } }