Fix to the updated search attributes

- issue on the live server with the search field left empty, fixed
pull/63/head
Andras Iklody 2013-02-28 09:57:43 +01:00
parent 01649046c0
commit 5ab2de4824
1 changed files with 8 additions and 4 deletions

View File

@ -734,8 +734,8 @@ class AttributesController extends AppController {
$this->Session->write('paginate_conditions',array());
if ($this->request->is('post') && ($this->request->here == $fullAddress)) {
$keyword = $this->request->data['Attribute']['keyword'];
$keyword2 = $this->request->data['Attribute']['keyword2'];
$keyword = Sanitize::clean($this->request->data['Attribute']['keyword']);
$keyword2 = Sanitize::clean($this->request->data['Attribute']['keyword2']);
$type = $this->request->data['Attribute']['type'];
$category = $this->request->data['Attribute']['category'];
$this->set('keywordSearch', $keyword);
@ -760,7 +760,9 @@ class AttributesController extends AppController {
$i++;
}
$this->set('keywordSearch', $keyWordText);
$conditions['OR'] = $temp;
if (!empty($temp)){
$conditions['OR'] = $temp;
}
}
if (isset($keyword2)) {
$keywordArray2 = explode("\n", $keyword2);
@ -776,7 +778,9 @@ class AttributesController extends AppController {
$i++;
}
$this->set('keywordSearch2', $keyWordText2);
$conditions['AND'] = $temp;
if (!empty($temp)){
$conditions['AND'] = $temp;
}
}
if ($type != 'ALL') {
$conditions['Attribute.type ='] = $type;