//购物车 by neo
if(isset($_COOKIE['real_ipd']) && !empty($_COOKIE['real_ipd']))
{
$this->_ip = $_COOKIE['real_ipd'];
}
else
{
$this->_ip = real_ip();
setcookie("real_ipd", $this->_ip, time()+864000, $this->session_cookie_path);
}
继续找
setcookie($this->session_name, $this->session_id, 1, $this->session_cookie_path, $this->session_cookie_domain, $this->session_cookie_secure);
if (!empty($GLOBALS['ecs']))
{
$this->db->query('DELETE FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '$this->session_id'");
}
都注释掉。这是退出登录的时候,删除cookie,删除购物车的
//购物车 by neo
$sql = "update ".$GLOBALS['ecs']->table('cart')." set user_id =".$_SESSION['user_id']." where session_id = '".SESS_ID."'";
$GLOBALS['db'] -> query($sql);
$sql1 = "update ".$GLOBALS['ecs']->table('cart')." set session_id ='".SESS_ID."' where user_id = '".$_SESSION['user_id']."'";
$GLOBALS['db'] -> query($sql1);
$re = $GLOBALS['db'] -> getAll("select *,sum(goods_number) as goods_number from ".$GLOBALS['ecs']->table('cart')." where user_id = '{$_SESSION['user_id']}' and session_id = '".SESS_ID."' group by goods_id");
if($re)
{
foreach ($re as $k => $v)
{
$sql = "update ".$GLOBALS['ecs']->table('cart'). " set goods_number = ".$v['goods_number']." where rec_id = ".$v['rec_id'];
$GLOBALS['db'] -> query($sql);
$sql = "delete from ".$GLOBALS['ecs']->table('cart')." where rec_id <> {$v['rec_id']} and user_id = '{$_SESSION['user_id']}' and session_id = '".SESS_ID."' and goods_id = ".$v['goods_id'];
$GLOBALS['db'] -> query($sql);
}
}
会员到别处登录,获取之前的购物车商品出来。 版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!
转载请注明: ecshop购物车商品根据cookie长久保存商品插件