I have a good functioning search tool at present using cakeDC search plugin. I can search very well with the pagination.
My problem here is that when i search from page:2 it doesn't at all.
here is my code:
Customer model
public $actsAs = array('Search.Searchable');
public $filterArgs = array(
'searchTerm' => array(
'type' => 'like',
'field' => array('Customer.name', 'Customer.mobile', 'Customer.address'),
'filter' => array('type' => 'query', 'method' => 'orConditions')
)
);
public function orConditions($data = array()) {
$filter = $data['filter'];
$cond = array(
'OR' => array(
'Customer.name LIKE' => '%' . $filter . '%',
'Customer.mobile LIKE' => '%' . $filter . '%',
'Customer.address LIKE' => '%' . $filter . '%',
));
return $cond;
}
CustomersController
public $components = array('Paginator', 'Session', 'Search.Prg');
public $presetVars = true;
public function index() {
$this->Prg->commonProcess();
$this->paginate = array();
$conditions = $this->Customer->parseCriteria($this->passedArgs);
$this->Customer->recursive = 0;
$this->paginate = array(
'limit' => 5,
);
$this->set('customers', $this->paginate($this->modelClass, $conditions));
$this->set('model', $this->modelClass);
}
index.ctp
<?php echo $this->Form->create() ?>
<?php echo $this->Form->input('searchTerm', array('class' => 'form-control','placeholder' => 'search for customer', 'label' => FALSE,'url' => array_merge(array('action' => 'index'), $this->params['pass']))); ?>
<?php echo $this->Form->end() ?>
Error: The requested address '/KPautos/products/index/page:2?searchTerm=j' was not found on this server.
Search is not working on page:2...
Any help would be heartily appritiated...Thank you in advance