TShopping

 找回密碼
 註冊
搜索
查看: 2487|回復: 1

[教學] opencart 如何引入mail function 發信

  [複製鏈接]
發表於 2015-8-1 00:21:15 | 顯示全部樓層 |閱讀模式
 
Push to Facebook
小弟最近在改模組
有需要使用到OPENCART的MAIL發信
於是研究了一下
要讓廠商上架商品後發信給管理員
那我們看看怎麼做
後台找到 admin\model\catalog\product.php

在function addProduct最後
大括弧上 "}"
加入
  1. //add by woff
  2.                 $this->language->load('mail/customer');

  3.                 $subject =  $this->config->get('config_name')." 有廠商商品上架嚕";

  4.                 $message = $this->config->get('config_name')." 親愛的管理員你好\n\n";
  5.                 $message .= "有廠商商品上架嚕 \n\n";

  6.                 $mail = new Mail();
  7.                 $mail->protocol = $this->config->get('config_mail_protocol');
  8.                 $mail->parameter = $this->config->get('config_mail_parameter');
  9.                 $mail->hostname = $this->config->get('config_smtp_host');
  10.                 $mail->username = $this->config->get('config_smtp_username');
  11.                 $mail->password = $this->config->get('config_smtp_password');
  12.                 $mail->port = $this->config->get('config_smtp_port');
  13.                 $mail->timeout = $this->config->get('config_smtp_timeout');                               
  14.                 $mail->setTo($this->config->get('config_email'));
  15.                 $mail->setFrom($this->config->get('config_email'));
  16.                 $mail->setSender($this->config->get('config_name'));
  17.                 $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
  18.                 $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
  19.                 $mail->send();
  20.                 //add by woff
複製代碼
這樣就可以了
完程如下圖

addproduct.png

 

臉書網友討論
發表於 2016-3-13 13:25:36 | 顯示全部樓層
行,有意义,我顶 谢谢您了

版主招募中

*滑块验证:
您需要登錄後才可以回帖 登錄 | 註冊 |

本版積分規則



Archiver|手機版|小黑屋|免責聲明|TShopping

GMT+8, 2024-3-19 16:44 , Processed in 0.159428 second(s), 25 queries .

本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表