在修改聯(lián)動類別里面的信息類型的時候發(fā)現(xiàn)只能增加一級選擇和三級選擇,就是不能增加二級選擇,怎么辦呢?
首先我們找到我們的模板源碼下面的 dede/stepselect_main.php 這個文件,
將這段代碼
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 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個www.dedecms51.com下載 $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("成功添加枚舉分類!", $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(); } } |
替換為:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 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)緩存就可以了的。現(xiàn)在在后臺的聯(lián)動類別管理里面就可以增加二級選擇了。
版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會員發(fā)布,如果侵犯了您的權(quán)益請與我們聯(lián)系,我們將在24小時內(nèi)刪除!謝謝!
轉(zhuǎn)載請注明: 織夢的聯(lián)動信息類型只能增加一級和三級選擇,不能增加二級選擇解