Subversion Repositories SmartDukaan

Rev

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

Rev 13808 Rev 13863
Line 57... Line 57...
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,'month');
62
			if(empty($storeProduct)) {
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,'month');			
66
			}
66
			}
67
			$storeProduct = json_decode($product[0],1);
67
			$storeProduct = json_decode($product[0],1);
68
			$store = $this->Store->find('first',array('recursive'=>-1,'conditions'=>array('id'=>$storeProduct['source_id'])));
68
			$store = $this->Store->find('first',array('recursive'=>-1,'conditions'=>array('id'=>$storeProduct['source_id'])));
69
			$prefix = "SHA".$storeProduct['source_id'];
69
			$prefix = "SHA".$storeProduct['source_id'];
70
			$tag = $prefix.time();
70
			$tag = $prefix.time();
71
			if($storeProduct['source_id'] == 2){
71
			if($storeProduct['source_id'] == 2){
72
				$url_parts = parse_url($storeProduct['marketPlaceUrl']);
72
				$url_parts = parse_url($storeProduct['marketPlaceUrl']);
73
				$url = "http://dl.flipkart.com/dl".$url_parts['path'].'?'.$url_parts['query'];
73
				// $url = "http://dl.flipkart.com/dl".$url_parts['path'].'?'.$url_parts['query'];
-
 
74
				$url = "http://m.flipkart.com/".$url_parts['path'].'?'.$url_parts['query'];
74
			} elseif($storeProduct['source_id'] == 3) {
75
			} elseif($storeProduct['source_id'] == 3) {
-
 
76
				$url_parts = parse_url($storeProduct['marketPlaceUrl']);
75
				$url = $storeProduct['marketPlaceUrl']."?utm_source=aff_prog&utm_campaign=afts&offer_id=17";
77
				$url = "http://m.snapdeal.com".$url_parts['path'].'?'.$url_parts['query']."&utm_source=aff_prog&utm_campaign=afts&offer_id=17";
76
			}else{
78
			}else{
77
				$url = $storeProduct['marketPlaceUrl'];
79
				$url = $storeProduct['marketPlaceUrl'];
78
			}
80
			}
79
			if( strpos($url, '?') === false ) {
81
			if( strpos($url, '?') === false ) {
80
				$firstChar = '?';
82
				$firstChar = '?';