ECSHOP提交订单时提示“您的购物车中没有商品”
2015-11-29 23:57
204 查看
ECSHOP提交订单时提示“您的购物车中没有商品”ECSHOP模板/ecshop开发中心(www.68ecshop.com) / 2014-06-06
ECSHOP客户反映提交订单时提示“您的购物车中没有商品”,ecshop开发中心技术经研究,该问题经查常是$_SESSION丢失,
这时,就要通过COOKIE来找回登录状态,但是includes/modules/integrates/ecshop.php这个整合自身会员的类中没有重写integrate.php中的check_cookie()方法导致验证cookie时返回的username为空,丢失了登录状态。
下面解决方案如下:
打开 ecshop.php 在里面加下面这段代码:
/**
* 检查cookie
*
* @access public
* @param
*
* @return void
*/
function check_cookie ()
{
if ( isset($_COOKIE['ECS']) && isset($_COOKIE['ECS']['user_id']) && isset($_COOKIE['ECS']['password']))
{
$ecs_user_id = $_COOKIE['ECS']['user_id'];
$ecs_user_pass = $_COOKIE['ECS']['password'];
$sql = "SELECT " . $this->field_name ." AS user_name".
" FROM " . $this->table($this->user_table) .
" WHERE ".$this->field_id." = '$ecs_user_id' AND ".$this->field_pass." = '$ecs_user_pass'";
$username = $this->db->getOne($sql);
if ($username && ($this->charset != 'UTF8'))
{
$username = ecs_iconv($this->charset, 'UTF8', $username);
}
return $username;
}
else
{
return '';
}
}
ECSHOP客户反映提交订单时提示“您的购物车中没有商品”,ecshop开发中心技术经研究,该问题经查常是$_SESSION丢失,
这时,就要通过COOKIE来找回登录状态,但是includes/modules/integrates/ecshop.php这个整合自身会员的类中没有重写integrate.php中的check_cookie()方法导致验证cookie时返回的username为空,丢失了登录状态。
下面解决方案如下:
打开 ecshop.php 在里面加下面这段代码:
/**
* 检查cookie
*
* @access public
* @param
*
* @return void
*/
function check_cookie ()
{
if ( isset($_COOKIE['ECS']) && isset($_COOKIE['ECS']['user_id']) && isset($_COOKIE['ECS']['password']))
{
$ecs_user_id = $_COOKIE['ECS']['user_id'];
$ecs_user_pass = $_COOKIE['ECS']['password'];
$sql = "SELECT " . $this->field_name ." AS user_name".
" FROM " . $this->table($this->user_table) .
" WHERE ".$this->field_id." = '$ecs_user_id' AND ".$this->field_pass." = '$ecs_user_pass'";
$username = $this->db->getOne($sql);
if ($username && ($this->charset != 'UTF8'))
{
$username = ecs_iconv($this->charset, 'UTF8', $username);
}
return $username;
}
else
{
return '';
}
}
相关文章推荐
- aop-annotation
- OpenCV2的helloworld
- maven安装时报 Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5
- OpenCV 中的GMM模型 高斯混合模型
- linux 虚拟机下 nat dhcp 动态IP配置
- linux-文件系统管理10-关于存储介质的那些事儿
- Linux命令之进程的管理
- linux-文件系统管理09-盘符漂移问题
- Ubuntu 14.04 Web服务器Tomcat安装测试
- Linux之最简字符驱动的编码模型
- linux-文件系统管理08-dd备份恢复系统
- 关于安装elementary中遇到的问题记录
- linux-文件系统管理07-备份恢复xfs系统
- iis 如何修改网站的默认浏览方式
- linux-文件系统管理06-tar备份恢复系统
- OpenGL概述
- linux-文件系统管理05-Xfs文件系统修复
- Apache Spark大数据分析入门
- 第十七天-linux系统定时任务crontab入门讲解
- linux-文件系统管理04-文件系统