Ecshop 2.6.0 用户下单时,只提供Email, 为该用户自动注册为站点用户,并关联订单.
修改得比较草,只为实现功能.
flow.php 文件 大约 1280行左右.
注释部分为添加部分.
- /*
- * 检查用户是否已经登录
- * 如果用户已经登录了则检查是否有默认的收货地址
- * 如果没有登录则跳转到登录和注册页面
- */
- if (emptyempty($_SESSION['direct_shopping']) && $_SESSION['user_id'] == 0)
- {
- /* 用户没有登录且没有选定匿名购物,转向到登录页面 */
- ecs_header("Location: flow.php?step=login/n");
- exit;
- }
- /*******************************************************************
- * Add By Shelly 2008-10-6 *
- *******************************************************************/
- /*
- *自动登陆用户
- * 如果已注册用户,取得用户 user_id
- * 如果是自动注册用户 $isAutoRegistUser = true
- */
- $isAutoRegistUser = false;
- if($_SESSION['user_id'] == 0){
- include_once('includes/lib_passport.php');
- if ((intval($_CFG['captcha']) & CAPTCHA_REGISTER) && gd_version() > 0)
- {
- if (emptyempty($_POST['captcha']))
- {
- show_message($_LANG['invalid_captcha']);
- }
- /* 检查验证码 */
- include_once('includes/cls_captcha.php');
- $validator = new captcha();
- if (!$validator->check_word($_POST['captcha']))
- {
- show_message($_LANG['invalid_captcha']);
- }
- }
- // 自动生成密码, 可用于用户邮件发送,或者用户重置密码部分
- $tmpPassword = substr(md5('passhash_'.trim($_SESSION['flow_consignee']['email'])), 4, 6);
- $regRet =register(trim($_SESSION['flow_consignee']['email']), trim($tmpPassword), trim($_SESSION['flow_consignee']['email']));
- if (!$regRet) {
- // 用户自动注册不成功 这种可能性比较小
- ecs_header("Location: flow.php?step=consignee/n");
- exit;
- }else{
- $isAutoRegistUser = true;
- $loginRet = $user->login(trim($_SESSION['flow_consignee']['email']), trim($tmpPassword));
- if ($loginRet){
- update_user_info(); //更新用户信息
- recalculate_price(); // 重新计算购物车中的商品价格
- }
- }
- }
- /* 发送邮件给用户 */
- /* 略 */
- if ($_CFG['service_email'] != '')
- {
- /*
- $tpl = get_mail_template('remind_of_new_order');
- $smarty->assign('order', $order);
- $smarty->assign('shop_name', $_CFG['shop_name']);
- $smarty->assign('send_date', date($_CFG['time_format']));
- $content = $smarty->fetch('str:' . $tpl['template_content']);
- send_mail($_CFG['shop_name'], $_CFG['service_email'], $tpl['template_subject'], $content, $tpl['is_html']);
- */
- }
- /*******************************************************************
- * Add By Shelly 2008-10-6 *
- *******************************************************************/
- $consignee = get_consignee($_SESSION['user_id']);
- /* 检查收货人信息是否完整 */
- if (!check_consignee_info($consignee, $flow_type))
- {
- /* 如果不完整则转向到收货人信息填写界面 */
- ecs_header("Location: flow.php?step=consignee/n");
- exit;
- }