//購物車 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);
}
繼續(xù)找
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);
}
}
會員到別處登錄,獲取之前的購物車商品出來。 版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會員發(fā)布,如果侵犯了您的權(quán)益請與我們聯(lián)系,我們將在24小時內(nèi)刪除!謝謝!
轉(zhuǎn)載請注明: ecshop購物車商品根據(jù)cookie長久保存商品插件