Hello qualiteam,
I am explaining step by step below: Please try to understand my problem.
1. At x-cart backend, I have create a page where n number of records are listed and there is a notify button for each record as shown in attachment.
2. I just want that when i click on the Notify Button i just want to show a notification in mozila firefox as like other eCommerce site send a notification for their new products or any other information when i subscribed their notification service.
3. So for that purpose on the click on that notification button i will call an ajax and the targer of that ajax is Notiftmplt and action is Notify.
4. Then Under the Notify function of that controller class Notiftemplt, i just call that finction sendPushMozila() which have the following code below:
PHP Code:
public function sendPushMozila($sub_ids){
$url = 'https://updates.push.services.mozilla.com/wpush/v1/';
$headers = array(
'Content-Type: application/json',
'TTL: 600000'
);
foreach ($sub_ids as $key => $value) {
$final_url=$url.$value;
$ch = curl_init();
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $final_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
/*curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));*/
$result = curl_exec($ch);
//var_dump($result); die;
curl_close($ch);
}
}
In the above code the
$sub_ids is the subscription ids of more users.
IF any further clarification, Please let me know.