Subversion Repositories SmartDukaan

Rev

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

Rev 13903 Rev 14139
Line 56... Line 56...
56
			//Get StoreProduct Info
56
			//Get StoreProduct Info
57
			$this->loadModel('Store');
57
			$this->loadModel('Store');
58
			// $options = array('conditions'=>array('id'=>$storeProductId),'fields'=>array('source_id','available_price','url'),'recursive'=>-1);
58
			// $options = array('conditions'=>array('id'=>$storeProductId),'fields'=>array('source_id','available_price','url'),'recursive'=>-1);
59
			// $storeProduct = $this->StoreProduct->find('first',$options);
59
			// $storeProduct = $this->StoreProduct->find('first',$options);
60
			$cachekey = 'storeproduct-'.$storeProductId;
60
			$cachekey = 'storeproduct-'.$storeProductId;
61
			$product = Cache::read($cachekey,'month');
61
			$product = Cache::read($cachekey,'five');
62
			if(empty($product)) {
62
			if(empty($product)) {
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,'five');			
66
			}
66
			}
67
			$storeProduct = json_decode($product[0],1);
67
			$storeProduct = json_decode($product[0],1);
68
			$cachekey = 'store-'.$storeProduct['source_id'];
68
			$cachekey = 'store-'.$storeProduct['source_id'];
69
			$store = Cache::read($cachekey,'month');
69
			$store = Cache::read($cachekey,'month');
70
			if(empty($store)) {
70
			if(empty($store)) {
Line 73... Line 73...
73
			}
73
			}
74
			$prefix = "SHA".$storeProduct['source_id'];
74
			$prefix = "SHA".$storeProduct['source_id'];
75
			$tag = $prefix.time();
75
			$tag = $prefix.time();
76
			if($storeProduct['source_id'] == 2){
76
			if($storeProduct['source_id'] == 2){
77
				$url_parts = parse_url($storeProduct['marketPlaceUrl']);
77
				$url_parts = parse_url($storeProduct['marketPlaceUrl']);
78
				// $url = "http://dl.flipkart.com/dl".$url_parts['path'].'?'.$url_parts['query'];
-
 
-
 
78
/*
79
				if(isset($url_parts['query'])) {
79
				if(isset($url_parts['query'])) {
80
					$url = "http://m.flipkart.com/".$url_parts['path'].'?'.$url_parts['query'];
80
					$url = "http://m.flipkart.com".$url_parts['path'].'?'.$url_parts['query'];
81
				}else{
81
				}else{
82
					$url = "http://m.flipkart.com/".$url_parts['path'];
82
					$url = "http://m.flipkart.com".$url_parts['path'];
83
				}
83
				}
-
 
84
*/
-
 
85
				$url = str_replace('www','m',$storeProduct['marketPlaceUrl']);
84
			} elseif($storeProduct['source_id'] == 3) {
86
			} elseif($storeProduct['source_id'] == 3) {
85
				$url_parts = parse_url($storeProduct['marketPlaceUrl']);
87
				$url_parts = parse_url($storeProduct['marketPlaceUrl']);
86
				$url_parts['path'] = str_replace('viewAllSellers/','',$url_parts['path']);//quickfix for snapdeal
88
				$url_parts['path'] = str_replace('viewAllSellers/','',$url_parts['path']);//quickfix for snapdeal
87
				if(isset($url_parts['query'])) {
89
				if(isset($url_parts['query'])) {
88
					$url = "http://m.snapdeal.com".$url_parts['path'].'?'.$url_parts['query']."&utm_source=aff_prog&utm_campaign=afts&offer_id=17";
90
					$url = "http://m.snapdeal.com".$url_parts['path'].'?'.$url_parts['query']."&utm_source=aff_prog&utm_campaign=afts&offer_id=17";