Subversion Repositories SmartDukaan

Rev

Rev 15413 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15413 Rev 15767
Line 11... Line 11...
11
				$url = $data[0]['NotificationCampaign']['url'];
11
				$url = $data[0]['NotificationCampaign']['url'];
12
				$store = $this->Store->getByUrl($url);					
12
				$store = $this->Store->getByUrl($url);					
13
			}
13
			}
14
			foreach($data AS $user) {
14
			foreach($data AS $user) {
15
				// $this->out(print_r($user,1));				
15
				// $this->out(print_r($user,1));				
16
				$options = array('conditions'=>array('user_id'=>$user['Pushnotification']['user_id']),'fields'=>array('gcm_regid'),'order'=>array('id'=>'desc'));
16
				$options = array('conditions'=>array('user_id'=>$user['Pushnotification']['user_id']),'fields'=>array('id','gcm_regid'),'order'=>array('id'=>'desc'));
17
				$gcmUser = $this->GcmUser->find('first',$options);
17
				$gcmUser = $this->GcmUser->find('first',$options);
-
 
18
				$this->log("Sending to $user_id ".$gcmUser['GcmUser']['id']." ".$gcmUser['GcmUser']['gcm_regid'],'pushnotifications');
18
				$regIds = array($gcmUser['GcmUser']['gcm_regid']);
19
				$regIds = array($gcmUser['GcmUser']['gcm_regid']);
19
				$message = $user['NotificationCampaign'];					
20
				$message = $user['NotificationCampaign'];					
20
				if($user['NotificationCampaign']['type'] == 'url' && !empty($user['NotificationCampaign']['url'])) {
21
				if($user['NotificationCampaign']['type'] == 'url' && !empty($user['NotificationCampaign']['url'])) {
21
					$message['url'] = $this->generateAffiliateUrl($user['NotificationCampaign']['url'],$user['Pushnotification']['user_id'],$store);
22
					$message['url'] = $this->generateAffiliateUrl($user['NotificationCampaign']['url'],$user['Pushnotification']['user_id'],$store);
22
				}	
23
				}