Subversion Repositories SmartDukaan

Rev

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

Rev 13901 Rev 13903
Line 63... Line 63...
63
				$url = $this->apihost.'masterData/getSkuById/'.$storeProductId;
63
				$url = $this->apihost.'masterData/getSkuById/'.$storeProductId;
64
				$product = $this->make_request($url,null);
64
				$product = $this->make_request($url,null);
65
				Cache::write($cachekey,$product,'month');			
65
				Cache::write($cachekey,$product,'month');			
66
			}
66
			}
67
			$storeProduct = json_decode($product[0],1);
67
			$storeProduct = json_decode($product[0],1);
-
 
68
			$cachekey = 'store-'.$storeProduct['source_id'];
-
 
69
			$store = Cache::read($cachekey,'month');
-
 
70
			if(empty($store)) {
68
			$store = $this->Store->find('first',array('recursive'=>-1,'conditions'=>array('id'=>$storeProduct['source_id'])));
71
				$store = $this->Store->find('first',array('recursive'=>-1,'conditions'=>array('id'=>$storeProduct['source_id'])));
-
 
72
				Cache::write($cachekey,$store,'month');			
-
 
73
			}
69
			$prefix = "SHA".$storeProduct['source_id'];
74
			$prefix = "SHA".$storeProduct['source_id'];
70
			$tag = $prefix.time();
75
			$tag = $prefix.time();
71
			if($storeProduct['source_id'] == 2){
76
			if($storeProduct['source_id'] == 2){
72
				$url_parts = parse_url($storeProduct['marketPlaceUrl']);
77
				$url_parts = parse_url($storeProduct['marketPlaceUrl']);
73
				// $url = "http://dl.flipkart.com/dl".$url_parts['path'].'?'.$url_parts['query'];
78
				// $url = "http://dl.flipkart.com/dl".$url_parts['path'].'?'.$url_parts['query'];
Line 76... Line 81...
76
				}else{
81
				}else{
77
					$url = "http://m.flipkart.com/".$url_parts['path'];
82
					$url = "http://m.flipkart.com/".$url_parts['path'];
78
				}
83
				}
79
			} elseif($storeProduct['source_id'] == 3) {
84
			} elseif($storeProduct['source_id'] == 3) {
80
				$url_parts = parse_url($storeProduct['marketPlaceUrl']);
85
				$url_parts = parse_url($storeProduct['marketPlaceUrl']);
-
 
86
				$url_parts['path'] = str_replace('viewAllSellers/','',$url_parts['path']);//quickfix for snapdeal
81
				if(isset($url_parts['query'])) {
87
				if(isset($url_parts['query'])) {
82
					$url = "http://snapdeal.com".$url_parts['path'].'?'.$url_parts['query']."&utm_source=aff_prog&utm_campaign=afts&offer_id=17";
88
					$url = "http://m.snapdeal.com".$url_parts['path'].'?'.$url_parts['query']."&utm_source=aff_prog&utm_campaign=afts&offer_id=17";
83
				}else{
89
				}else{
84
					$url = "http://snapdeal.com".$url_parts['path'].'?utm_source=aff_prog&utm_campaign=afts&offer_id=17';
90
					$url = "http://m.snapdeal.com".$url_parts['path'].'?utm_source=aff_prog&utm_campaign=afts&offer_id=17';
85
				}
91
				}
86
			}else{
92
			}else{
87
				$url = $storeProduct['marketPlaceUrl'];
93
				$url = $storeProduct['marketPlaceUrl'];
88
			}
94
			}
89
			if( strpos($url, '?') === false ) {
95
			if( strpos($url, '?') === false ) {
Line 109... Line 115...
109
			$this->set(array(
115
			$this->set(array(
110
			    'result' => $result,
116
			    'result' => $result,
111
			    'callback' => $callback,
117
			    'callback' => $callback,
112
			    '_serialize' => array('result')
118
			    '_serialize' => array('result')
113
			));
119
			));
-
 
120
			$url = $this->apihost.'Catalog/fetchLivePrices/?id='.$storeProductId;
-
 
121
			$this->make_request($url,null);
114
			$this->render('/Elements/jsonp');
122
			$this->render('/Elements/jsonp');
115
		}
123
		}
116
	}
124
	}
117
 
125
 
118
/**
126
/**