主页 > 品牌列表 > ECTouch > ECTouch问答 >

9.0分

产品名:ECTouch

公司名:上海商创网络科技有限公司

所在地:

主营产品: 小程序 微营销 微商城
注册试用 申请代理
HiShop商家用户中心服条款
产品动态

热门标签

ECTouch会员退出登录保留购物车里的商品

日期:2018-12-20 09:13:40阅读量:作者:admin来源:未知
  1. 1. 打开/mobile/include/library/EcsApiSession.class.php和/mobile/include/library/EcsSession.class.php两个文件查找   $this->db->query('DELETE FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '$this->session_id'");(大概202行)分别注释掉

    <a href='https://www.hishang.com/ec/ectouch/' target='_blank'><u>ECTouch</u></a>会员退出登录保留购物车里的商品

  2. 2. 打开/mobile/include/apps/default/model/UsersModel.class.php

    搜索如下代码: function update_user_info() {

    在该函数内末尾添加如下代码:


            /* 更新用户购物车,退出不清空购物车 */
        $sql = "UPDATE " . $this->pre . "cart SET".
               " user_id = '" . $_SESSION['user_id'] . "'".
               " WHERE session_id = '" . SESS_ID . "'";
        $this->query($sql);
        $sql = "UPDATE " . $this->pre . "cart SET".
               " session_id = '" . SESS_ID . "'".
               " WHERE user_id = '" . $_SESSION['user_id'] . "'";
       $this->query($sql);
        /* 删除购物车中已下架的商品 */
        $sql = "SELECT DISTINCT(c.goods_id) FROM " . $this->pre . "cart AS c left JOIN " . $this->pre . "goods AS g on c.goods_id = g.goods_id WHERE g.is_on_sale = 0 AND c.user_id = '" . $_SESSION['user_id'] . "'";
        $data = $this ->getFields($sql);
        if($data){
            foreach ($data as $k=>$v){
                $sql = "DELETE FROM " . $this->pre . "cart WHERE goods_id = '" . $v['goods_id'] . "'";
                $this->query($sql);
            }
        }