如何为opencart vqmod 安装安装VQMOD安装设置

opencart安装和使用PHPMailer - Gulibao - 博客园
科技改变生活!
一、安装PHPMailer
&1)先给opencart项目安装vqmod
下载最新版本:&&(目前最新版本是vqmod-2.5.1-standard)
把解压出来的文件放到opencart根目录下
你能看到成功信息&VQMOD ALREADY INSTALLED!&. 如果没有,就检查3,4步
2)下载PHPMailerV2.1.zip
  把PHPMailerV2.1.zip解压出来的文件夹&upload下的文件:
  system/library/phpmailer  vqmod/xml/PHPMailerV2.xml
  分别放到opencart项目对应的目录下:
  system/library/
  vqmod/xml/
二、修复PHPMailerV2.1.zip的PHPMailerV2.xml的2个bug,不知道为啥开发改插件的人没发现
1)PHPMailerV2.xml文件中添加的send()函数,编译生成会导致多出一个'}',去掉126行的'}';
2)xml中的host_name,port,username,password跟opencart项目的变量不对应,应该改成smtp_hostname,smtp_port,smtp_username,smtp_
1 &modification&
&id&PHPMailer&/id&
&version&2.0&/version&
&vqmver&1.0.4&/vqmver&
&author&SpotOnSolutions.net&/author&
&file name="system/library/mail.php"&
&operation&
&search position="before"&&![CDATA[
class Mail
]]&&/search&
&add&&![CDATA[include_once(DIR_SYSTEM . 'library/phpmailer/class.phpmailer.php');]]&&/add&
&/operation&
&operation&
&search position="before"&&![CDATA[
protected $
]]&&/search&
&add&&![CDATA[
protected $]]&&/add&
&/operation&
&operation&
&search position="before"&&![CDATA[
public function setSubject
]]&&/search&
&add&&![CDATA[
public function setReadReceipt($readreceipt) {
$this-&readreceipt = $
&/operation&
&operation&
&search position="before"&&![CDATA[public function send() {]]&&/search&
&add&&![CDATA[/*]]&&/add&
&/operation&
&operation&
&search position="bottom" offset="2"&&![CDATA[
public function send() {
]]&&/search&
&add&&![CDATA[*/
public function send() {
if (!$this-&to) {
trigger_error('Error: E-Mail to required!');
if (!$this-&from) {
trigger_error('Error: E-Mail from required!');
if (!$this-&sender) {
trigger_error('Error: E-Mail sender required!');
if (!$this-&subject) {
trigger_error('Error: E-Mail subject required!');
if ((!$this-&text) && (!$this-&html)) {
trigger_error('Error: E-Mail message required!');
= new PHPMailer();
$mail-&CharSet = "UTF-8";
if (is_array($this-&to)) {
foreach ($this-&to as $toTmp){
$mail-&AddAddress($toTmp);
$mail-&AddAddress($this-&to);
if(!empty($this-&readreceipt)) {
$mail-&ConfirmReadingTo = $this-&
$mail-&Subject = $this-&
$mail-&AddReplyTo($this-&from, $this-&sender);
$mail-&SetFrom($this-&from, $this-&sender);
$mail-&AddReplyTo($this-&from, $this-&sender);
if (!$this-&html) {
$mail-&Body = $this-&
$mail-&MsgHTML($this-&html);
if ($this-&text) {
$mail-&AltBody = $this-&
$mail-&AltBody = 'This is a HTML email and your email client software does not support HTML email!';
foreach ($this-&attachments as $attachment) {
if (file_exists($attachment['file'])) {
$mail-&AddAttachment($attachment['file']);
if ($this-&protocol == 'smtp') {
$mail-&IsSMTP();
$mail-&Host = $this-&hostname;
$mail-&Port = $this-&port;
if($this-&port == '587'){
$mail-&SMTPAuth =
$mail-&SMTPSecure = "tls";
} elseif ($this-&port == '465') {
$mail-&SMTPAuth =
$mail-&SMTPSecure = "ssl";
if (!empty($this-&username)
&& !empty($this-&password)) {
$mail-&SMTPAuth =
$mail-&Host = $this-&hostname;
$mail-&Username = $this-&username;
$mail-&Password = $this-&password;
$mail-&Send();
&/operation&
132 &/modification&
修复后的xml:
1 &modification&
&id&PHPMailer&/id&
&version&2.0&/version&
&vqmver&1.0.4&/vqmver&
&author&SpotOnSolutions.net&/author&
&file name="system/library/mail.php"&
&operation&
&search position="before"&&![CDATA[
class Mail
]]&&/search&
&add&&![CDATA[include_once(DIR_SYSTEM . 'library/phpmailer/class.phpmailer.php');]]&&/add&
&/operation&
&operation&
&search position="before"&&![CDATA[
protected $
]]&&/search&
&add&&![CDATA[
protected $]]&&/add&
&/operation&
&operation&
&search position="before"&&![CDATA[
public function setSubject
]]&&/search&
&add&&![CDATA[
public function setReadReceipt($readreceipt) {
$this-&readreceipt = $
&/operation&
&operation&
&search position="before"&&![CDATA[public function send() {]]&&/search&
&add&&![CDATA[/*]]&&/add&
&/operation&
&operation&
&search position="bottom" offset="2"&&![CDATA[
public function send() {
]]&&/search&
&add&&![CDATA[*/
public function send() {
if (!$this-&to) {
trigger_error('Error: E-Mail to required!');
if (!$this-&from) {
trigger_error('Error: E-Mail from required!');
if (!$this-&sender) {
trigger_error('Error: E-Mail sender required!');
if (!$this-&subject) {
trigger_error('Error: E-Mail subject required!');
if ((!$this-&text) && (!$this-&html)) {
trigger_error('Error: E-Mail message required!');
= new PHPMailer();
$mail-&CharSet = "UTF-8";
if (is_array($this-&to)) {
foreach ($this-&to as $toTmp){
$mail-&AddAddress($toTmp);
$mail-&AddAddress($this-&to);
if(!empty($this-&readreceipt)) {
$mail-&ConfirmReadingTo = $this-&
$mail-&Subject = $this-&
$mail-&AddReplyTo($this-&from, $this-&sender);
$mail-&SetFrom($this-&from, $this-&sender);
$mail-&AddReplyTo($this-&from, $this-&sender);
if (!$this-&html) {
$mail-&Body = $this-&
$mail-&MsgHTML($this-&html);
if ($this-&text) {
$mail-&AltBody = $this-&
$mail-&AltBody = 'This is a HTML email and your email client software does not support HTML email!';
foreach ($this-&attachments as $attachment) {
if (file_exists($attachment['file'])) {
$mail-&AddAttachment($attachment['file']);
if ($this-&protocol == 'smtp') {
$mail-&IsSMTP();
$mail-&Host = $this-&smtp_
$mail-&Port = $this-&smtp_
if($this-&smtp_port == '587'){
$mail-&SMTPAuth =
$mail-&SMTPSecure = "tls";
} elseif ($this-&smtp_port == '465') {
$mail-&SMTPAuth =
$mail-&SMTPSecure = "ssl";
if (!empty($this-&smtp_username)
&& !empty($this-&smtp_password)) {
$mail-&SMTPAuth =
$mail-&Host = $this-&smtp_
$mail-&Username = $this-&smtp_
$mail-&Password = $this-&smtp_
$mail-&Send();
&/operation&
131 &/modification&
三、配置opencart后台的mail设置
系统设置-&网店设置-&编辑
协议选择SMTP,我使用的是,用户名是你的邮箱 。注意:你的邮箱必须是开通了smtp权限的才可以
最重要的一点:常规 设置里的E-Mail必须填写成跟 邮件 上面的用户的邮箱一致,因为opencart发邮件所使用的是&常规 设置里的E-Mail
到此完毕!opencart是一个用PHP开发的网上商城程序,据说是一位英国人独自完成的,赞一个!
vqmod是opencart的一种编程机制,可以理解为vqmod就是opencart的插件。
既然将vqmod认为是opencart的插件,那它必然是一个或多个文件,事实也是如此;
文件位置:vqmod/xml(当前目录均为网站根目录,下同)
文件格式:xml格式,
原理:文本查找、替换换增加
举例说明:vqmod_add_sku.xml
&modification&&&&&&&& /* 根 */
&& &&id&Very simple AJAX live search&/id&
&& &&version&1.0.0&/version&
&& &&vqmver&1.2.3&/vqmver&
&& &&author&n[oO]ne&/author&
&& &&file name=&admin/controller/catalog/product.php&&&& &&& &/* 替换的文件名*/
&& &&& &&operation&
&& &&& &&& &&search position=&after&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& /*ater: 在寻找到的字符串后面增加;before:在寻找到的字符串前面增加;replace:替换寻找到的字符串*/
&& &&& &&& &&& &&![CDATA[
&& &&& &&& &$this-&data['products'][] = array(&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &/* 查找的字符串*/
&& &&& &&& &&& &]]&
&& &&& &&& &&/search&
&& &&& &&& &&add&
&& &&& &&& &&& &&![CDATA[
&& &&& &&& &'sku'&&&&& =& $result['sku'],&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& & /* 增加或替换的字符串*/
&& &&& &&& &'upc'&&&&& =& $result['upc'],
&& &&& &&& &&& &]]&
&& &&& &&& &&/add&
&& &&& &&/operation&
&&& &/file&
看到这里大家就明白了,vqmod的机制就是当执行某一程序(比如a.php,也可以是模型文件和视图文件)时,先查找vqmod/目录下的所有xml文件,有没有&file name=&a.php&;若没有,就正常执行;若有,就按这个xml文件的说明替换掉源文件,再执行这替换后的文件。所以系统会有一个位置存储这些替换后生成的文件,这个位置就是vqmod/vqcache,而且文件名有规律,比如上例中的name=&admin/controller/catalog/product.php&,则替换后的文件名为vq2-admin_controller_catalog_product.php。大家若有兴趣,不妨打开这三个文件,对比一下就一目了然了。
本文已收录于以下专栏:
相关文章推荐
vQmod可在执行过程中不修改任何原本的核心文件,而对于原核心文件产生虚拟改变的效果。
一开始下了针对opencart2.0.3.1的vqmod软件包:“opencart-2-0-3-1-vqmod-2-5-1-6”(链接:/index.ph...
vQmod (全称 Virtual Quick Mod),是 OpenCart 系统上一个可以以虚拟方式修改原文件内容而设计的一个插件系统。它的使用很简单,我们先用 xml 的方式编写出要搜索的代码行...
如果对opencart感兴趣,建议您加入QQ群:进行讨论。
访问路径:商品目录(Catalog) -& 选项(Options),点击后出现下图所示:
点击【新增】Inse...
本教程由 opencart中国网站 制作,如有转载请注明出处:
/bbs/topic1017.html
在使用opencart时有什么困惑或者...
他的最新文章
讲师:汪剑
讲师:刘道宽
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)}

我要回帖

更多关于 opencart 安装插件 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信