实现dedecms商城游客可以下订单,织梦不登陆会员也可以下订单
方法如下:
找到/plus/carbuyaction.php中的代码如下:
- //确认用户登录信息
- if($cfg_ml->IsLogin())
- {
- $userid = $cfg_ml->M_ID;
- }
- else
- {
- $username = trim($username);
- $password = trim($password);
- if(emptyempty($username) || $password)
- {
- ShowMsg("请选登录!","-1",0,2000);
- exit();
- }
- $rs = $cfg_ml->CheckUser($username,$password);
- if($rs==0)
- {
- ShowMsg("用户名不存在!","-1",0,2000);
- exit(); //Vevb.com
- }
- else if($rs==-1)
- {
- ShowMsg("密码错误!","-1",0,2000);
- exit();
- }
- $userid = $cfg_ml->M_ID;
- }
把这段代码修改为:
- //确认用户登录信息
- if($cfg_ml->IsLogin())
- {
- $userid = $cfg_ml->M_ID;
- }
- else
- {
- $username = trim($username);
- $password = trim($password);
- if(emptyempty($username) || $password)
- {
- $userid = 0;
- }
- else
- {
- $rs = $cfg_ml->CheckUser($username,$password);
- if($rs==0)
- {
- ShowMsg("用户名不存在!","-1",0,2000);
- exit();
- }
- else if($rs==-1)
- {
- ShowMsg("密码错误!","-1",0,2000);
- exit();
- }//Vevb.com
- $userid = $cfg_ml->M_ID;
- }
- }
修改的意思是,如果用户没有登录,那我就把0赋值给id,这样在后台只要看到是0下的订单,就是游客的。
新闻热点
疑难解答