Jump to content

Push notifications for Cubecart orders - a solution


Recommended Posts

Have been asking for a lot of help recently with various issues - now time to give something back!!


On my old Cubecart 4 store, I got push notifications to my phone by signing up with Pushover (for literally a couple of quid) and then doing a bcc on the order processing e-mail to a special pushover e-mail address.


For my new Cubecart 5 store I have a slightly more elegant solution which sends order values to my phone.


I added this code to class/order.class.php around line 250 (after the order confirmation e-mail has been sent to customer):

          //CHRIS EDIT - Pushover notifications
          curl_setopt_array($ch = curl_init(), array(
            CURLOPT_URL => "https://api.pushover.net/1/messages.json",
            CURLOPT_POSTFIELDS => array(
              "token" => "YOURPUSHOVERTOKEN",
              "user" => "YOURPUSHOVERUSERID",
              "message" => "Order: ".$this->_order_summary['total'].". Customer: ".$this->_order_summary['last_name'].". Postcode: ".$this->_order_summary['postcode_d'],
            CURLOPT_SAFE_UPLOAD => true,
          //END CHRIS EDIT 

.. and it worked first time!





Link to comment
Share on other sites

Hi Chris

Thanks for your contribution and it is good that more people are offering things back ! It may be useful for some people especially as the service is a one-off cost for the app and then receiving notifications are free, subject to monthly limits, but a couple of points to note :

1) As you are changing a core CubeCart file, changes will be lost / need re-doing after each upgrade. I haven't looked to see whether it would be possible using hooks but that would prevent this.

2) As the recommended php code for this service uses the php curl_exec() function, many people will find that this will not work on their hosting as that function is usually disabled especially on shared hosting systems. This function, along with a handful of others, is always disabled on all our shared hosting servers - in fact, I would be very wary of hosting a site on a shared hosting server that allowed those functions



Link to comment
Share on other sites

Brilliant. Would be a great feature to be built in to Cubecart,


It saves me so much time. I no longer have to keep checking the order screen for new orders, I get a simple "ping" on my phone.


You can set quiet times too - so you don't get the notifications during the evening or on days off.


Keep up the good work!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...