Extend AjaxSearch to Easy2Gallery
Hi, I’m trying to extend AjaxSearch 1.92b to search through the easy2_files table by emulating the process used for the maxigallery integration, but it doesn’t want to work. What’s the best way of going about this?
So far I’ve added the following in ajaxSearchRequest.class.inc.php at line 215:
case 'easy2gallery':
$this->scJoined[] = array(
'tb_name' => $this->_getShortTableName('easy2_files'),
'tb_alias' => 'e2g_f',
'id' => 'id',
'main' => 'id',
'join' => 'dir_id',
'searchable' => array('filename', 'alias', 'description', 'summary'),
'displayed' => array('alias', 'description'),
'concat_separator' => ', ',
'filters' => array()
);
$j = count($this->scJoined) - 1;
if ($pfields != '') {
unset($this->scJoined[$j]['searchable']);
if ($pfields == 'null' or $pfields == 'NULL') $this->scJoined[$j]['searchable'] = array();
else $this->scJoined[$j]['searchable'] = explode(',', $pfields);
}
/*$j = count($this->scJoined) - 1;
$this->scJoined[$j]['filters'][] = array('field' => 'status', 'oper' => '=', 'value' => '1');
break;*/
edited the following in ajaxSearchResults.class.inc.php at line 207:
if (($tbcode != 'content') && ($tbcode != 'tv') && ($tbcode != 'jot') && ($tbcode != 'maxigallery') && ($tbcode != 'easy2gallery') && !function_exists($tbcode)) {
added the following in search.class.inc.php at line 698:
// Easy2Gallery ================================= search in E2G image gallery
case 'maxigallery':
$this->joined[] = array(
'tb_name' => $this->getShortTableName('easy2_files'),
'tb_alias' => 'gal',
'id' => 'id',
'main' => 'id',
'join' => 'dir_id',
'searchable' => array('filename', 'alias', 'description', 'summary'),
'displayed' => array('alias', 'description'),
'concat_separator' => ', ',
'filters' => array()
);
$j = count($this->joined) - 1;
if ($pfields != '' ) {
unset($this->joined[$j]['searchable']);
if ($pfields == 'null' or $pfields == 'NULL') $this->main['searchable'] = array();
else $this->main['searchable'] = explode(',',$pfields); // overwrite the default values
}
/*// image should be published
$j = count($this->joined) - 1;
$this->joined[$j]['filters'][] = array(
'field' => 'status',
'oper' => '=',
'value' => '1'
); */
break;
My snippet call is [!AjaxSearch? &showResults=`0` &ajaxSearch=`0` &landingPage=`264` &highlightResult=`0` &tplInput=`searchv2Tpl` &whereSearch=`content|tv|easy2_files:filename,summary,description,alias` &debug=`3` !].
What have I missed?