Hi,
I've got a strange problem. I'm using CTL Module Maker, latest version, and use the internal search function.
Now I've got the strange thing that (no matter what keyword I use) the results show up twice.
As if somewhere the results are triggered to show two times.
The URL: http://dev.vikingentertainment-raalte.n ... ertainment
Can anyone tell me what I'm doing wrong?
[SOLVED] CTL Module Maker - Search results show twice
- stijlXpres
- Forum Members
- Posts: 137
- Joined: Tue May 05, 2009 12:10 pm
- Location: Raalte, the Netherlands
[SOLVED] CTL Module Maker - Search results show twice
Last edited by stijlXpres on Sun Jun 13, 2010 4:41 pm, edited 1 time in total.
Re: CTL Module Maker - Search results show twice
I'm sorry not to be of any help in this matter, but I too found out about this bug just a few days ago and couldn't find a fix for it.
At least you know it's not related to your own module but a CTLMM problem.
--
Bernd
At least you know it's not related to your own module but a CTLMM problem.
--
Bernd
-
- Forum Members
- Posts: 16
- Joined: Wed Nov 26, 2008 3:02 am
- Location: Sunshine Coast, Queensland, Australia
Re: CTL Module Maker - Search results show twice
I've had the same problem. FYI I've submitted a bug report here
Last edited by kank on Sun Mar 21, 2010 11:38 pm, edited 1 time in total.
-
- Forum Members
- Posts: 16
- Joined: Wed Nov 26, 2008 3:02 am
- Location: Sunshine Coast, Queensland, Australia
Re: CTL Module Maker - Search results show twice
I should have included the following version numbers too:
I'm using:
CMSMS Version
1.6.7
CTLModuleMaker
1.8.9.3
I'm using:
CMSMS Version
1.6.7
CTLModuleMaker
1.8.9.3
-
- Forum Members
- Posts: 16
- Joined: Wed Nov 26, 2008 3:02 am
- Location: Sunshine Coast, Queensland, Australia
Re: CTL Module Maker - Search results show twice
OK, I'm having some success here.
I've managed to fix the problem by editing /modules/yourmodulename/action.search.php and changing this code ...
To this...
My kludge probably buggers something else
but if it does, I haven't found it yet!
I've managed to fix the problem by editing /modules/yourmodulename/action.search.php and changing this code ...
Code: Select all
if(count($itemlist) == 0 && $emptytemplate != "**"){
echo $this->ProcessTemplateFromDatabase($emptytemplate);
}elseif($template == FALSE){
echo $this->ProcessTemplate("search_generalresults.tpl");
}else{
echo $this->ProcessTemplateFromData($template);
}
Code: Select all
if(count($itemlist) == 0 && $emptytemplate = "**"){
echo $this->ProcessTemplateFromData($template);
}

Last edited by kank on Tue Mar 23, 2010 5:48 am, edited 1 time in total.
Re: CTL Module Maker - Search results show twice
Hi Kank, I had the same problem and I tried your workaround, but the template was still printed twice in a search result with 0 (zero) item.
I think that the issue is due to the position of the code that prints out the template, which is inside the foreach level loop ( foreach($levels as $level) )
So, I changed the code in this way and it works for me:
I think that the issue is due to the position of the code that prints out the template, which is inside the foreach level loop ( foreach($levels as $level) )
So, I changed the code in this way and it works for me:
Code: Select all
foreach($levels as $level){
$whereclause = "";
$fields = $this->get_levelsearchfields($level);
$keywords = $this->parsekeywords(html_entity_decode($params["searchfield"]));
foreach($fields as $field){
foreach($keywords as $keyword){
$whereclause .= ($whereclause == ""?"":" OR ")."A.".$field." LIKE '%".addslashes($keyword)."%'";
}
}
$whereclause = "A.active=1".($whereclause == ""?"":" AND (".$whereclause.")");
$getfunction = "get_level_".$level;
$itemlist = $this->$getfunction(array(), false, "", "", isset($params["orderby"])?$params["orderby"]:0, $limit, $whereclause);
$this->smarty->assign("itemcount",count($itemlist));
if(count($itemlist) > 0){
$total = $nbperpage?$this->countsomething($level,"id",array(),$whereclause, array()):false;
$this->paginate($what,$total,$id,$returnid,$params,"search");
// we must build a detail link for each result element
$newlist = array();
foreach($itemlist as $item){
$item = $this->addfrontendurls($item,$params,$id,$linkreturnid);
$item->is_selected = false;
array_push($newlist, $item);
}
$this->smarty->assign("itemlist",$newlist);
$this->smarty->assign("leveltitle",$this->Lang($level."_plural"));
/* COMMENTED OUT
if($template == FALSE){
echo $this->ProcessTemplate("search_generalresults.tpl");
}else{
echo $this->ProcessTemplateFromData($template);
}
*/
}else{
$this->paginate($what,0,$id,$returnid,$params,"search");
$this->smarty->assign("itemlist",$itemlist);
$this->smarty->assign("error_msg",$this->Lang("error_noitemfound"));
}
/* COMMENTED OUT
if(count($itemlist) == 0 && $emptytemplate != "**"){
echo $this->ProcessTemplateFromDatabase($emptytemplate);
}elseif($template == FALSE){
echo $this->ProcessTemplate("search_generalresults.tpl");
}else{
echo $this->ProcessTemplateFromData($template);
}
*/
}
// MOVED OUTSIDE foreach($levels as $level) LOOP
if(count($itemlist) == 0 && $emptytemplate != "**"){
echo $this->ProcessTemplateFromDatabase($emptytemplate);
}elseif($template == FALSE){
echo $this->ProcessTemplate("search_generalresults.tpl");
}else{
echo $this->ProcessTemplateFromData($template);
}
}
// # END SEARCH RESULTS
//
Last edited by nervino on Sun Jun 13, 2010 4:24 pm, edited 1 time in total.
- stijlXpres
- Forum Members
- Posts: 137
- Joined: Tue May 05, 2009 12:10 pm
- Location: Raalte, the Netherlands
Re: CTL Module Maker - Search results show twice
When I combine the solutions of both Nervino & Kank it works for me. The topic seems to be solved!