雅虎新闻|| BBC新闻|| CNN新闻|| 美元指数|| 中国期货指数|| 股票指数|| 黄金|| 外汇|| 英汉互译|| 昭放工具
163邮箱|| 126邮箱|| 新浪邮箱|| 企业邮箱|| 21cn邮箱|| tom邮箱|| 搜狐邮箱|| hotmail邮箱|| msn邮箱|| qq邮箱

用户登录

设为主页| 淘宝铺| 加入收藏|
您的IP:216.73.216.121您的操作系统:Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
个人便签
知识库
EcShop 中关于注册推荐 填写推荐人的功能实现

 

前几天有人提出这个注册推荐功能,我和他说针对EC来说是有推荐注册提成提积分的功能的,他说想在注册时使用这个。

发现网上是有这方面的论述的,但是很遗憾貌似是有问题的所以今天把这个重新修改下在这里记录下希望以后能用的上。

1、修改注册页面文件 themes/模板/ user_password.dwt(在2.7.3里面是user_passport.dwt文件的注册部分)

查找代码

[php] view plaincopy

<!-- 判断是否启用验证码{if $enabled_captcha} -->  

...  

<!--{/if}-->  

 

 

在其下加入输入框(当然这里你也可以写成if判断形势,这样有利于整体的管理更傻瓜。label_rec_user在2.7.3里面已经没有了)

 

<tr>  

    <td align="right">{$lang.label_rec_user}</td>  

    <td>  

        <input name="rec_user" type="text" size="25" id="rec_user" class="inputBg" />  

        </td>  

 </tr>  

 

这里涉及到语言变量的加入不多说了。

2.针对输入框的加入在js中加入相应获取值代码,修改/js/user.js文件

查找代码

 

var password  = Utils.trim(frm.element['password'].value);  

 

在其下加入

 

var rec_user  = Utils.trim(frm.elements['rec_user'].value);  

 

3.修改获取值代码,修改user.php

查找代码

 

$email    = isset($_POST['email']) ? trim($_POST['email']) : ''  

 

加入代码

[php] view plaincopy

$rec_user    = isset($_POST['rec_user']) ? trim($_POST['rec_user']) : '';  

 

 

继续查找

 

if (register($username, $password, $email, $other) !== false)  

 

 

在其下把此方法重写

 

if (register($username, $password, $email, $rec_user, $other) !== false)  

 

 4.修改includes/lib_passport.php

查找register方法修改为

 

function register($username, $password, $email, $rec_user, $other = array())  

 

 

查找此方法中的

 

$up_uid     = get_affiliate();  

// 推荐开关开启  

 

在其下加入

 

     if (!empty($rec_user))  

    {  

      

     $recsql = "SELECT user_id FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_name = '$rec_user'";  

         $recone = $GLOBALS['db']->getOne($recsql);  

         if ($recone)  

    {  

          $up_uid=$recone;  

     }  

      

}  

 

 

 

当然这个框也不一定用用户名可以使用识别用户唯一的字段 比如tel等。再加入提示功能更好。

星期五, 06/29/2012 - 13:46 — 杨超