dedecms分类信息模型 实现自定义联动字段和普通字段多选条件搜索

dedecms织梦 分类信息模型 实现联动字段和自定义普通字段多选条件搜索,联动目前是直接用得地区,

客户制作网站需要实现如下。

 

dedecms 分类信息模型 实现联动字段和自定义普通字段多选条件搜索,联动目前是直接用得地区,
图片1

 

修改plus/list.php


  1. if($tinfos['issystem']==-1) 
  2.     $nativeplace = ( (emptyempty($nativeplace) || !is_numeric($nativeplace)) ? 0 : $nativeplace ); 
  3.    // $infotype = ( (empty($infotype) || !is_numeric($infotype)) ? 0 : $infotype ); 
  4.  //把默认infotype 联动字段改成了直接下拉,所以不能用上门数字判断方法,改为直接下面得获取;
  5.     if(!emptyempty($infotype)) $infotype = FilterSearch($infotype); 
  6.      
  7.     if(!emptyempty($keyword)) $keyword = FilterSearch($keyword); 
  8.       //这里就是加得字段,并不是联动字段,
  9.     if(!emptyempty($endtime)) $endtime = FilterSearch($endtime); 
  10.     if(!emptyempty($linkman)) $linkman = FilterSearch($linkman); 
  11.     if(!emptyempty($tel)) $tel = FilterSearch($tel); 
  12.  
  13.      
  14.     $cArr = array(); 
  15.     if(!emptyempty($nativeplace)) $cArr['nativeplace'] = $nativeplace
  16.     if(!emptyempty($infotype)) $cArr['infotype'] = $infotype
  17.     if(!emptyempty($keyword)) $cArr['keyword'] = $keyword
  18.      //这里就是加得字段,并不是联动字段,写入数组带入到另外一个页面
  19.      if(!emptyempty($endtime)) $cArr['endtime'] = $endtime
  20.       if(!emptyempty($linkman)) $cArr['linkman'] = $linkman
  21.        if(!emptyempty($tel)) $cArr['tel'] = $tel
  22.      
  23.     include(DEDEINC."/arc.sglistview.class.php"); 
  24.     $lv = new SgListView($tid,$cArr); 

 在修改:include/arc.sglistview.class.php

 


  1. //这个我改了。不是联动字段不能用判断是否是数字了。
  2.  
  3. if(!emptyempty($this->searchArr['infotype'])) 
  4.             { 
  5.                 $naddQuery .= "AND arc.infotype like '%{$this->searchArr['infotype']}%' "
  6.           } 
  7.  
  8.  
  9.  //在这个下面加入其他条件。
  10.             if(!emptyempty($this->searchArr['keyword'])) 
  11.             { 
  12.                 $naddQuery .= "AND arc.title like '%{$this->searchArr['keyword']}%' "
  13.           } 
  14.            
  15.            //这些下面是加入得。名字都是字段名称.
  16.             if(!emptyempty($this->searchArr['endtime'])) 
  17.             { 
  18.                 $naddQuery .= "AND arc.endtime like '%{$this->searchArr['endtime']}%' "
  19.           } 
  20.            
  21.            
  22.             if(!emptyempty($this->searchArr['linkman'])) 
  23.             { 
  24.                 $naddQuery .= "AND arc.linkman like '%{$this->searchArr['linkman']}%' "
  25.           } 
  26.            
  27.            
  28.             if(!emptyempty($this->searchArr['tel'])) 
  29.             { 
  30.                 $naddQuery .= "AND arc.tel like '%{$this->searchArr['tel']}%' "
  31.           } 
  32.  

 再次修改include/arc.sglistview.class.php 分页带入条件得问题

搜索:function GetPageListDM

 


  1. //这里加入自定义自定名称和判断是否为空  
  2. global $nativeplace,$infotype,$keyword,$endtime,$linkman,$tel
  3.         if(emptyempty($nativeplace)) $nativeplace = 0; 
  4.         if(emptyempty($infotype)) $infotype = 0; 
  5.         if(emptyempty($keyword)) $keyword = ''
  6.         if(emptyempty($endtime)) $endtime = ''
  7.         if(emptyempty($linkman)) $linkman = ''
  8.         if(emptyempty($tel)) $tel = ''
  9.  

下面得

 


  1. $geturl = "tid=".$this->TypeID."&TotalResult=".$this->TotalResult."&nativeplace=$nativeplace&infotype=$infotype&keyword=".urlencode($keyword)."&"

改成加入得自定义字段和from提交得自定义字段:

 


  1. $geturl = "tid=".$this->TypeID."&TotalResult=".$this->TotalResult."&nativeplace=$nativeplace&infotype=$infotype&endtime=".urlencode($endtime)."&linkman=".urlencode($linkman)."&tel=".urlencode($tel)."&keyword=".urlencode($keyword)."&"
  2.        $hidenform = "<input type='hidden' name='tid' value='".$this->TypeID."' /> "
  3.        $hidenform = "<input type='hidden' name='nativeplace' value='$nativeplace' /> "
  4.        $hidenform = "<input type='hidden' name='infotype' value='$infotype' /> "
  5.        $hidenform = "<input type='hidden' name='keyword' value='$keyword' /> "
  6.     $hidenform = "<input type='hidden' name='endtime' value='$endtime' /> "
  7.     $hidenform = "<input type='hidden' name='linkman' value='$linkman' /> "
  8.     $hidenform = "<input type='hidden' name='tel' value='$tel' /> "