一步一步给您的ECMALL加上类似淘宝旺旺的即时通讯功能

2016-07-07 16:48 来源:www.chinab4c.com 作者:ecshop专家

基于ecmall2.0正式版类似淘宝旺旺即时通讯软件功能说明请参看:http://forum.rooyee.biz/read.php?tid=142,针对不少用户都自身扩展了不少插件,为了更好的让大家理解rooyee灵活的程序架构,发布以下手动修改教程,如果你不想修改,请直接下载如意为你修改好的程序文件覆盖就可以,请参看:http://forum.rooyee.biz/read.php?tid=161。
一.修改前提示:
1. 确保您的系统式 ecmall 2.0正式版
2. 确保您已经向RooyeeMessenger 申请了客户端以及服务器端,申请地址:http://forum.rooyee.biz/read.php?tid=162,独立主机用户保证已经安装好了xmpp服务器,安装教程请参看:http://forum.rooyee.biz/read.php?tid=155。
3. 确保你已经将您的网页做好了备份,以便修改出错之后的恢复



回答:
二.Ecmall页面的修改

1.打开ecmall 文件夹下的data/config.inc.php 文件,找到:
  1. 'SUBDOMAIN_SUFFIX' => '',
复制代码

将下列代码复制后粘贴到其后面:

  1. 'RM_SVC' => '', 'RM_XMPPHOST' =>'ecmall.rooyee.biz', 'RM_XMPPPORT' => '8090, 'RM_DOWNLOAD_URL' =>'http://www.rooyee.biz/rooyee.exe',
复制代码


注意:

1. 其中'RM_XMPPHOST' =>'ecmall.rooyee.biz',”ecmall.rooyeebiz”项如果您是独立主机用户此处替换为您自己的xmpp服务器域名,如果您使用的是如意为您提供的免费服务器此处保持不变
2. 'RM_XMPPPORT' => 8090,此处填写的为xmpp服务器端口,如果您是独立用户此处替换为xmpp服务器默认端口“9090“,如果您是如意免费服务器用户此处保持不变。
3. 'RM_DOWNLOAD_URL' =>'http://www.rooyee.biz/rooyee.exe',此处填写的为客户端下载地址,不论独立主机用户还是虚拟主机用户,请正确替换为可以让您的用户下载的客户端地址。

2.打开app\buyer_order.app.php文件,找到

  1. $this->assign('order', $order_info);
  2. $this->assign($order_detail['data']);
复制代码

将下列代码复制后粘贴到其后面:

  1. /* RMStart */
  2. $this->assign('rmlink', $this->rmsvc->getStatePicTxtById($order_info['seller_id'],
  3. array('subject_id'=>$order_info['order_id'],
  4. 'subject_type'=>'buyer_order',
  5. 'to'=>$this->rmsvc->id_user($order_info['seller_id'], 'user_name'))));
  6. /* RMEnd */
复制代码


找到
  1. /* 发送给卖家订单取消通知 */
  2. $model_member =& m('member');
  3. $seller_info = $model_member->get($order_info['seller_id']);
  4. $mail = get_mail('toseller_cancel_order_notify', array('order' => $order_info, 'reason' => $_POST['remark']));
  5. $this->_mailto($seller_info['email'], addslashes($mail['subject']), addslashes($mail['message']));
复制代码

在将下列代码复制后粘贴到其后面:
  1. /* RMStart */
  2. $this->rmsvc->xmpp_send($seller_info['user_name'], $mail['subject'], $mail['message']);
  3. /* RMEnd */
复制代码


找到:
  1. /* 发送给卖家买家确认收货邮件,交易完成 */
  2. $model_member =& m('member');
  3. $seller_info = $model_member->get($order_info['seller_id']);
  4. $mail = get_mail('toseller_finish_notify', array('order' => $order_info));
  5. $this->_mailto($seller_info['email'], addslashes($mail['subject']), addslashes($mail['message']));
复制代码

在将下列代码复制后粘贴到其后面:
  1. /* RMStart */
  2. $this->rmsvc->xmpp_send($seller_info['user_name'], $mail['subject'], $mail['message']);
  3. /* RMEnd */
复制代码


找到:

  1. foreach ($orders as $key1 => $order)
  2. {
  3. foreach ($order['order_goods'] as $key2 => $goods)
  4. {
  5. empty($goods['goods_image']) && $orders[$key1]['order_goods'][$key2]['goods_image'] = Conf::get('default_goods_image');
  6. }
复制代码

在将下列代码复制后粘贴到其后面:
  1. /* RMStart */
  2. $orders[$key1]['rmlink'] = $this->rmsvc->getStatePicTxtById($order['seller_id'],
  3. array('subject_id'=>$order['order_id'],
  4. 'subject_type'=>'buyer_order',
  5. 'to'=>$this->rmsvc->id_user($order['seller_id'], 'user_name')));
  6. /* RMEnd */
复制代码

3.打开app\cashier.app.php文件 ,找到:

  1. /* 线下支付完成并留下pay_message,发送给卖家付款完成提示邮件 */
  2. $model_member =& m('member');
  3. $seller_info= $model_member->get($order_info['seller_id']);
  4. $mail = get_mail('toseller_offline_pay_notify', array('order' => $order_info, 'pay_message' => $pay_message));
  5. $this->_mailto($seller_info['email'], addslashes($mail['subject']), addslashes($mail['message']));
复制代码

将下列代码复制后粘贴到其后面:

  1. /* RMStart */
  2. $this->rmsvc->xmpp_send($seller_info['user_name'], $mail['subject'], $mail['message']);
  3. /* RMEnd */
复制代码



4.打开app\frontend.base.php文件 ,找到:

  1. <?php
  2. /**
  3. * 前台控制器基础类
  4. *
  5. * @author Garbin
  6. * @usage none
  7. */
  8. class FrontendApp extends ECBaseApp
  9. {
复制代码

将下列代码复制后粘贴到其后面:

  1. /* RMStart */
  2. var $rmsvc = null;
  3. /* RMEnd */
复制代码


找到:

  1. // 判断商城是否关闭
  2. if (!Conf::get('site_status'))
  3. {
  4. $this->show_warning(Conf::get('closed_reason'));
  5. exit;
  6. }
  7. # 在运行action之前,无法访问到visitor对象
复制代码

将下列代码复制后粘贴到其后面:

  1. /* RMStart */
  2. include_once(ROOT_PATH . '/includes/rm/rmsvc.php');
  3. $this->rmsvc = new RMSvc($this);
  4. /* RMEnd */
复制代码


找到:

  1. /* 通过验证,执行登陆操作 */
  2. $this->_do_login($user_id);
  3. /* 同步登陆外部系统 */
  4. $synlogin = $ms->user->synlogin($user_id);
复制代码

将下列代码复制后粘贴到其后面:

  1. /* RMStart */
  2. $this->rmsvc->xmppLogin($user_name, $rmres);
  3. $synlogin .= $rmres;
  4. /* RMEnd */
复制代码



找到:
  1. exit;
  2. }
  3. }

  4. function logout()
  5. {
  6. $this->visitor->logout();
复制代码

将下列代码复制后粘贴到其后面:

  1. /* RMStart */
  2. include_once(ROOT_PATH . '/includes/rm/rmsvc.php');
  3. $svc = new RMSvc($this);
  4. $svc->xmppLogout();
  5. /* RMEnd */
复制代码


找到:

  1. empty($store['store_logo']) && $store['store_logo'] = Conf::get('default_store_logo');
  2. $store['store_owner'] = $this->_get_store_owner();
  3. $store['store_navs']= $this->_get_store_nav();
  4. $goods_mod =& m('goods');
  5. $store['goods_count'] = $goods_mod->get_count_of_store($this->_store_id);
  6. $store['store_gcates']= $this->_get_store_gcategory();
  7. $store['sgrade'] = $this->_get_store_grade();
复制代码

将下列代码复制后粘贴到其后面:

  1. /* RMStart */
  2. $goods_info = $this->_view->get_template_vars('goods');
  3. if (strtolower(APP) == 'goods' && !empty($goods_info))//来自商品查看
  4. {
  5. $store['rmlink'] = $this->rmsvc->getStatePicTxtById($store['store_id'],
  6. array('subject_id'=>$goods_info['goods_id'],
  7. 'subject_type'=>'goods',
  8. 'to'=>$this->rmsvc->id_user($store['store_id'], 'user_name'),
  9. ));
  10. }
  11. else //来自店铺查看
  12. {
  13. $store['rmlink'] = $this->rmsvc->getStatePicTxtById($store['store_id'],
  14. array('subject_type'=>'store',
  15. 'subject_id'=>$store['store_id'],
  16. 'to'=>$this->rmsvc->id_user($store['store_id'], 'user_name')));
  17. }
  18. /* RMEnd */
复制代码


5.打开app\order.app.php文件 找到:

  1. /* 发送给买家下单通知 */
  2. $buyer_mail = get_mail('tobuyer_new_order_notify', array('order' => $order_info));
  3. $this->_mailto($buyer_address, addslashes($buyer_mail['subject']), addslashes($buyer_mail['message']));
复制代码

将下列代码复制后粘贴到其后面:

  1. /* RMStart */
  2. $this->rmsvc->xmpp_send($this->visitor->get('user_name'), $buyer_mail['subject'], $buyer_mail['message']);
  3. /* RMEnd */
复制代码


找到:

  1. /* 发送给卖家新订单通知 */
  2. $seller_mail = get_mail('toseller_new_order_notify', array('order' => $order_info));
  3. $this->_mailto($seller_address, addslashes($seller_mail['subject']), addslashes($seller_mail['message']));
复制代码

将下列代码复制后粘贴到其后面:

  1. /* RMStart */
  2. $this->rmsvc->xmpp_send($member_info['user_name'], $seller_mail['subject'], $seller_mail['message']);
  3. /* RMEnd */
复制代码

6.打开app\paynotify.app.php文件,找到:
  1. /* 发送邮件给卖家,提醒付款成功 */
  2. $model_member =& m('member');
  3. $seller_info= $model_member->get($order_info['seller_id']);

  4. $mail = get_mail('toseller_online_pay_success_notify', array('order' => $order_info));
  5. $this->_mailto($seller_info['email'], addslashes($mail['subject']), addslashes($mail['message']));
复制代码
将下列代码复制后粘贴到其后面:
  1. /* RMStart */
  2. $this->rmsvc->xmpp_send($seller_info['user_name'], $mail['subject'], $mail['message']);
  3. /* RMEnd */
复制代码

7.打开app\search.app.php文件,找到:
  1. //等级图片
  2. $step = intval(Conf::get('upgrade_required'));
  3. $step < 1 && $step = 5;
  4. $goods_list[$key]['credit_image'] = $this->_view->res_base . '/images/' . $store_mod->compute_credit($goods['credit_value'], $step);
  5. empty($goods['default_image']) && $goods_list[$key]['default_image'] = Conf::get('default_goods_image');
  6. $goods_list[$key]['grade_name'] = $sgrades[$goods['sgrade']]['grade_name'];
复制代码
将下列代码复制后粘贴到其后面:
  1. /* RMStart */
  2. $goods_list[$key]['rmlink'] = $this->rmsvc->getStatePicTxtById($goods['store_id'],
  3. array('subject_id'=>$goods['goods_id'],
  4. 'subject_type'=>'goods',
  5. 'to'=>$this->rmsvc->id_user($goods['store_id'], 'user_name')), 'margin-top: -8px');
  6. /* RMEnd */
复制代码
找到:
  1. //等级图片
  2. $step = intval(Conf::get('upgrade_required'));
  3. $step < 1 && $step = 5;
  4. $stores[$key]['credit_image'] = $this->_view->res_base . '/images/' . $model_store->compute_credit($store['credit_value'], $step);
复制代码
将下列代码复制后粘贴到其后面:
  1. /* RMStart */
  2. $stores[$key]['rmlink'] = $this->rmsvc->getStatePicTxtById($store['store_id'],
  3. array('subject_id'=>$store['store_id'],
  4. 'subject_type'=>'store',
  5. 'to'=>$this->rmsvc->id_user($store['store_id'], 'user_name')));
  6. /* RMEnd */
复制代码

8.打开app\seller_order.app.php文件,找到:

  1. /* 调用相应的订单类型,获取整个订单详情数据 */
  2. $order_type =& ot($order_info['extension']);
  3. $order_detail = $order_type->get_order_detail($order_id, $order_info);
  4. foreach ($order_detail['data']['goods_list'] as $key => $goods)
  5. {
  6. empty($goods['goods_image']) && $order_detail['data']['goods_list'][$key]['goods_image'] = Conf::get('default_goods_image');
  7. }
  8. $this->assign('order', $order_info);
  9. $this->assign($order_detail['data']);
复制代码

将下列代码复制后粘贴到其后面:

  1. /* RMStart */
  2. $this->assign('rmlink', $this->rmsvc->getStatePicTxtById($order_info['buyer_id'],
  3. array('subject_id'=>$order_info['order_id'],
  4. 'subject_type'=>'seller_order',
  5. 'to'=>$this->rmsvc->id_user($order_info['buyer_id'], 'user_name'))));
  6. /* RMEnd */
复制代码


找到:
  1. /* 发送给买家邮件,提示等待安排发货 */
  2. $model_member =& m('member');
  3. $buyer_info = $model_member->get($order_info['buyer_id']);
  4. $mail = get_mail('tobuyer_offline_pay_success_notify', array('order' => $order_info));
  5. $this->_mailto($buyer_info['email'], addslashes($mail['subject']), addslashes($mail['message']));
复制代码

将下列代码复制后粘贴到其后面:
  1. /* RMStart */
  2. $this->rmsvc->xmpp_send($buyer_info['user_name'], $mail['subject'], $mail['message']);
  3. /* RMEnd */
复制代码



找到:
  1. /* 发送给买家邮件,订单已确认,等待安排发货 */
  2. $model_member =& m('member');
  3. $buyer_info= $model_member->get($order_info['buyer_id']);
  4. $mail = get_mail('tobuyer_confirm_cod_order_notify', array('order' => $order_info));
  5. $this->_mailto($buyer_info['email'], addslashes($mail['subject']), addslashes($mail['message']));
复制代码

将下列代码复制后粘贴到其后面:
  1. /* RMStart */
  2. $this->rmsvc->xmpp_send($buyer_info['user_name'], $mail['subject'], $mail['message']);
  3. /* RMEnd */
复制代码



找到:
  1. /* 发送给买家邮件通知,订单金额已改变,等待付款 */
  2. $model_member =& m('member');
  3. $buyer_info= $model_member->get($order_info['buyer_id']);
  4. $mail = get_mail('tobuyer_adjust_fee_notify', array('order' => $order_info));
  5. $this->_mailto($buyer_info['email'], addslashes($mail['subject']), addslashes($mail['message']));
复制代码

将下列代码复制后粘贴到其后面:

  1. /* RMStart */
  2. //$this->rmsvc->sendmail($buyer_info['user_name'], $order_info);
  3. $this->rmsvc->xmpp_send($buyer_info['user_name'], $mail['subject'], $mail['message']);
  4. /* RMEnd */
复制代码



找到:
  1. /* 发送给买家订单已发货通知 */
  2. $model_member =& m('member');
  3. $buyer_info= $model_member->get($order_info['buyer_id']);
  4. $order_info['invoice_no'] = $edit_data['invoice_no'];
  5. $mail = get_mail('tobuyer_shipped_notify', array('order' => $order_info));
  6. $this->_mailto($buyer_info['email'], addslashes($mail['subject']), addslashes($mail['message']));
复制代码

将下列代码复制后粘贴到其后面:
  1. /* RMStart */
  2. $this->rmsvc->xmpp_send($buyer_info['user_name'], $mail['subject'], $mail['message']);
  3. /* RMEnd */
复制代码



找到:
  1. /* 发送给买家订单取消通知 */
  2. $model_member =& m('member');
  3. $buyer_info= $model_member->get($order_info[$id]['buyer_id']);
  4. $mail = get_mail('tobuyer_cancel_order_notify', array('order' => $order_info[$id], 'reason' => $_POST['remark']));
  5. $this->_mailto($buyer_info['email'], addslashes($mail['subject']), addslashes($mail['message']));
复制代码

将下列代码复制后粘贴到其后面:
  1. /* RMStart */
  2. $this->rmsvc->xmpp_send($buyer_info['user_name'], $mail['subject'], $mail['message']);
  3. /* RMEnd */
复制代码




找到:
  1. /* 发送给买家交易完成通知,提示评论 */
  2. $model_member =& m('member');
  3. $buyer_info= $model_member->get($order_info['buyer_id']);
  4. $mail = get_mail('tobuyer_cod_order_finish_notify', array('order' => $order_info));
  5. $this->_mailto($buyer_info['email'], addslashes($mail['subject']), addslashes($mail['message']));
复制代码

将下列代码复制后粘贴到其后面:
  1. /* RMStart */
  2. $this->rmsvc->xmpp_send($buyer_info['user_name'], $mail['subject'], $mail['message']);
  3. /* RMEnd */
复制代码



找到:
  1. foreach ($orders as $key1 => $order)
  2. {
  3. foreach ($order['order_goods'] as $key2 => $goods)
  4. {
  5. empty($goods['goods_image']) && $orders[$key1]['order_goods'][$key2]['goods_image'] = Conf::get('default_goods_image');
  6. }
复制代码

将下列代码复制后粘贴到其后面:
  1. /* RMStart */
  2. $orders[$key1]['rmlink'] = $this->rmsvc->getStatePicTxtById($order['buyer_id'],
  3. array('subject_id'=>$order['order_id'],
  4. 'subject_type'=>'seller_order',
  5. 'to'=>$this->rmsvc->id_user($order['buyer_id'], 'user_name')));
  6. /* RMEnd */
复制代码

9.打开includes\ecapp.base.php文件,找到:

  1. class ECBaseApp extends BaseApp
  2. {
  3. var $outcall;
  4. function __construct()
  5. {
  6. $this->ECBaseApp();
  7. }
  8. function ECBaseApp()
  9. {
复制代码

将下列代码复制后粘贴到其后面:

  1. /* RMStart */
  2. if (defined('RM_SVC')){
  3. //unset($_SERVER['HTTP_USER_AGENT']);
  4. $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; GTB5; SV1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; CIBA)';
  5. }
  6. /* RMEnd */
复制代码


以下主要是修改模板页面 其他页面大家可以参考修改


10.打开themes\mall\default\buyer_order.index.html 找到:

  1. {include file=member.header.html}
复制代码

将下列代码复制后粘贴到其后面:

  1. <!-- RMStart --><script type="text/javascript" src="{lib file=rmsvc.js}" charset="utf-8"></script><!-- RMEnd -->
复制代码


找到:
  1. <p class="name"><span>{$lang.store_name}: <a href="index.php?app=store&id={$order.seller_id}" target="_blank">{$order.seller_name|escape}</a></span><a target="_blank" href="index.php?app=message&act=send&to_id={$order.seller_id}" class="email"></a>
复制代码

将下列代码复制后粘贴到其后面:
  1. <!-- RMStart -->{$order.rmlink}<!-- RMEnd -->
复制代码




11.打开themes\mall\default\buyer_order.view.html 找到:

  1. {include file="member.header.html"}
复制代码

将下列代码复制后粘贴到其后面:

  1. <!-- RMStart --><script type="text/javascript" src="{lib file=rmsvc.js}" charset="utf-8"></script><!-- RMEnd -->
复制代码


找到:

  1. <dl class="info">
  2. <dt>{$lang.seller_info}</dt>
  3. <dd>{$lang.store_name}&nbsp;:&nbsp;{$order.store_name|escape}
复制代码

将下列代码复制后粘贴到其后面:

  1. <!-- RMStart -->{$rmlink}<br /><!-- RMEnd -->
复制代码


12.打开打开themes\mall\default\search.goods.html找到:
  1. {include file=header.html}
  2. <script type="text/javascript" src="{lib file=search_goods.js}" charset="utf-8"></script>
复制代码
将下列代码复制后粘贴到其后面:
  1. <!-- RMStart --><script type="text/javascript" src="{lib file=rmsvc.js}" charset="utf-8"></script><!-- RMEnd -->
复制代码
找到:
  1. <script type="text/javascript">
  2. var upimg= '{res file=images/up.gif}';
  3. var downimg = '{res file=images/down.gif}';
  4. </script>
复制代码
将下列代码复制后粘贴到其后面:
  1. <!-- RMStart --><style>.list .list_pic h3 b .rm_link { display: none; }</style><!-- RMEnd -->
复制代码
找到:
  1. <span class="text_link">
  2. <span class="depict">
  3. <a href="index.php?app=goods&amp;id={$goods.goods_id}" target="_blank">{$goods.goods_name|escape}</a>
  4. </span>
  5. <span class="info">
  6. <span>{$lang.store_name}: {$goods.store_name|escape}
复制代码
将下列代码复制后粘贴到其后面:
  1. <!-- RMStart -->{$goods.rmlink}<!-- RMEnd -->
复制代码
找到:
  1. <span class="price">{$goods.price|price}</span>
  2. <b>{$lang.sales}: {$goods.sales|default:0} {$lang.unit} | <a href="index.php?app=goods&amp;act=comments&amp;id={$goods.goods_id}" target="_blank">{$goods.comments|default:0} {$lang.comment}</a>
复制代码
将下列代码复制后粘贴到其后面:
  1. <!-- RMStart --><div class="rm_link" style="margin-top: 6px">{$goods.rmlink}</div><!-- RMEnd -->
复制代码

13.打开themes\mall\default\search.store.html 找到:
  1. {include file=header.html}
  2. {include file=curlocal.html}
复制代码

将下列代码复制后粘贴到其后面:
  1. <!-- RMStart --><script type="text/javascript" src="{lib file=rmsvc.js}" charset="utf-8"></script><!-- RMEnd -->
复制代码


找到:

  1. <td class="align2"><p class="name">{$store.user_name|escape}</p><a class="email" href="{$site_url}/index.php?app=message&amp;act=send&amp;to_id={$store.user_id}">{$lang.send_pm}</a>
复制代码

将下列代码复制后粘贴到其后面:
  1. <!-- RMStart -->{$store.rmlink}<!-- RMEnd -->
复制代码