描述:ECShop会员退出再登陆时购物车里面的商品会被清空掉的,通过本文做简单修改即可实现会员退出不清空购物车
ECShop版本:V2.7.3 RELEASE 20110907
涉及修改文件:
1. \includes\cls_session.php
2. \includes\lib_main.php
详细修改记录:
1. \includes\cls_session.php
第一步:搜索 $this->db->query('DELETE FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '$this->session_id'");
只有一处(270行左右),将其修改为
$this->db->query('DELETE FROM ' .$GLOBALS['ecs']->table('cart') . " WHERE session_id ='$this->session_id' AND user_id = 0");//只清空匿名用户的购物车 add 20120118 退出不清空购物车*/
2. \includes\lib_main.php
第一步:搜索function update_user_info()
27行左右,在改函数内部末尾添加如下代码
/* 更新用户购物车session_id add 20120118 退出不清空购物车*/
$sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET".
" session_id = '" .SESS_ID . "'".
" WHERE user_id = '" .$_SESSION['user_id'] . "'";
$GLOBALS['db']->query($sql);
至此全部修改完成