The Search field basic parameters are as follow:
addField("search:required:ajax/getSearch.php:{ TABLE='TABLE NAME', ID='ID', SEARCHCOLS='TABLE.title_$mainLang, COLS='TABLE.title_$mainLang as title, RESULT='title', }", 'Field Title','COLUMN');
In the case where a JOIN is required, do so in the TABLE value but do not use the "=" sign instead use the word 'equal'
If the query needs a WHERE there is also the WHERE variable, in which you can't also use the "=" sign nor the "!=", ">=", "<=" or "<=>", in such case use the following words:
WHERE='PRODUCTS.title_$mainLang notequal \'\'', //instead of != empty
Other variables available with examples:
LIMIT = 100, ORDER = 'TABLE.title_$mainLang ASC', FORMAT = '<strong>%R?</strong>,<br/>%R?,$%R?', CALLBACK = 'alert(\'found!\')'
FORMAT lets you give format to the result, it is a CSV, where each value is assigned in the same order to the ones in RESULT, each value is represented by ''%R?'
For example:
FORMAT = '<strong>%R?</strong>,<br/>%R?,<i>$%R?</i>',
returns
FIRST RESULT,
SECOND RESULT, $THIRD RESULT
as for the CALLBACK, it will execute any javascript coded assigned here. also use equal instead of '='
Full example:
addField("search:required:ajax/getSearch.php:{ TABLE='PRODUCTS LEFT JOIN PRODUCTS_BRANDS on PRODUCTS.PBID equal PRODUCTS_BRANDS.PBID', ID='PRID', SEARCHCOLS='PRODUCTS.title_$mainLang,PRID,sku,PRODUCTS_BRANDS.title_$mainLang', COLS='PRODUCTS.title_$mainLang as title,PRODUCTS_BRANDS.title_$mainLang as brand,price', RESULT='title,brand,price', WHERE='PRODUCTS.title_$mainLang notequal \'\'', LIMIT=100, ORDER='PRODUCTS.title_$mainLang ASC', FORMAT='<strong>%R?</strong>,<br/>%R?,$%R?', CALLBACK='alert(\'test\')'}", 'Product','PRID');
Comments