Subversion Repositories SmartDukaan

Rev

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

Rev 17174 Rev 17183
Line 126... Line 126...
126
		// $brands = $this->request->query('brands');
126
		// $brands = $this->request->query('brands');
127
		if($id != 2) {
127
		if($id != 2) {
128
			//Fetch deals
128
			//Fetch deals
129
			$likedDeals = $disLikedDeals = array();
129
			$likedDeals = $disLikedDeals = array();
130
			$brandschosen = $_COOKIE['brandschosen'];
130
			$brandschosen = $_COOKIE['brandschosen'];
131
			if((isset($_COOKIE['old_id'])) && ($_COOKIE['old_id'] != $id))
131
			if((isset($_COOKIE['old_id'])) && ($_COOKIE['old_id'] != $id)) {
132
			{
-
 
133
				unset($brandschosen);
132
				unset($brandschosen);
134
				setcookie('brandschosen', 1, time()-1, '/');
133
				setcookie('brandschosen', 1, time()-1, '/');
135
			}
-
 
136
			else
-
 
137
			{
-
 
138
				$brandschosen = $_COOKIE['brandschosen'];	  		
-
 
139
			}
134
			}			
140
			// $this->check_id($id);
-
 
141
			if(!isset($_COOKIE['old_id']))
135
			if(!isset($_COOKIE['old_id'])) {
142
			{
-
 
143
				setcookie('old_id',$id);	
136
				setcookie('old_id',$id);	
144
			}
-
 
145
			else
137
			} else {
146
			{
-
 
147
				// unset($_COOKIE['brandschosen']);
-
 
148
				unset($_COOKIE['old_id']);
-
 
149
				setcookie('old_id',$id);
138
				setcookie('old_id',$id);
150
			}
139
			}			
151
			
-
 
152
			if(!empty($brandschosen)){
140
			if(!empty($brandschosen)){
153
				$filter = 'brand';
141
				$filter = 'brand';
154
			}
142
			}
155
			$brands = str_replace(',', '^', $brandschosen);
143
			$brands = str_replace(',', '^', $brandschosen);
156
			$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands);
144
			$url = $this->getDealsApiUrl($page,$this->Auth->User('id'),$id,$sort,$direction,$filter,$brands);
Line 163... Line 151...
163
						$deals[] = $value;
151
						$deals[] = $value;
164
					}
152
					}
165
				}
153
				}
166
			}
154
			}
167
			$this->loadModel('Api');
155
			$this->loadModel('Api');
168
			// $apideals = $this->Api->getDealsByCategory($this->Auth->User('id'),$id,$page);
-
 
169
			// $deals = $apideals['products'];
-
 
170
			$myactions = $this->Api->getMyActions($this->Auth->User('id'));
156
			$myactions = $this->Api->getMyActions($this->Auth->User('id'));
171
			if(!empty($myactions)) {
157
			if(!empty($myactions)) {
172
				foreach ($myactions['actions'] as $key => $value) {
158
				foreach ($myactions['actions'] as $key => $value) {
173
					if($value['UserAction']['action'] == 'like'){
159
					if($value['UserAction']['action'] == 'like'){
174
						$likedDeals[$value['UserAction']['store_product_id']] = $value['UserAction']['id'];
160
						$likedDeals[$value['UserAction']['store_product_id']] = $value['UserAction']['id'];
Line 187... Line 173...
187
		}else{
173
		}else{
188
			//Check for apk support of sharing
174
			//Check for apk support of sharing
189
			$sharable = 0;
175
			$sharable = 0;
190
			if(isset($_COOKIE['shareApps']) && !empty($_COOKIE['shareApps'])) {
176
			if(isset($_COOKIE['shareApps']) && !empty($_COOKIE['shareApps'])) {
191
				$sharable = 1;
177
				$sharable = 1;
192
			}
178
			}			
193
			//Fetch app offers
-
 
194
			// $this->loadModel('AppOffer');
-
 
195
			// $this->AppOffer->recursive = -1;
-
 
196
			// $options = array('conditions'=>array('offer_active'=>1,'show'=>1),'limit' => Configure::read('searchresultsperpage'),'page'=>$page);
-
 
197
			// $this->Paginator->settings = $options;
-
 
198
			// $this->set('appOffers', $this->Paginator->paginate('AppOffer'));
-
 
199
			$url = $this->apihost."appOffers/1";
179
			$url = $this->apihost."appOffers/1";
200
			$appOffers = $this->make_request($url,null);
180
			$appOffers = $this->make_request($url,null);
201
			$this->set(compact('page','id','sharable','appOffers'));
181
			$this->set(compact('page','id','sharable','appOffers'));
202
			$this->render('viewapps');
182
			$this->render('viewapps');
203
		}
183
		}