Multiple search text filters on the same view are not correctly generated.
in the UI view they seems generated, because there are the input fields but in the code is only ONE search (apparently the last).
Moreover if an "instance name" and/or a label is configured in the builder for the said filters, in the code there is no track of it.
So apparently these things are completely missing from the generated code.
UPDATE:
some more details about what is generated and it isn't.
Assuming we have 3 search filters and we gave them a label and an instance name in the builder, respectively: keyword, make, model
we have the following in the generated component:
ROOT\components\com_MYCOMPONENT\views\MYITEMS\view.html.php:
code generated is
//Filters
// Keyword
$filters['search_search']->jdomOptions = array(
'dataValue' => $state->get('search.search')
);
// Make
$filters['search_search']->jdomOptions = array(
'dataValue' => $state->get('search.search')
);
// Model
$filters['search_search']->jdomOptions = array(
'dataValue' => $state->get('search.search')
);
it should be
//Filters
// Keyword
$filters['search_keyword']->jdomOptions = array(
'dataValue' => $state->get('search.keyword')
);
// Make
$filters['search_make']->jdomOptions = array(
'dataValue' => $state->get('search.make')
);
// Model
$filters['search_model']->jdomOptions = array(
'dataValue' => $state->get('search.model')
);
file ROOT\components\com_MYCOMPONENT\views\MYITEMS\tmpl\default.php:
code generated
<div class="pull-right">
<?php echo $this->filters['search_search']->input;?>
</div>
<div class="pull-right">
<?php echo $this->filters['search_search']->input;?>
</div>
<div class="pull-right">
<?php echo $this->filters['search_search']->input;?>
</div>
it should be
<div class="pull-right">
<!-- MISSING LABEL FOR "KEYWORD" !?!?!? WHERE IS IT? -->
<?php echo $this->filters['search_keyword']->input;?>
</div>
<div class="pull-right">
<!-- MISSING LABEL FOR "MAKE" !?!?!? WHERE IS IT? -->
<?php echo $this->filters['search_make']->input;?>
</div>
<div class="pull-right">
<!-- MISSING LABEL FOR "MODEL"!?!?!? WHERE IS IT? -->
<?php echo $this->filters['search_model']->input;?>
</div>
file ROOT\components\com_MYCOMPONENT\models\MYITEMS.php:
in the public function __construct we have
//Define the searchable fields
$this->set('search_vars', array(
'search' => 'string'
));
it should be
//Define the searchable fields
$this->set('search_vars', array(
'keyword' => 'string',
'make' => 'string',
'model' => 'string'
));
in the same file but on protected function prepareQuery we ONLY have (apparently it seems the last instance)
//WHERE - SEARCH : search_search : search on Model
$search_search = $this->getState('search.search');
$this->addSearch('search', 'a.model', 'like');
if (($search_search != '') && ($search_search_val = $this->buildSearch('search', $search_search)))
$this->addWhere($search_search_val);
it should be
//WHERE - SEARCH : search_keyword : search on Model
$search_keyword = $this->getState('search.keyword');
$this->addSearch('keyword', 'a.keyword', 'like');
if (($search_keyword != '') && ($search_keyword_val = $this->buildSearch('keyword', $search_keyword)))
$this->addWhere($search_keyword_val);
//WHERE - SEARCH : search_make : search on Make
$search_make = $this->getState('search.make');
$this->addSearch('make', 'a.make', 'like');
if (($search_make != '') && ($search_make_val = $this->buildSearch('make', $search_make)))
$this->addWhere($search_make_val);
//WHERE - SEARCH : search_model : search on Model
$search_model = $this->getState('search.model');
$this->addSearch('model', 'a.model', 'like');
if (($search_model != '') && ($search_model_val = $this->buildSearch('model', $search_model)))
$this->addWhere($search_model_val);
on file ROOT\components\com_MYCOMPONENT\models\forms\MYITEM.xml
we have:
<field name="search_search"
type="cksearch"
placeholder="MYCOMPONENT_FILTER_NULL_KEYWORD"
label="MYCOMPONENT_JSEARCH_KEYWORD"
class="element-search search-query"
ui="chosen"/>
<field name="search_search"
type="cksearch"
placeholder="MYCOMPONENT_FILTER_NULL_MAKE"
label="MYCOMPONENT_JSEARCH_MAKE"
class="element-search search-query"
ui="chosen"/>
<field name="search_search"
type="cksearch"
placeholder="MYCOMPONENT_FILTER_NULL_MODEL"
label="MYCOMPONENT_JSEARCH_MODEL"
class="element-search search-query"
ui="chosen"/>
it should be
<field name="search_keyword"
type="cksearch"
placeholder="MYCOMPONENT_FILTER_NULL_KEYWORD"
label="MYCOMPONENT_JSEARCH_KEYWORD"
class="element-search search-query"
ui="chosen"/>
<field name="search_make"
type="cksearch"
placeholder="MYCOMPONENT_FILTER_NULL_MAKE"
label="MYCOMPONENT_JSEARCH_MAKE"
class="element-search search-query"
ui="chosen"/>
<field name="search_model"
type="cksearch"
placeholder="MYCOMPONENT_FILTER_NULL_MODEL"
label="MYCOMPONENT_JSEARCH_MODEL"
class="element-search search-query"
ui="chosen"/>
this is not tested yet on my component, so I apologize in advance if there is a mistake, I'll give more details when I'll have.