Subversion Repositories SmartDukaan

Rev

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

Rev 14049 Rev 14051
Line 144... Line 144...
144
					$priceSaved = true;
144
					$priceSaved = true;
145
				}else{
145
				}else{
146
					$errors[] = $this->PricePreference->validationErrors;
146
					$errors[] = $this->PricePreference->validationErrors;
147
				}
147
				}
148
			}
148
			}
149
			if(!empty($this->request->data['brand'])){
149
			//if(!empty($this->request->data['brand'])){
150
				//First delete all shown brands of this category
150
				//First delete all shown brands of this category
151
				$this->loadModel('BrandPreference');
151
				$this->loadModel('BrandPreference');
152
				$this->BrandPreference->recursive = -1;
152
				$this->BrandPreference->recursive = -1;
153
				// $conditions = array('user_id'=>$this->request->data['user_id'],'category_id'=>$this->request->data['category_id'],'Brand.status'=>'show');
153
				// $conditions = array('user_id'=>$this->request->data['user_id'],'category_id'=>$this->request->data['category_id'],'Brand.status'=>'show');
154
				// $this->BrandPreference->deleteAll($conditions,false);
154
				// $this->BrandPreference->deleteAll($conditions,false);
Line 163... Line 163...
163
				if($this->BrandPreference->saveAll($data)){
163
				if($this->BrandPreference->saveAll($data)){
164
					$brandSaved = true;
164
					$brandSaved = true;
165
				}else{
165
				}else{
166
					$errors[] = $this->BrandPreference->validationErrors;
166
					$errors[] = $this->BrandPreference->validationErrors;
167
				}
167
				}
168
			}
168
			// }
169
			$this->response->type('json');
169
			$this->response->type('json');
170
			$this->layout = 'ajax';		
170
			$this->layout = 'ajax';		
171
			if($brandSaved || $priceSaved) {
171
			if($brandSaved || $priceSaved) {
172
				$result = array('success'=>true,'message'=>'Preferences Saved');
172
				$result = array('success'=>true,'message'=>'Preferences Saved');
173
			}else{
173
			}else{
174
				$result = array('success'=>false,'message'=>$errors);
174
				$result = array('success'=>false,'message'=>$errors);
175
			}
175
			}
-
 
176
			$url = $this->apihost.'resetCache/'.$this->request->data['user_id'];
-
 
177
			$this->make_request($url,null);
176
			$this->set(array(
178
			$this->set(array(
177
			    'result' => $result,
179
			    'result' => $result,
178
			    'callback' => $callback,
180
			    'callback' => $callback,
179
			    '_serialize' => array('result')
181
			    '_serialize' => array('result')
180
			));
182
			));