Subversion Repositories SmartDukaan

Rev

Rev 19700 | Rev 19731 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19700 Rev 19726
Line 1377... Line 1377...
1377
			}
1377
			}
1378
		}
1378
		}
1379
				
1379
				
1380
		$this->set(compact('id','phone','email'));
1380
		$this->set(compact('id','phone','email'));
1381
	}
1381
	}
-
 
1382
	
-
 
1383
	public function admin_userretailer()
-
 
1384
	{}
-
 
1385
	
-
 
1386
	public function admin_searchuserretailer()
-
 
1387
	{
-
 
1388
		$this->autoRender = false;
-
 
1389
		$this->request->onlyAllow ( 'ajax' );
-
 
1390
		$type = $this->request->query('type');
-
 
1391
		$search = $this->request->query('search');
-
 
1392
		$searchfor = $this->request->query('searchfor');
-
 
1393
		$this->User->recursive = -1;
-
 
1394
		$options = array('limit'=>100,'order'=>array('id'=>'desc'));
-
 
1395
		
-
 
1396
		$response = "";
-
 
1397
		if(!empty($type) && !empty($search)){			
-
 
1398
			if($searchfor == "usertype"){
-
 
1399
				$options['conditions'] = array($type.' LIKE '=>"%$search%");
-
 
1400
				$users = $this->User->find('all',$options);
-
 
1401
				$response = $users;
-
 
1402
			}elseif($searchfor == "retailertype"){
-
 
1403
				$this->loadModel('Retailer');
-
 
1404
				if($type=='contact'){
-
 
1405
					$options['conditions'] =array('OR'=>array('contact1 LIKE '=>"%$search%",'contact2 LIKE '=>"%$search%"));
-
 
1406
				}else{
-
 
1407
					$options['conditions'] = array($type.' LIKE '=>"%$search%");
-
 
1408
				}
-
 
1409
				
-
 
1410
				$users = $this->Retailer->find('all',$options);
-
 
1411
 
-
 
1412
				$response = $users;
-
 
1413
 
-
 
1414
			}
-
 
1415
 
-
 
1416
		}
-
 
1417
		return json_encode($response);
-
 
1418
	}
1382
}
1419
}