Batch search for attributes

Implementation of request to be able to do batch attribute searches
pull/63/head
Andras Iklody 2013-01-17 16:03:04 +01:00
parent 755f19c560
commit f544ac2e08
2 changed files with 9 additions and 2 deletions

View File

@ -651,7 +651,14 @@ class AttributesController extends AppController {
// search the db
$conditions = array();
if ($keyword) {
$conditions['Attribute.value LIKE'] = '%' . $keyword . '%';
$keywordArray = explode("\n", $keyword);
$i = 0;
$temp = array();
foreach ($keywordArray as $keywordArrayElement){
$keywordArrayElement = '%' . trim($keywordArrayElement) . '%';
array_push($temp, array('Attribute.value LIKE' => $keywordArrayElement));
}
$conditions['OR'] = $temp;
}
if ($type != 'ALL') {
$conditions['Attribute.type ='] = $type;

View File

@ -3,7 +3,7 @@
<fieldset>
<legend><?php echo __('Search Attribute'); ?></legend>
<?php
echo $this->Form->input('keyword');
echo $this->Form->input('keyword', array('type' => 'textarea'));
echo $this->Form->input('type', array('between' => $this->Html->div('forminfo', '', array('id' => 'AttributeTypeDiv'))));
echo $this->Form->input('category', array('between' => $this->Html->div('forminfo', '', array('id' => 'AttributeCategoryDiv'))));
?>