我在使用織夢dedecms的分類信息的時候需要添加聯(lián)動屬性,結(jié)果去添加聯(lián)動屬性的時候,發(fā)現(xiàn)只可以添加一級聯(lián)動和三級聯(lián)動。
二級聯(lián)動無法添加了。
在自己的5.6的后臺添加的時候,發(fā)現(xiàn)是可以的。估計又是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 = $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 == 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,})#", $arr['evalue'], $matchs); $addvalue = $matchs[2] + 1; $addvalue = sprintf("d", $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("成功添加枚舉分類!", $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 = $arr['evalue']+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 = $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 { $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 = $arr['evalue']+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(); } } |
然后保存,在系統(tǒng)后臺更新系統(tǒng)緩存就可以了的?,F(xiàn)在在后臺的聯(lián)動類別管理里面就可以增加二級選擇了。
版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會員發(fā)布,如果侵犯了您的權(quán)益請與我們聯(lián)系,我們將在24小時內(nèi)刪除!謝謝!
轉(zhuǎn)載請注明: 織夢5.7bug修復(fù):后臺聯(lián)動無法添加二級欄目的辦法