Subversion Repositories SmartDukaan

Rev

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

Rev 13532 Rev 13682
Line 13... Line 13...
13
 *
13
 *
14
 * @var array
14
 * @var array
15
 */
15
 */
16
	public $components = array('Paginator');
16
	public $components = array('Paginator');
17
 
17
 
-
 
18
	public function brand($action='hide') {
-
 
19
		$this->response->type('json');
-
 
20
		$this->layout = 'ajax';
-
 
21
		$userId = $this->request->query('user_id');
-
 
22
		$productId = $this->request->query('product_id');
-
 
23
		$hide = $this->request->query('hide');
-
 
24
		if(isset($hide) && !empty($hide) && $hide == 1){
-
 
25
			$this->loadModel('StoreProduct');
-
 
26
			$options = array('conditions'=>array('id'=>$productId),'fields'=>array('category_id','brand'),'recursive'=>-1);
-
 
27
			$product = $this->StoreProduct->find('first',$options);
-
 
28
			$this->loadModel('UserCategoryHiddenBrand');
-
 
29
			$data = array('user_id' => $userId, 'category_id' => $product['StoreProduct']['category_id'],'brand'=>$product['StoreProduct']['brand']);
-
 
30
			$this->UserCategoryHiddenBrand->create();
-
 
31
			if($this->UserCategoryHiddenBrand->save($data)){
-
 
32
				$result = array('success'=>true,'message'=>'brand hidden');
-
 
33
			}else{
-
 
34
				$result = array('success'=>false,'message'=>'database issue');
-
 
35
			}
-
 
36
		}else{
-
 
37
			$result = array('success'=>false,'message'=>'brand not hidden');
-
 
38
		}
-
 
39
		// $callback = $this->request->query('callback');
-
 
40
		$this->set(array(
-
 
41
		    'result' => $result,
-
 
42
		    // 'callback' => $callback,
-
 
43
		    '_serialize' => array('result')
-
 
44
		));
-
 
45
		$this->render('/Elements/json');
-
 
46
	}
-
 
47
 
18
/**
48
/**
19
 * index method
49
 * index method
20
 *
50
 *
21
 * @return void
51
 * @return void
22
 */
52
 */