ecshop提交订单时提示“您的购物车中没有商品”——解决方案
该问题经查常是$_SESSION丢失,在网上查找发现IE6也有不少SESSION丢失的问题,这时,就要通过COOKIE来找回登录状态,但是
includes\modules\integrates\ecshop.php这个整合自身会员的类中没有重写integrate.php中的check_cookie()方法导致,验证cookie时返回的username为空,丢失了登录状态。
ecshop模板堂给出解决方案:
打开 ecshop.php 在里面加下面这段代码:
1 /**
2 * 检查cookie
3 *
4 * @access public
5 * @param
6 *
7 * @return void
8 */
9 function check_cookie ()
10 {
11 if ( isset($_COOKIE['ECS']) && isset($_COOKIE['ECS']['user_id']) && isset($_COOKIE['ECS']['password']))
12 {
13 $ecs_user_id = $_COOKIE['ECS']['user_id'];
14 $ecs_user_pass = $_COOKIE['ECS']['password'];
15 $sql = "SELECT " . $this->field_name ." AS user_name".
16 " FROM " . $this->table($this->user_table) .
17 " WHERE ".$this->field_id." = '$ecs_user_id' AND ".$this->field_pass." = '$ecs_user_pass'";
18 $username = $this->db->getOne($sql);
19 if ($username && ($this->charset != 'UTF8'))
20 {
21 $username = ecs_iconv($this->charset, 'UTF8', $username);
22 }
23 return $username;
24 }
25 else
26 {
27 return '';
28 }
29 }

浙公网安备 33010602011771号