ecshop2.7.4手机版实现注册推荐功能
2014-10-14 10:01 来源:www.chinab4c.com 作者:ecshop专家
ecshop2.7.4手机版实现注册推荐功能,其实我们知道在ecshop中早就存在了比较成熟的记录推荐人信息的接口。那就是调用$up_uid = get_affiliate()方法去记录,当你进入到手机版,前提是需要通过pc版的wap进行跳转,这个时候已经加载了$up_uid = get_affiliate()方法,记录该推荐人的uid到了ecshop的cooke中。这个时候跳转到wap不需要带任何uid,其实他已经记录了推荐人uid
那么实现起来就很容易了。直接改造以下函数m_register()就可以,找到899行,增加以下代码
/*推荐处理*/
$affiliate = unserialize($GLOBALS['_CFG']['affiliate']);
if (isset($affiliate['on']) && $affiliate['on'] == 1)
{
// 推荐开关开启
$up_uid = get_affiliate();
empty($affiliate) && $affiliate = array();
$affiliate['config']['level_register_all'] = intval($affiliate['config']['level_register_all']);
$affiliate['config']['level_register_up'] = intval($affiliate['config']['level_register_up']);
if ($up_uid)
{
if (!empty($affiliate['config']['level_register_all']))
{
if (!empty($affiliate['config']['level_register_up']))
{
$rank_points = $GLOBALS['db']->getOne("SELECT rank_points FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id = '$up_uid'");
if ($rank_points + $affiliate['config']['level_register_all'] <= $affiliate['config']['level_register_up'])
{
log_account_change($up_uid, 0, 0, $affiliate['config']['level_register_all'], 0, sprintf($GLOBALS['_LANG']['register_affiliate'], $_SESSION['user_id'], $username));
}
}
else
{
log_account_change($up_uid, 0, 0, $affiliate['config']['level_register_all'], 0, $GLOBALS['_LANG']['register_affiliate']);
}
}
//设置推荐人
$sql = 'UPDATE '. $GLOBALS['ecs']->table('users') . ' SET parent_id = ' . $up_uid . ' WHERE user_id = ' . $_SESSION['user_id'];
$GLOBALS['db']->query($sql);
}
}
就直接完成了ecshop2.7.4手机版实现注册推荐功能
来源:http://www.chinab4c.com
最近更新
常用插件
- ecshop购物车勾选功能插件
ecshop购物车勾选功能插件/勾选择部分产品结算插件...
- ecshop批量发货插件
ecshop批量发货功能。一直是大家希望的。ecshop默认的订单发货.是非常复...
- ecshop订单聚合插件
ecshop订单聚合插件,主要是为了方便ecshop中订单产品到货情况的分析和...
- ecshop红包修改成满多少减
我们在长期使用ecshop的时候,我们可以发现。ecshop的红包是一个非常强...
- ecshop分类批量扩展插件
ecshop分类批量扩展插件,这个插件是ecshop插件里面比较核心的插件。我们...