本站源码全部测试通过,配有前台及后台演示图,绿色安全,希望能对大家有所帮助!
  • 收藏本站
  • 网站地图
  • 发布源码
  • 首 页
  • app源码
  • 小程序源码
  • VPS/云主机
  • 织梦5.7bug修复:后台联动不能添加二级栏目的解决方法
    时间:2020-07-04 07:46:21来源:模板之家 作者:转载大师 下载:17701 次

    我在使用的分类信息的时候需要添加联动属性,结果去添加联动属性的时候,发现只可以添加一级联动和三级联动。

    二级联动无法添加了。

    在自己的5.6的后台添加的时候,发现是可以的。估计又是5.7版本的bug了。

        于是分析了代码,和大家分享下解决的办法:
    首先我们找到我们的模板源码下面的 dede/stepselect_main.php  这个文件,

    将这段代码

    else if($action==addenum_save)
    {
        if(empty($ename) || empty($egroup))
        {
             Showmsg(类别名称或组名称不能为空!,-1);
             exit();
        }
        if($issign == 1 || $topvalue == 0)
        {
            $enames = explode(,, $ename);
            foreach($enames as $ename)
            {
                $arr = $dsql->GetOne(SELECT * FROM `dede_sys_enum` WHERE egroup=$egroup AND (evalue MOD 500)=0 ORDER BY disorder DESC );
                if(!is_array($arr)) $disorder = $evalue = ($issign==1 ? 1 : 500);
                else $disorder = $evalue = $arrdisorder + ($issign==1 ? 1 : 500);
                   
                $dsql->ExecuteNoneQuery(INSERT INTO `dede_sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`)
                                        VALUES($ename,$evalue,$egroup,$disorder,$issign); );
            }
            WriteEnumsCache($egroup);                                                         
            ShowMsg(成功添加枚举分类!.$dsql->GetError(), $ENV_GOBACK_URL);
            exit();
        } else if ($issign == 2 && $topvalue != 0)
        {
            $minid = $topvalue;
            $maxnum = 500; // 三级子类最多500个
            $enames = explode(,, $ename);
            foreach ($enames as $ename)
            {
                $arr = $dsql->GetOne(SELECT * FROM `dede_sys_enum` WHERE egroup=$egroup AND evalue LIKE $topvalue.%%% ORDER BY evalue DESC );
                if(!is_array($arr))
                {
                    $disorder = $minid;
                    $evalue = $minid..001;
                }
                else
                {
                    $disorder = $minid;
                    preg_match(#(0-9{1,}).(0-9{1,})#, $arrevalue, $matchs);
                    $addvalue = $matchs2 + 1;
                    $addvalue = sprintf(d, $addvalue);
                    $evalue = $matchs1...$addvalue;

    }
                $sql = INSERT INTO `dede_sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`)
                                        VALUES($ename,$evalue,$egroup,$disorder,$issign); ;
                // echo $sql;exit;
                $dsql->ExecuteNoneQuery($sql);
            }
            // echo $minid;
            WriteEnumsCache($egroup);
            ShowMsg(成功添加枚举分类!, $ENV_GOBACK_URL);
            exit();
        } else {
            $minid = $topvalue;
            $maxid = $topvalue + 500;
            $enames = explode(,, $ename);
            foreach($enames as $ename)
            {
                $arr = $dsql->GetOne(SELECT * FROM `dede_sys_enum` WHERE egroup=$egroup AND evalue>$minid AND evalue<$maxid ORDER BY evalue DESC );
                if(!is_array($arr))
                {
                    $disorder = $evalue = $minid+1;
                }
                else
                {
                    $disorder = $arrdisorder+1;
                    $evalue = $arrevalue+1;
                }
                $dsql->ExecuteNoneQuery(INSERT INTO `dede_sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`)
                              VALUES($ename,$evalue,$egroup,$disorder,$issign); );
            }
            WriteEnumsCache($egroup);
            ShowMsg(成功添加枚举分类!, $ENV_GOBACK_URL);
            exit();
        }
    }

     

    替换为:

    else if($action==addenum_save)
    {
       if(empty($ename) || empty($egroup)) {
          Showmsg(类别名称或组名称不能为空!,-1);
          exit();
       }
       if($issign==1 || $topvalue==0)
       {
           $enames = explode(,, $ename);
           foreach($enames as $ename)
           {
            $arr = $dsql->GetOne(Select * From `dede_sys_enum` where egroup=$egroup And (evalue mod 500)=0 order by evalue desc );
        
         if(!is_array($arr)) $disorder = $evalue = ($issign==1 ? 1 : 500);
         else $disorder = $evalue = $arrdisorder + ($issign==1 ? 1 : 500);
        
         $dsql->ExecuteNoneQuery(Insert into `dede_sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`)
                                        values($ename,$evalue,$egroup,$disorder,$issign); );
            }
            WriteEnumsCache($egroup);     

     ShowMsg(成功添加枚举分类!.$dsql->GetError(), $ENV_GOBACK_URL);
        exit();
      }
      else
      {
        $minid = $topvalue;
        $maxid = $topvalue + 500;
        $enames = explode(,, $ename);
           foreach($enames as $ename)
           {
         $arr = $dsql->GetOne(Select * From `dede_sys_enum` where egroup=$egroup And evalue>$minid And evalue<$maxid order by evalue desc );
         if(!is_array($arr))
         {
          $disorder = $evalue = $minid+1;
         }
         else
         {
          $disorder = $arrdisorder+1;
          $evalue = $arrevalue+1;
         }
         $dsql->ExecuteNoneQuery(Insert into `dede_sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`)
                                      values($ename,$evalue,$egroup,$disorder,$issign); );
            }
            WriteEnumsCache($egroup);
        ShowMsg(成功添加枚举分类!, $ENV_GOBACK_URL);
        exit();
      }
    }


    然后保存,在系统后台更新系统缓存就可以了的。现在在后台的联动类别管理里面就可以增加二级选择了。

    转载请注明来源:织梦5.7bug修复:后台联动不能添加二级栏目的解决方法
    本文永久链接地址:bencandy.php?fid=32&id=16326
    本文标签:

    版权声明:
    —— 本文内容由互联网用户自发贡献, 本站不拥有所有权, 不承担相关法律责任, 如果发现本站有涉嫌抄袭的内容, 欢迎发送邮件至 :
    —— 1034252225@qq.com 举报, 并提供相关证据, 一经查实, 本站将立刻删除涉嫌侵权内容。

    QQ在线客服

    服务热线

    织梦建站咨询