Subversion Repositories SmartDukaan

Rev

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

Rev 17664 Rev 17682
Line 203... Line 203...
203
	   } 
203
	   } 
204
       } 
204
       } 
205
       return $headers; 
205
       return $headers; 
206
    } 
206
    } 
207
 
207
 
208
    public function getDealsApiUrl($page=1,$userId = null,$categoryId=0,$sort=null,$direction=null,$filter=null,$brands=null){
208
    public function getDealsApiUrl($page=1,$userId = null,$categoryId=0,$sort=null,$direction=null,$filter=null,$brands=null,$subcategories=null){
209
    	$this->log('categoryId '.$categoryId,'api');
209
    	$this->log('categoryId '.$categoryId,'api');
210
    	$this->log('page '.$page,'api');
210
    	$this->log('page '.$page,'api');
211
    	$offset = ($page - 1) * $this->limit;
211
    	$offset = ($page - 1) * $this->limit;
212
 
212
 
213
    	if(isset($sort) && !empty($sort) && $sort!=-1){
213
    	if(isset($sort) && !empty($sort) && $sort!=-1){
Line 219... Line 219...
219
    	$get_url = "'".$_SERVER['REQUEST_URI']."'";
219
    	$get_url = "'".$_SERVER['REQUEST_URI']."'";
220
    	$urlArray = explode('=',$_SERVER['REQUEST_URI']);
220
    	$urlArray = explode('=',$_SERVER['REQUEST_URI']);
221
		$last = $urlArray[sizeof($urlArray)-1];
221
		$last = $urlArray[sizeof($urlArray)-1];
222
 
222
 
223
    	if(!isset($filter) && empty($filter)){
223
    	if(!isset($filter) && empty($filter)){
224
    		$get_url = "'".$_SERVER['REQUEST_URI']."'";
224
    		// $get_url = "'".$_SERVER['REQUEST_URI']."'";
225
    		if (strpos($get_url,'filter=brand&brands') !== false)
225
    		if (strpos($get_url,'filter=brand&brands') !== false)
226
    		{
226
    		{
227
    			$url .= "&filterData=brandFilter:".$last;
227
    			$url .= "&filterData=brandFilter:".$last;
228
    			// echo $url;
228
    			// echo $url;
229
    		}
229
    		}
-
 
230
    		if (strpos($get_url,'filter=subcategory&subcategories') !== false)
-
 
231
    		{
-
 
232
    			$url .= "&filterData=subCategoryFilter:".$last;
-
 
233
    			// echo "url",$url;
-
 
234
    			
-
 
235
    		}
230
 
236
 
231
    	}
237
    	}
232
 
238
 
-
 
239
    	
-
 
240
 
233
    	if(isset($filter) && !empty($filter)){
241
    	if(isset($filter) && !empty($filter)){
-
 
242
    		if(isset($brands) && !empty($brands)){
234
    		$url .= "&filterData=brandFilter:".$brands;
243
    			$url .= "&filterData=brandFilter:".$brands;
-
 
244
    			if(isset($subcategories) && !empty($subcategories)){
-
 
245
    				$url .= "|subCategoryFilter:".$subcategories;
-
 
246
    			}
-
 
247
    		}else{
-
 
248
    			if(isset($subcategories) && !empty($subcategories)){
-
 
249
    				$url .= "&filterData=subCategoryFilter:".$subcategories;
-
 
250
    			}
-
 
251
    		}
235
    	}
252
    	}
-
 
253
    	// print_r($url);
236
    	return $url;
254
    	return $url;
237
    }
255
    }
238
 
256
 
239
	function make_request($url,$fields,$format='json'){
257
	function make_request($url,$fields,$format='json'){
240
		$this->log("[url] $url",'api');
258
		$this->log("[url] $url",'api');