• 全国400电话网上服务平台
    强大号码库资源任选,方便,快捷,快速开通。
    咨询热线:400-1100-266  

    dede联动菜单无法添加二级选择
    POST TIME:2017-11-13 01:20

    dede联动菜单是一个非常实用的功能,然而dedeCMS直接安装后,添加到联动三级菜单以后,再插入二级选择会自动生成三级选择,以下方法解决此bug。

    一、找到:dede/stepselect_main.php文件将以下替换源文件215行的对应代码

    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 = $arr['disorder'] + ($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 == 3 && $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,})#", $arr['evalue'], $matchs);
    $addvalue = $matchs[2] + 1;
    $addvalue = sprintf("%03d", $addvalue);
    $evalue = $matchs[1].'.'.$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("成功添加枚举分类!".$issign, $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 = $arr['disorder']+1;
    $evalue = (int)($arr['evalue']+1);
    }
    $dsql->ExecuteNoneQuery("Insert into `dede_sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`)
    values('$ename','$evalue','$egroup','$disorder','$issign'); ");
    }
    WriteEnumsCache($egroup);
    ShowMsg("成功添加枚举分类!".$issign, $ENV_GOBACK_URL);
    exit();
    }
    }
    二、找到:dede/templets/stepselect_main.htm文件将

    if($topvalue % 500 != 0) $arr['issign'] = 2;

    替换为:

    if($topvalue % 500 != 0) $arr['issign'] = 3;
    if($topvalue % 500 == 0) $arr['issign'] = 2;

    以上这样修改后1,2,3 联动能添加,再4级就不行了。应为这里的标记只判断到3,织梦也最多能添加3级联动。所以足够用了。

    
    Copyright © 2003-2016
    时间:9:00-21:00 (节假日不休)
    版权所有:巨人网络(扬州)科技有限公司
    总部地址:江苏省信息产业基地11号楼四层
    《增值电信业务经营许可证》 苏B2-20120278
    X

    截屏,微信识别二维码

    微信号:veteran88

    (点击微信号复制,添加好友)

     打开微信

    微信号已复制,请打开微信添加咨询详情!