Advertisement
Guest User

Untitled

a guest
Feb 18th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. $this->load->model('checkout/success');
  2. $data['products'] = array();
  3. $data['products'] = $this->model_checkout_success->getProducts($order_id);
  4.  
  5. unset($mail);
  6. $mail = new Mail();
  7. $mail->protocol = $this->config->get('config_mail_protocol');
  8. $mail->parameter = $this->config->get('config_mail_parameter');
  9. $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
  10. $mail->smtp_username = $this->config->get('config_mail_smtp_username');
  11. $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
  12. $mail->smtp_port = $this->config->get('config_mail_smtp_port');
  13. $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
  14.  
  15. foreach ($data['products'] as $product) {
  16. $data['text_greeting'] = $this->language->get('text_greeting');
  17.  
  18. $mail->setTo($product['email']);
  19. $mail->setFrom($this->config->get('config_email'));
  20. $mail->setSender(html_entity_decode('testing sender', ENT_QUOTES, 'UTF-8'));
  21. $mail->setSubject(html_entity_decode('testing', ENT_QUOTES, 'UTF-8'));
  22. $mail->setHtml($this->load->view('mail/checkout', $data));
  23. $mail->send();
  24. }
  25.  
  26. public function getProducts($order_id) {
  27. $this->language->load('checkout/success');
  28. $query = $this->db->query("SELECT DISTINCT u.email as email, u.shopname, u.user_id, o.order_id,
  29. CONCAT(oi.invoice_prefix_no,oi.invoice_order_no) as invoice FROM " . DB_PREFIX . "order o LEFT JOIN
  30. " . DB_PREFIX . "order_product op ON (op.order_id = o.order_id) LEFT JOIN " . DB_PREFIX . "user u ON
  31. (u.user_id = op.user_id) LEFT JOIN order_invoice oi ON (oi.order_id = o.order_id AND oi.user_id = u.user_id)
  32. WHERE o.order_id = '" . (int)$order_id . "'");
  33. return $query->rows;
  34. }
  35.  
  36. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
  37. <html>
  38. <head>
  39. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  40. <title>Order</title>
  41. </head>
  42. <body style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;">
  43. <div style="width: 680px;">
  44. <p style="font-size:13px; margin-top: 0px; margin-bottom: 20px;"><?php echo $text_greeting; ?></p>
  45. </div>
  46. </body>
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement