我有一個很好的功能搜索工具,目前使用cakeDC搜索插件。我可以用分頁進行很好的搜索。搜索不工作頁面:2使用cakeDC搜索插件
我在這裏的問題是,當我從頁面搜索:2它根本沒有。
這裏是我的代碼:
客戶模式
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.
搜尋工作不頁:2 ...
任何幫助將衷心appritiated ...謝謝你提前
你能不能顯示你的代碼?如何搜索? – Sadikhasan 2014-09-25 10:27:46
你沒有任何第2頁searchTerm'j',你可以重定向用戶回搜索這樣的案例 – Abhishek 2014-09-25 11:12:20
@Sadikhasan我編輯了我的問題,並提供了搜索代碼....實際上我已經使用cakeDC搜索插件。 – 2014-09-26 03:29:37