Subversion Repositories SmartDukaan

Rev

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

Rev 18212 Rev 18223
Line 20... Line 20...
20
	public function beforeFilter() {
20
	public function beforeFilter() {
21
		parent::beforeFilter();
21
		parent::beforeFilter();
22
		$this->Auth->allow('deals');
22
		$this->Auth->allow('deals');
23
		$this->apihost = Configure::read('pythonapihost');
23
		$this->apihost = Configure::read('pythonapihost');
24
		$this->limit = Configure::read('dealsperpage');
24
		$this->limit = Configure::read('dealsperpage');
-
 
25
		$this->mobileapi = Configure::read('saholicapihost');
-
 
26
		
25
	}
27
	}
26
 
28
 
27
/**
29
/**
28
 * index method
30
 * index method
29
 *
31
 *
Line 228... Line 230...
228
		    $filterstr = '';
230
		    $filterstr = '';
229
			if(isset($filter) && !empty($filter)){
231
			if(isset($filter) && !empty($filter)){
230
				
232
				
231
			    $filterstr = '&filter='.$filter.'&brands='.$brands.'&subcategories='.$subcategories;
233
			    $filterstr = '&filter='.$filter.'&brands='.$brands.'&subcategories='.$subcategories;
232
		  	} 
234
		  	} 
233
 
-
 
234
 
-
 
235
		  	$get_url = "'".$_SERVER['REQUEST_URI']."'";
235
		  	$get_url = "'".$_SERVER['REQUEST_URI']."'";
236
		  	$urlArray = explode('=',$_SERVER['REQUEST_URI']);
236
		  	$urlArray = explode('=',$_SERVER['REQUEST_URI']);
237
		  	$last = $urlArray[sizeof($urlArray)-1];
237
		  	$last = $urlArray[sizeof($urlArray)-1];
238
		  	
238
		  	
239
		  	// <Code for url used after scrolling...>
239
		  	// <Code for url used after scrolling...>
Line 404... Line 404...
404
 
404
 
405
	}
405
	}
406
 
406
 
407
	public function dealdetail($item_id = null){
407
	public function dealdetail($item_id = null){
408
		$this->layout = "innerpages";
408
		$this->layout = "innerpages";
409
		$deal = array();
409
		$dealinfo = $deal = array();
-
 
410
		$likedDeals = $disLikedDeals = array();
-
 
411
		$url = $this->mobileapi.'entity/'.$item_id;
410
		$dealinfo = json_decode('{"entity":{"id":1015088,"url":"mobile-phones/lava-iris-atom-2-1015088","keySpecs":["Dual-SIM, 4.5-inch display, Android KitKat","1.3GHz quad core processor, 512MB RAM","5MP rear and VGA front camera"],"detailedSpecs":[{"title":"Look n Feel","specs":[{"name":"Weight","values":["130 g"]},{"name":"Size","values":["134 x 66 x 9.15 mm"]},{"name":"Form factor","values":["Candybar"]},{"name":"Keyboard","values":["Touchscreen QWERTY keyboard, Touchscreen T9 keyboard"]},{"name":"Hard keys","values":["Power button, Volume keys"]},{"name":"Color","values":["White, Black"]}]},{"title":"Display","specs":[{"name":"Type","values":["TFT LCD"]},{"name":"Screen size","values":["4.5 inch"]},{"name":"Touchscreen type","values":["Capacitive touchscreen"]},{"name":"Resolution","values":["854 x 480 px"]},{"name":"Number of colors","values":["16 M"]},{"name":"Sensors","values":["Accelerometer sensor"]}]},{"title":"Camera","specs":[{"name":"Back camera","values":["5 megapixels"]},{"name":"Flash","values":["LED"]},{"name":"Image formats","values":["JPEG"]},{"name":"Front camera","values":["VGA"]},{"name":"Additional camera features","values":["Panaroma capture, HDR, Digital zoom, Video recording"]}]},{"title":"Hardware","specs":[{"name":"Processor","values":["1.3 GHz Quad core"]}]},{"title":"Memory","specs":[{"name":"Built-in","values":["8 GB"]},{"name":"RAM","values":["512 MB"]},{"name":"Expansion type","values":["MicroSD card"]},{"name":"Expansion capacity","values":["32 GB"]}]},{"title":"Connectivity","specs":[{"name":"GPRS","values":["Yes"]},{"name":"EDGE","values":["Yes"]},{"name":"3G","values":["Yes"]},{"name":"Wi-Fi","values":["Wi-Fi 802.11 b/g/n"]},{"name":"Bluetooth","values":["v2.0"]},{"name":"USB","values":["MicroUSB v2.0"]},{"name":"GPS type","values":["Integrated GPS, A-GPS"]}]},{"title":"Communication","specs":[{"name":"Multiple SIM","values":["Dual-SIM"]},{"name":"2G network","values":["Dualband (GSM 900/1800)"]},{"name":"3G network","values":["WCDMA 2100"]},{"name":"Communication facilities","values":["SMS, Email, Instant messaging"]}]},{"title":"Software","specs":[{"name":"OS","values":["Android v4.4 (KitKat)"]},{"name":"OS upgradeable","values":["Android  v5.1 (Lollipop)"]}]},{"title":"Battery","specs":[{"name":"Capacity","values":["Talk time 2G - 16 hours,Talk time 3G - 6 hours","Standby time 2G - 6 days"]},{"name":"Battery type","values":["Li-Ion 1750 mAh battery"]},{"name":"Charger connector pin","values":["MicroUSB"]}]},{"title":"Music","specs":[{"name":"Music formats","values":["MP3"]},{"name":"Earphone","values":["3.5mm headset"]},{"name":"FM radio","values":["Yes"]}]},{"title":"Video","specs":[{"name":"File formats","values":["MP4"]},{"name":"Video recording","values":["Yes"]}]},{"title":"Miscellaneous","specs":[{"name":"Organizer","values":["Calculator, Alarm, Clock, Calendar"]},{"name":"Other features","values":["oogle Play, Google Search, Gmail, Hangout, Opera Mini, Torch, Clean Master, Note, Auto call recording, Smart gesture control"]}]}],"warranty":"1 year manufacturer\u0027s warranty","pinCode":"110001","logisticsInfo":{"business_days":1,"cod_delivery_estimate":"Mon 11-Jan-16","is_cod_available_for_location":true,"delivery_estimate":"Tomorrow, Sat 09-Jan-16","on_time_guarantee":true},"name":"Lava Iris Atom 2","categoryName":"Mobile Phone","categoryUrl":"mobile-phone/10006","breadCrumb":"\u003ca href\u003d\u0027/\u0027\u003eHome\u003c/a\u003e\u0026nbsp;\u0026gt;\u0026nbsp;\u003ca href\u003d\u0027/mobile-phone/10006\u0027\u003eMobile Phone\u003c/a\u003e\u0026nbsp;\u0026gt;\u0026nbsp;\u003ca href\u003d\u0027/lava\u0027\u003eLava\u003c/a\u003e\u0026nbsp;\u003ca\u003eIris Atom 2\u003c/a\u003e","exclusiveAffiliateInfo":[],"dtrAffiliateJSON":{"map":{"products":{"myArrayList":[{"map":{"source_product_name":"Lava Iris Atom 2 (White)","gross_price":0,"codAvailable":1,"available_price":3949.0,"marketPlaceUrl":"http://www.amazon.in/gp/offer-listing/B013SS1Z3Q","_id":25655,"source_id":1,"offer":"","coupon":""}},{"map":{"source_product_name":"Lava Iris Atom 2 (Black)","gross_price":0,"codAvailable":1,"available_price":4049.0,"marketPlaceUrl":"http://www.amazon.in/gp/offer-listing/B013SS1HMU","_id":25656,"source_id":1,"offer":"","coupon":""}},{"map":{"source_product_name":"Lava Iris Atom 2 8 GB(White)","gross_price":4189.0,"codAvailable":0,"available_price":3980,"marketPlaceUrl":"https://paytm.com/shop/p/lava-iris-atom-2-8-gb-white-MOBLAVA-IRIS-ATSURP492176AE8F567","_id":26991,"source_id":6,"offer":"","coupon":"SAVE5"}},{"map":{"source_product_name":"Lava Iris Atom 2(White, 8 GB)","gross_price":0,"codAvailable":1,"available_price":4049,"marketPlaceUrl":"http://www.flipkart.com/lava-iris-atom-2/p/itmea7n9uaebk2wg?pid\u003dMOBEA7N9CFEUQAGF","_id":26205,"source_id":2,"offer":"","coupon":""}},{"map":{"source_product_name":"Lava Iris Atom 2(Black, 8 GB)","gross_price":0,"codAvailable":1,"available_price":3900,"marketPlaceUrl":"http://www.flipkart.com/lava-iris-atom-2/p/itmea7n9uaebk2wg?pid\u003dMOBEA7N9UZVFS9WJ","_id":26206,"source_id":2,"offer":"","coupon":""}},{"map":{"source_product_name":"Lava Iris Atom 2 8gb White","gross_price":0,"codAvailable":1,"available_price":4049.0,"marketPlaceUrl":"http://www.snapdeal.com/product/lava-iris-atom-2-8gb/625585008444","_id":26203,"source_id":3,"offer":"","coupon":""}},{"map":{"source_product_name":"Lava Iris Atom 2 8gb Black","gross_price":0,"codAvailable":1,"available_price":4049.0,"marketPlaceUrl":"http://www.snapdeal.com/product/lava-iris-atom-2-8gb/641089836520","_id":26204,"source_id":3,"offer":"","coupon":""}},{"map":{"source_product_name":"Lava Iris Atom 2 (Black)","gross_price":4049,"codAvailable":0,"available_price":3847,"marketPlaceUrl":"https://paytm.com/shop/p/lava-iris-atom-2-black-MOBLAVA-IRIS-ATTHE-340303C4506A8","_id":28212,"source_id":6,"offer":"","coupon":"SAVE5"}}]}}},"defaultImageUrl":"http://static2.saholic.com/images/media/1015088/lava-iris-atom-2-default-1442230687000.jpg","iconImageUrl":"http://static2.saholic.com/images/media/1015088/lava-iris-atom-2-icon-1442230687000.jpg","thumbnailImageUrl":"http://static2.saholic.com/images/media/1015088/lava-iris-atom-2-thumbnail-1442230687000.jpg","images":[{"title":"Image 1","url":"http://static2.saholic.com/images/media/1015088/lava-iris-atom-2-default-1442230644000.jpg"},{"title":"Image 2","url":"http://static2.saholic.com/images/media/1015088/lava-iris-atom-2-2-1442230653000.jpg"},{"title":"Image 3","url":"http://static2.saholic.com/images/media/1015088/lava-iris-atom-2-3-1442230662000.jpg"},{"title":"Image 4","url":"http://static2.saholic.com/images/media/1015088/lava-iris-atom-2-4-1442230668000.jpg"}],"videos":[],"packageContents":["Handset","Battery","Charger","Headset","Data cable","User guide "],"items":[{"sellingPrice":4049.0,"id":20889,"color":"White","minEmi":250.0,"buttonText":"BUY NOW","showSellingPrice":true,"comingSoon":false,"dealPojo":{"itemId":20889,"dealTextOption":1,"dealText":"","isCod":true,"dealPrice":3949.0,"dealFreebieOption":1,"freebieItemId":0}},{"sellingPrice":4049.0,"id":20963,"color":"Black","minEmi":250.0,"buttonText":"NOTIFY ME","showSellingPrice":true,"comingSoon":false,"dealPojo":{"itemId":20963,"dealTextOption":1,"dealText":"","isCod":true,"dealPrice":3949.0,"dealFreebieOption":1,"freebieItemId":0}}],"title":"Lava Iris Atom 2 Price in India | Specifications, Features and Reviews","metaDescription":"Buy Lava Iris Atom 2 at 4049.0. All mobile phones are 100% Original and carry full Manufacturers Warranty since we procure directly from the Brand. Free Next Day Delivery."}}',true);
412
		$dealinfo = $this->make_request($url,null);
-
 
413
		$this->loadModel('Api');
-
 
414
		$myactions = $this->Api->getMyActions($this->Auth->User('id'));
-
 
415
		if(!empty($myactions)) {
-
 
416
			foreach ($myactions['actions'] as $key => $value) {
-
 
417
				if($value['UserAction']['action'] == 'like'){
-
 
418
					$likedDeals[$value['UserAction']['store_product_id']] = $value['UserAction']['id'];
-
 
419
				}else{
411
		$deal = json_decode('{"coupon": "", "marketPlaceUrl": "http://www.saholic.com/mobile-accessories/imported-thread-usb-cable-(10-retail-packs)-1015160", "buyBoxFlag": 1, "showMrp": 0.0, "rank": 0, "brand_id": 420, "ppq": 14, "videoLink": "", "priceUpdatedOn": 1452163605232, "sourceCategoryId": "", "category": "Accs", "cash_back": 0.0, "subCategory": "Cable", "updatedOn": 1452163605232, "tagline": "<p>One meter length</p>\r\n", "stock_status": "In Stock", "shippingCost": 0.0, "cash_back_type": 1, "gross_price": 0, "cashback": "", "filterLink": "/category/6?searchFor=Cable&filter=subcategory&subcategories=8", "persPoints": 6199.0, "source_product_name": "Imported Thread USB Cable (10 PCS)", "product_name": "Imported Thread USB Cable (10 PCS)", "status": 4, "showVideo": 0.0, "identifier": "1015160", "offer": "", "brand": "Imported", "availabilityInfo": [{"minBuyQuantity": 1, "color": "", "quantityStep": 1, "sellingPriceType": "Private deal price", "maxQuantity": 20, "item_id": 20970, "sellingPrice": 140.0, "availability": 105, "bulkPricing": [{"price": 450.0, "quantity": 4}, {"price": 250.0, "quantity": 2}]}], "source_url": "", "ignorePricing": 0, "in_stock": 1, "sourceProductId": "", "source_id": 4, "skuBundleId": 4566, "available_price": 140, "dp": 899, "is_shortage": 0, "subCategoryId": 8, "category_id": 6, "snapdealSpecialItem": 0, "showDp": 0, "url": "", "codAvailable": 1, "mrp": 0, "maxPrice": 0, "thumbnail": "http://static2.saholic.com/images/media/1015160/imported-thread-usb-cable-(10-pcs)-default-1449817265000.jpg", "source": "saholic", "secondaryIdentifier": "", "filterText": "More Cable", "_id": 27183, "model_name": "Thread USB Cable", "addedOn": 1447936529901, "quantity": 10}',true);
420
					$disLikedDeals[$value['UserAction']['store_product_id']] = $value['UserAction']['id'];
-
 
421
				}
-
 
422
			}
412
		
423
		}
413
		$this->set(compact('deal','dealinfo'));
424
		$this->set(compact('deal','dealinfo','likedDeals','disLikedDeals'));
414
	}
425
	}
415
	
426
	
416
	public function getdealsforsearchterm($searchterm,$page = null){
427
	public function getdealsforsearchterm($searchterm,$page = null){
417
		$likedDeals = $disLikedDeals = array();
428
		$likedDeals = $disLikedDeals = array();
418
		$this->layout = 'ajax';
429
		$this->layout = 'ajax';