Version Notes
Release Notes
Download this release
Release Info
| Developer | Top Gear Media |
| Extension | TGM_Voodoo_Ext |
| Version | 3.1.2 |
| Comparing to | |
| See all releases | |
Code changes from version 2.3.7 to 3.1.2
- app/code/community/TGM/Voodoo/Block/Backend/Page/Header.php +1 -1
- app/code/community/TGM/Voodoo/Block/Credits-bkp.php +26 -0
- app/code/community/TGM/Voodoo/Block/Credits.php +1 -1
- app/code/community/TGM/Voodoo/Helper/Data-bkp.php +324 -0
- app/code/community/TGM/Voodoo/Helper/Data.php +16 -16
- app/code/community/TGM/Voodoo/Model/Observer-bkp-6-10-2015.php +427 -0
- app/code/community/TGM/Voodoo/Model/Observer.php +208 -180
- app/code/community/TGM/Voodoo/Model/Voodoo.php +4 -4
- app/code/community/TGM/Voodoo/etc/config.xml +1 -1
- app/code/community/TGM/Voodoo/etc/system.xml +34 -34
- app/design/frontend/default/default/layout/voodoo.xml +12 -0
- package.xml +4 -4
- skin/adminhtml/default/default/images/magepal.png +0 -0
app/code/community/TGM/Voodoo/Block/Backend/Page/Header.php
CHANGED
|
@@ -16,7 +16,7 @@ class TGM_Voodoo_Block_Backend_Page_Header
|
|
| 16 |
<img src="'.$this->getSkinUrl().'images/magepal.png" style="margin-left:-15px;"/>
|
| 17 |
<div style="margin: 0 auto;">
|
| 18 |
|
| 19 |
-
<h4 style="color:#EA7601;">Voodoo SMS Extension Community Edition
|
| 20 |
<h4>This module requires an account,
|
| 21 |
API username/password and SMS credits with <a href="http://www.voodoosms.com">www.voodoosms.com</a>.
|
| 22 |
<br>To register an account <a href="http://www.voodoosms.com/portal.html">click here</a>
|
| 16 |
<img src="'.$this->getSkinUrl().'images/magepal.png" style="margin-left:-15px;"/>
|
| 17 |
<div style="margin: 0 auto;">
|
| 18 |
|
| 19 |
+
<h4 style="color:#EA7601;">Voodoo SMS Extension Community Edition v3.1.2 by <a target="_blank" href="http://www.topgearmedia.co.uk"><strong>Top Gear Media</strong></a></h4>
|
| 20 |
<h4>This module requires an account,
|
| 21 |
API username/password and SMS credits with <a href="http://www.voodoosms.com">www.voodoosms.com</a>.
|
| 22 |
<br>To register an account <a href="http://www.voodoosms.com/portal.html">click here</a>
|
app/code/community/TGM/Voodoo/Block/Credits-bkp.php
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class TGM_Voodoo_Block_Credits extends Mage_Adminhtml_Block_System_Config_Form_Field
|
| 3 |
+
{
|
| 4 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
| 5 |
+
{
|
| 6 |
+
$this->setElement($element);
|
| 7 |
+
$credit = Mage::getModel('voodoo/voodoo')->getCredit();
|
| 8 |
+
if ($credit == '401: Unauthorized') {
|
| 9 |
+
$credit = 'There is an error check verification message';
|
| 10 |
+
$html ="<div style='font-size: 12px;'>$credit</div><a target='_blank' href='https://www.voodoosms.com/portal/account/addcredit'>Add More Credits</a>";
|
| 11 |
+
}
|
| 12 |
+
else{
|
| 13 |
+
$credits = explode('.',$credit);
|
| 14 |
+
$url = 'http://www.voodoosms.com/register.html';
|
| 15 |
+
if($credit[0]>0){
|
| 16 |
+
$html ="<div style='font-weight:bold;font-size: 14px;'>$credits[0]</div><a target='_blank' href='https://www.voodoosms.com/portal/account/addcredit'>Add More Credits</a>";
|
| 17 |
+
}
|
| 18 |
+
else{
|
| 19 |
+
$html ="<div style='font-weight:bold;font-size: 14px;'>You have insufficient credits</div><a target='_blank' href='https://www.voodoosms.com/portal/account/addcredit'>Add More Credits</a>";
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
return $html;
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
?>
|
app/code/community/TGM/Voodoo/Block/Credits.php
CHANGED
|
@@ -5,7 +5,7 @@ class TGM_Voodoo_Block_Credits extends Mage_Adminhtml_Block_System_Config_Form_F
|
|
| 5 |
{
|
| 6 |
$this->setElement($element);
|
| 7 |
$credit = Mage::getModel('voodoo/voodoo')->getCredit();
|
| 8 |
-
if ($credit ==
|
| 9 |
$credit = 'There is an error check verification message';
|
| 10 |
$html ="<div style='font-size: 12px;'>$credit</div><a target='_blank' href='https://www.voodoosms.com/portal/account/addcredit'>Add More Credits</a>";
|
| 11 |
}
|
| 5 |
{
|
| 6 |
$this->setElement($element);
|
| 7 |
$credit = Mage::getModel('voodoo/voodoo')->getCredit();
|
| 8 |
+
if ($credit == false) {
|
| 9 |
$credit = 'There is an error check verification message';
|
| 10 |
$html ="<div style='font-size: 12px;'>$credit</div><a target='_blank' href='https://www.voodoosms.com/portal/account/addcredit'>Add More Credits</a>";
|
| 11 |
}
|
app/code/community/TGM/Voodoo/Helper/Data-bkp.php
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class TGM_Voodoo_Helper_Data extends Mage_Core_Helper_Abstract
|
| 4 |
+
{
|
| 5 |
+
const CONFIG_PATH = 'voodoo/';
|
| 6 |
+
|
| 7 |
+
public function isOrdersEnabled()
|
| 8 |
+
{
|
| 9 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'orders/enabled');
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
public function isOptinsEnabled()
|
| 13 |
+
{
|
| 14 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'optins/enabled');
|
| 15 |
+
}
|
| 16 |
+
public function isbillingorshipping(){
|
| 17 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'deno/bish');
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
public function isOrderHoldEnabled()
|
| 21 |
+
{
|
| 22 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'order_hold/enabled');
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
public function isOrderUnholdEnabled()
|
| 26 |
+
{
|
| 27 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'order_unhold/enabled');
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
public function isOrderCanceledEnabled()
|
| 31 |
+
{
|
| 32 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'order_canceled/enabled');
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
public function isShipmentsEnabled()
|
| 36 |
+
{
|
| 37 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'shipments/enabled');
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
public function getUsername()
|
| 41 |
+
{
|
| 42 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'enter/username');
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
public function getPassword()
|
| 46 |
+
{
|
| 47 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'enter/password');
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
public function getSender()
|
| 51 |
+
{
|
| 52 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'orders/sender');
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
public function getSenderForOrderHold()
|
| 56 |
+
{
|
| 57 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'order_hold/sender');
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
public function getSenderForOrderUnhold()
|
| 61 |
+
{
|
| 62 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'order_unhold/sender');
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
public function getSenderForOrderCanceled()
|
| 66 |
+
{
|
| 67 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'order_canceled/sender');
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
public function getSenderForShipment()
|
| 71 |
+
{
|
| 72 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'shipments/sender');
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
public function getMessage(Mage_Sales_Model_Order $order)
|
| 76 |
+
{
|
| 77 |
+
$billingAddress = $order->getBillingAddress();
|
| 78 |
+
$codes = array('{{firstname}}','{{middlename}}','{{lastname}}','{{fax}}','{{postal}}','{{city}}','{{email}}','{{order_id}}');
|
| 79 |
+
$accurate = array($billingAddress->getFirstname(),
|
| 80 |
+
$billingAddress->getMiddlename(),
|
| 81 |
+
$billingAddress->getLastname(),
|
| 82 |
+
$billingAddress->getFax(),
|
| 83 |
+
$billingAddress->getPostcode(),
|
| 84 |
+
$billingAddress->getCity(),
|
| 85 |
+
$billingAddress->getEmail(),
|
| 86 |
+
$order->getIncrementId()
|
| 87 |
+
);
|
| 88 |
+
|
| 89 |
+
return str_replace($codes,$accurate,Mage::getStoreConfig(self::CONFIG_PATH.'orders/message'));
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
public function getMessageForOrderHold(Mage_Sales_Model_Order $order)
|
| 93 |
+
{
|
| 94 |
+
$billingAddress = $order->getBillingAddress();
|
| 95 |
+
$codes = array('{{firstname}}','{{middlename}}','{{lastname}}','{{fax}}','{{postal}}','{{city}}','{{email}}','{{order_id}}');
|
| 96 |
+
$accurate = array($billingAddress->getFirstname(),
|
| 97 |
+
$billingAddress->getMiddlename(),
|
| 98 |
+
$billingAddress->getLastname(),
|
| 99 |
+
$billingAddress->getFax(),
|
| 100 |
+
$billingAddress->getPostcode(),
|
| 101 |
+
$billingAddress->getCity(),
|
| 102 |
+
$billingAddress->getEmail(),
|
| 103 |
+
$order->getIncrementId()
|
| 104 |
+
);
|
| 105 |
+
|
| 106 |
+
return str_replace($codes,$accurate,Mage::getStoreConfig(self::CONFIG_PATH.'order_hold/message'));
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
public function getMessageForOrderUnhold(Mage_Sales_Model_Order $order)
|
| 110 |
+
{
|
| 111 |
+
$billingAddress = $order->getBillingAddress();
|
| 112 |
+
$codes = array('{{firstname}}','{{middlename}}','{{lastname}}','{{fax}}','{{postal}}','{{city}}','{{email}}','{{order_id}}');
|
| 113 |
+
$accurate = array($billingAddress->getFirstname(),
|
| 114 |
+
$billingAddress->getMiddlename(),
|
| 115 |
+
$billingAddress->getLastname(),
|
| 116 |
+
$billingAddress->getFax(),
|
| 117 |
+
$billingAddress->getPostcode(),
|
| 118 |
+
$billingAddress->getCity(),
|
| 119 |
+
$billingAddress->getEmail(),
|
| 120 |
+
$order->getIncrementId()
|
| 121 |
+
);
|
| 122 |
+
|
| 123 |
+
return str_replace($codes,$accurate,Mage::getStoreConfig(self::CONFIG_PATH.'order_unhold/message'));
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
public function getMessageForOrderCanceled(Mage_Sales_Model_Order $order)
|
| 127 |
+
{
|
| 128 |
+
$billingAddress = $order->getBillingAddress();
|
| 129 |
+
$codes = array('{{firstname}}','{{middlename}}','{{lastname}}','{{fax}}','{{postal}}','{{city}}','{{email}}','{{order_id}}');
|
| 130 |
+
$accurate = array($billingAddress->getFirstname(),
|
| 131 |
+
$billingAddress->getMiddlename(),
|
| 132 |
+
$billingAddress->getLastname(),
|
| 133 |
+
$billingAddress->getFax(),
|
| 134 |
+
$billingAddress->getPostcode(),
|
| 135 |
+
$billingAddress->getCity(),
|
| 136 |
+
$billingAddress->getEmail(),
|
| 137 |
+
$order->getIncrementId()
|
| 138 |
+
);
|
| 139 |
+
|
| 140 |
+
return str_replace($codes,$accurate,Mage::getStoreConfig(self::CONFIG_PATH.'order_canceled/message'));
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
public function getMessageForShipment(Mage_Sales_Model_Order $order)
|
| 144 |
+
{
|
| 145 |
+
$billingAddress = $order->getBillingAddress();
|
| 146 |
+
$shipmentCollection = $order->getShipmentsCollection();
|
| 147 |
+
foreach ($shipmentCollection as $shipment){
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
foreach($shipment->getAllTracks() as $tracknum)
|
| 151 |
+
{
|
| 152 |
+
$tracknums[]=$tracknum->getNumber();
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
+
$codes = array('{{firstname}}','{{middlename}}','{{lastname}}','{{fax}}','{{postal}}','{{city}}','{{email}}','{{order_id}}','{{shipping_id}}');
|
| 156 |
+
$accurate = array($billingAddress->getFirstname(),
|
| 157 |
+
$billingAddress->getMiddlename(),
|
| 158 |
+
$billingAddress->getLastname(),
|
| 159 |
+
$billingAddress->getFax(),
|
| 160 |
+
$billingAddress->getPostcode(),
|
| 161 |
+
$billingAddress->getCity(),
|
| 162 |
+
$billingAddress->getEmail(),
|
| 163 |
+
$order->getIncrementId(),
|
| 164 |
+
$tracknums[0]
|
| 165 |
+
);
|
| 166 |
+
return str_replace($codes,$accurate,Mage::getStoreConfig(self::CONFIG_PATH.'shipments/message'));
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
public function getTelephoneFromOrder(Mage_Sales_Model_Order $order)
|
| 170 |
+
{
|
| 171 |
+
$billingAddress = $order->getBillingAddress();
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
$number = $billingAddress->getTelephone();
|
| 175 |
+
return $number;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
//admin Notifier functions on order
|
| 179 |
+
public function isOrdersNotify()
|
| 180 |
+
{
|
| 181 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'orders/notify');
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
public function getAdminTelephone()
|
| 185 |
+
{
|
| 186 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'orders/receiver');
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
//admin Notifier functions on order hold
|
| 190 |
+
public function isOrdersHoldNotify()
|
| 191 |
+
{
|
| 192 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'order_hold/notify');
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
public function getAdminHoldTelephone()
|
| 196 |
+
{
|
| 197 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'order_hold/receiver');
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
//admin Notifier functions on order Unhold
|
| 201 |
+
public function isOrdersUnholdNotify()
|
| 202 |
+
{
|
| 203 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'order_unhold/notify');
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
public function getAdminUnholdTelephone()
|
| 207 |
+
{
|
| 208 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'order_unhold/receiver');
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
//admin Notifier functions on order cancelled
|
| 212 |
+
public function isOrdersCancelledNotify()
|
| 213 |
+
{
|
| 214 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'order_canceled/notify');
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
public function getAdminCancelledTelephone()
|
| 218 |
+
{
|
| 219 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'order_canceled/receiver');
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
//admin Notifier functions on order shipment
|
| 223 |
+
public function isOrdersShipmentsNotify()
|
| 224 |
+
{
|
| 225 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'shipments/notify');
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
public function getAdminShipmentsTelephone()
|
| 229 |
+
{
|
| 230 |
+
return Mage::getStoreConfig(self::CONFIG_PATH.'shipments/receiver');
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
public function voodoo($url) {
|
| 235 |
+
try {
|
| 236 |
+
$sendSms = $this->file_get_contents_curl($url);
|
| 237 |
+
}
|
| 238 |
+
catch(Exception $e) {
|
| 239 |
+
$sendSms = '';
|
| 240 |
+
}
|
| 241 |
+
if($sendSms) {
|
| 242 |
+
switch($sendSms) {
|
| 243 |
+
case '401: Unauthorized':
|
| 244 |
+
$status_message = Mage::helper('voodoo')->__('Voodoo Username or password incorrect (UNAUTHORIZED).');
|
| 245 |
+
$status = Mage::helper('voodoo')->__('Not sent');
|
| 246 |
+
break;
|
| 247 |
+
case '403: Forbidden':
|
| 248 |
+
$status_message = Mage::helper('voodoo')->__('Wrong Number Inserted (FORBIDDEN).');
|
| 249 |
+
$status = Mage::helper('voodoo')->__('Not sent');
|
| 250 |
+
break;
|
| 251 |
+
case '400: Bad request':
|
| 252 |
+
$status_message = Mage::helper('voodoo')->__('There might be something wrong happened (BAD REQUEST).');
|
| 253 |
+
$status = Mage::helper('voodoo')->__('Not sent');
|
| 254 |
+
break;
|
| 255 |
+
case '402: Not enough credit':
|
| 256 |
+
$status_message = Mage::helper('voodoo')->__('Insufficient Credit to send (NOT ENOUGH CREDIT).');
|
| 257 |
+
$status = Mage::helper('voodoo')->__('Not sent');
|
| 258 |
+
break;
|
| 259 |
+
case '513: Message too Large':
|
| 260 |
+
$status_message = Mage::helper('voodoo')->__('Too long message to send (LARGE MESSAGE).');
|
| 261 |
+
$status = Mage::helper('voodoo')->__('Not sent');
|
| 262 |
+
break;
|
| 263 |
+
default:
|
| 264 |
+
$status_message = Mage::helper('voodoo')->__('Sms successfully sent.');
|
| 265 |
+
$status = Mage::helper('voodoo')->__('Sent');
|
| 266 |
+
break;
|
| 267 |
+
}
|
| 268 |
+
}
|
| 269 |
+
else {
|
| 270 |
+
$status_message = Mage::helper('voodoo')->__('Not able to send the sms. Please contact the developer.');
|
| 271 |
+
$status = 'Not sent';
|
| 272 |
+
}
|
| 273 |
+
$ret['status_message'] = $status_message;
|
| 274 |
+
$ret['status'] = $status;
|
| 275 |
+
return $ret;
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
public function file_get_contents_curl($url) {
|
| 279 |
+
$ch = curl_init();
|
| 280 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
| 281 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
| 282 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
| 283 |
+
$data = curl_exec($ch);
|
| 284 |
+
curl_close($ch);
|
| 285 |
+
return $data;
|
| 286 |
+
}
|
| 287 |
+
public function credits($url){
|
| 288 |
+
$credits = $this->file_get_contents_curl($url);
|
| 289 |
+
return $credits;
|
| 290 |
+
}
|
| 291 |
+
public function verify_api($url)
|
| 292 |
+
{
|
| 293 |
+
$verified = $this->file_get_contents_curl($url);
|
| 294 |
+
return $verified;
|
| 295 |
+
}
|
| 296 |
+
public function verify_others($url)
|
| 297 |
+
{
|
| 298 |
+
$verify_others = $this->file_get_contents_curl($url);
|
| 299 |
+
return $verify_others;
|
| 300 |
+
}
|
| 301 |
+
public function exportOrder($order,$sendSms)
|
| 302 |
+
{
|
| 303 |
+
$dirPath = Mage::getBaseDir('var') . DS . 'export';
|
| 304 |
+
|
| 305 |
+
//if the export directory does not exist, create it
|
| 306 |
+
if (!is_dir($dirPath)) {
|
| 307 |
+
mkdir($dirPath, 0777, true);
|
| 308 |
+
}
|
| 309 |
+
file_put_contents(
|
| 310 |
+
$dirPath. DS .$order->getIncrementId().'.txt',
|
| 311 |
+
$sendSms
|
| 312 |
+
);
|
| 313 |
+
|
| 314 |
+
return true;
|
| 315 |
+
}
|
| 316 |
+
public function gettingSmsNumber(Mage_Sales_Model_Order $order){
|
| 317 |
+
$resource = Mage::getSingleton('core/resource');
|
| 318 |
+
$readConnection = $resource->getConnection('core_read');
|
| 319 |
+
$query = "SELECT sms_number FROM voodoo_number where order_id =".$order->getIncrementId()." LIMIT 1";
|
| 320 |
+
$results = $readConnection->fetchRow($query);
|
| 321 |
+
return $results['sms_number'];
|
| 322 |
+
|
| 323 |
+
}
|
| 324 |
+
}
|
app/code/community/TGM/Voodoo/Helper/Data.php
CHANGED
|
@@ -239,27 +239,15 @@ class TGM_Voodoo_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 239 |
$sendSms = '';
|
| 240 |
}
|
| 241 |
if($sendSms) {
|
| 242 |
-
switch($sendSms) {
|
| 243 |
-
case '401
|
| 244 |
$status_message = Mage::helper('voodoo')->__('Voodoo Username or password incorrect (UNAUTHORIZED).');
|
| 245 |
$status = Mage::helper('voodoo')->__('Not sent');
|
| 246 |
break;
|
| 247 |
-
case '
|
| 248 |
$status_message = Mage::helper('voodoo')->__('Wrong Number Inserted (FORBIDDEN).');
|
| 249 |
$status = Mage::helper('voodoo')->__('Not sent');
|
| 250 |
break;
|
| 251 |
-
case '400: Bad request':
|
| 252 |
-
$status_message = Mage::helper('voodoo')->__('There might be something wrong happened (BAD REQUEST).');
|
| 253 |
-
$status = Mage::helper('voodoo')->__('Not sent');
|
| 254 |
-
break;
|
| 255 |
-
case '402: Not enough credit':
|
| 256 |
-
$status_message = Mage::helper('voodoo')->__('Insufficient Credit to send (NOT ENOUGH CREDIT).');
|
| 257 |
-
$status = Mage::helper('voodoo')->__('Not sent');
|
| 258 |
-
break;
|
| 259 |
-
case '513: Message too Large':
|
| 260 |
-
$status_message = Mage::helper('voodoo')->__('Too long message to send (LARGE MESSAGE).');
|
| 261 |
-
$status = Mage::helper('voodoo')->__('Not sent');
|
| 262 |
-
break;
|
| 263 |
default:
|
| 264 |
$status_message = Mage::helper('voodoo')->__('Sms successfully sent.');
|
| 265 |
$status = Mage::helper('voodoo')->__('Sent');
|
|
@@ -282,11 +270,16 @@ class TGM_Voodoo_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 282 |
curl_setopt($ch, CURLOPT_URL, $url);
|
| 283 |
$data = curl_exec($ch);
|
| 284 |
curl_close($ch);
|
|
|
|
| 285 |
return $data;
|
| 286 |
}
|
| 287 |
public function credits($url){
|
| 288 |
$credits = $this->file_get_contents_curl($url);
|
| 289 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
}
|
| 291 |
public function verify_api($url)
|
| 292 |
{
|
|
@@ -298,6 +291,13 @@ class TGM_Voodoo_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 298 |
$verify_others = $this->file_get_contents_curl($url);
|
| 299 |
return $verify_others;
|
| 300 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 301 |
public function exportOrder($order,$sendSms)
|
| 302 |
{
|
| 303 |
$dirPath = Mage::getBaseDir('var') . DS . 'export';
|
| 239 |
$sendSms = '';
|
| 240 |
}
|
| 241 |
if($sendSms) {
|
| 242 |
+
switch($sendSms->result) {
|
| 243 |
+
case '401':
|
| 244 |
$status_message = Mage::helper('voodoo')->__('Voodoo Username or password incorrect (UNAUTHORIZED).');
|
| 245 |
$status = Mage::helper('voodoo')->__('Not sent');
|
| 246 |
break;
|
| 247 |
+
case '400':
|
| 248 |
$status_message = Mage::helper('voodoo')->__('Wrong Number Inserted (FORBIDDEN).');
|
| 249 |
$status = Mage::helper('voodoo')->__('Not sent');
|
| 250 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
default:
|
| 252 |
$status_message = Mage::helper('voodoo')->__('Sms successfully sent.');
|
| 253 |
$status = Mage::helper('voodoo')->__('Sent');
|
| 270 |
curl_setopt($ch, CURLOPT_URL, $url);
|
| 271 |
$data = curl_exec($ch);
|
| 272 |
curl_close($ch);
|
| 273 |
+
$data = json_decode($data);
|
| 274 |
return $data;
|
| 275 |
}
|
| 276 |
public function credits($url){
|
| 277 |
$credits = $this->file_get_contents_curl($url);
|
| 278 |
+
if($credits->credit){
|
| 279 |
+
return $credits->credit;
|
| 280 |
+
}else{
|
| 281 |
+
return false;
|
| 282 |
+
}
|
| 283 |
}
|
| 284 |
public function verify_api($url)
|
| 285 |
{
|
| 291 |
$verify_others = $this->file_get_contents_curl($url);
|
| 292 |
return $verify_others;
|
| 293 |
}
|
| 294 |
+
|
| 295 |
+
public function verify_number($url)
|
| 296 |
+
{
|
| 297 |
+
$verify_number = $this->file_get_contents_curl($url);
|
| 298 |
+
return $verify_number;
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
public function exportOrder($order,$sendSms)
|
| 302 |
{
|
| 303 |
$dirPath = Mage::getBaseDir('var') . DS . 'export';
|
app/code/community/TGM/Voodoo/Model/Observer-bkp-6-10-2015.php
ADDED
|
@@ -0,0 +1,427 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class TGM_Voodoo_Model_Observer
|
| 3 |
+
{
|
| 4 |
+
const ORDER_ATTRIBUTE_FHC_ID = 'voodoo';
|
| 5 |
+
|
| 6 |
+
public function sendSmsOnOrderCreated(Varien_Event_Observer $observer)
|
| 7 |
+
{
|
| 8 |
+
if ($this->getHelper()->isOrdersEnabled()) {
|
| 9 |
+
$orders = $observer->getEvent()->getOrderIds();
|
| 10 |
+
$order = Mage::getModel('sales/order')->load($orders['0']);
|
| 11 |
+
if ($order instanceof Mage_Sales_Model_Order) {
|
| 12 |
+
if ($this->getHelper()->isOptinsEnabled()) {
|
| 13 |
+
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 14 |
+
} else {
|
| 15 |
+
if ($this->getHelper()->isbillingorshipping()==0) {
|
| 16 |
+
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 17 |
+
}else{
|
| 18 |
+
$smsto = $order->getShippingAddress()->getTelephone();
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
if ($smsto) {
|
| 22 |
+
$host = "http://www.voodoosms.com/";
|
| 23 |
+
$path = "vsapi/server.php";
|
| 24 |
+
$username = $this->getHelper()->getUsername();
|
| 25 |
+
$password = $this->getHelper()->getPassword();
|
| 26 |
+
$smsfrom = $this->getHelper()->getSender();
|
| 27 |
+
$smsmsg = $this->getHelper()->getMessage($order);
|
| 28 |
+
$data = '?method=sendSMS';
|
| 29 |
+
$data .= '&username=' . urlencode($username);
|
| 30 |
+
$data .= '&password=' . urlencode($password);
|
| 31 |
+
$data .= '&destination=' . urlencode($smsto);
|
| 32 |
+
$data .= '&originator=' . urlencode($smsfrom);
|
| 33 |
+
$data .= '&message=' . urlencode($smsmsg);
|
| 34 |
+
$data .= '&validity=300';
|
| 35 |
+
$url = $host . $path . $data;
|
| 36 |
+
//$sendSms = $this->getHelper()->exportOrder($order,$url);
|
| 37 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 38 |
+
try {
|
| 39 |
+
Mage::getModel('voodoo/voodoo')
|
| 40 |
+
->setOrderId($order->getIncrementId())
|
| 41 |
+
->setFrom($smsfrom)
|
| 42 |
+
->setTo($smsto)
|
| 43 |
+
->setSmsMessage($smsmsg)
|
| 44 |
+
->setStatus($sendSms['status'])
|
| 45 |
+
->setStatusMessage($sendSms['status_message'])
|
| 46 |
+
->setCreatedTime(now())
|
| 47 |
+
->save();
|
| 48 |
+
} catch (Exception $e) {
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
if ($this->getHelper()->isOrdersNotify() and $this->getHelper()->getAdminTelephone()) {
|
| 52 |
+
$smsto = $this->getHelper()->getAdminTelephone();
|
| 53 |
+
$smsmsg = Mage::helper('voodoo')->__('A new order has been placed: %s', $order->getIncrementId());
|
| 54 |
+
$data = '?method=sendSMS';
|
| 55 |
+
$data .= '&username=' . urlencode($username);
|
| 56 |
+
$data .= '&password=' . urlencode($password);
|
| 57 |
+
$data .= '&destination=' . urlencode($smsto);
|
| 58 |
+
$data .= '&originator=' . urlencode($smsfrom);
|
| 59 |
+
$data .= '&message=' . urlencode($smsmsg);
|
| 60 |
+
$data .= '&validity=300';
|
| 61 |
+
$url = $host . $path . $data;
|
| 62 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 63 |
+
try {
|
| 64 |
+
Mage::getModel('voodoo/voodoo')
|
| 65 |
+
->setOrderId($order->getIncrementId())
|
| 66 |
+
->setFrom($smsfrom)
|
| 67 |
+
->setTo($smsto)
|
| 68 |
+
->setSmsMessage($smsmsg)
|
| 69 |
+
->setStatus($sendSms['status'])
|
| 70 |
+
->setStatusMessage($sendSms['status_message'])
|
| 71 |
+
->setCreatedTime(now())
|
| 72 |
+
->save();
|
| 73 |
+
} catch (Exception $e) {
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
public function sendSmsOnOrderHold(Varien_Event_Observer $observer)
|
| 82 |
+
{
|
| 83 |
+
if ($this->getHelper()->isOrderHoldEnabled()) {
|
| 84 |
+
$order = $observer->getOrder();
|
| 85 |
+
if ($order instanceof Mage_Sales_Model_Order) {
|
| 86 |
+
if ($order->getState() !== $order->getOrigData('state') && $order->getState() === Mage_Sales_Model_Order::STATE_HOLDED) {
|
| 87 |
+
if ($this->getHelper()->isOptinsEnabled()) {
|
| 88 |
+
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 89 |
+
} else {
|
| 90 |
+
if ($this->getHelper()->isbillingorshipping()==0) {
|
| 91 |
+
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 92 |
+
}else{
|
| 93 |
+
$smsto = $order->getShippingAddress()->getTelephone();
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
if ($smsto) {
|
| 97 |
+
$host = "http://www.voodoosms.com/";
|
| 98 |
+
$path = "vsapi/server.php";
|
| 99 |
+
$username = $this->getHelper()->getUsername();
|
| 100 |
+
$password = $this->getHelper()->getPassword();
|
| 101 |
+
$smsfrom = $this->getHelper()->getSenderForOrderHold();
|
| 102 |
+
$smsmsg = $this->getHelper()->getMessageForOrderHold($order);
|
| 103 |
+
$data = '?method=sendSMS';
|
| 104 |
+
$data .= '&username=' . urlencode($username);
|
| 105 |
+
$data .= '&password=' . urlencode($password);
|
| 106 |
+
$data .= '&destination=' . urlencode($smsto);
|
| 107 |
+
$data .= '&originator=' . urlencode($smsfrom);
|
| 108 |
+
$data .= '&message=' . urlencode($smsmsg);
|
| 109 |
+
$data .= '&validity=300';
|
| 110 |
+
$url = $host . $path . $data;
|
| 111 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 112 |
+
try {
|
| 113 |
+
Mage::getModel('voodoo/voodoo')
|
| 114 |
+
->setOrderId($order->getIncrementId())
|
| 115 |
+
->setFrom($smsfrom)
|
| 116 |
+
->setTo($smsto)
|
| 117 |
+
->setSmsMessage($smsmsg)
|
| 118 |
+
->setStatus($sendSms['status'])
|
| 119 |
+
->setStatusMessage($sendSms['status_message'])
|
| 120 |
+
->setCreatedTime(now())
|
| 121 |
+
->save();
|
| 122 |
+
} catch (Exception $e) {
|
| 123 |
+
}
|
| 124 |
+
if ($this->getHelper()->isOrdersHoldNotify() and $this->getHelper()->getAdminHoldTelephone()) {
|
| 125 |
+
$smsto = $this->getHelper()->getAdminHoldTelephone();
|
| 126 |
+
$smsmsg = Mage::helper('voodoo')->__('%s has been placed on hold', $order->getIncrementId());
|
| 127 |
+
$data = '?method=sendSMS';
|
| 128 |
+
$data .= '&username=' . urlencode($username);
|
| 129 |
+
$data .= '&password=' . urlencode($password);
|
| 130 |
+
$data .= '&destination=' . urlencode($smsto);
|
| 131 |
+
$data .= '&originator=' . urlencode($smsfrom);
|
| 132 |
+
$data .= '&message=' . urlencode($smsmsg);
|
| 133 |
+
$data .= '&validity=300';
|
| 134 |
+
$url = $host . $path . $data;
|
| 135 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 136 |
+
try {
|
| 137 |
+
Mage::getModel('voodoo/voodoo')
|
| 138 |
+
->setOrderId($order->getIncrementId())
|
| 139 |
+
->setFrom($smsfrom)
|
| 140 |
+
->setTo($smsto)
|
| 141 |
+
->setSmsMessage($smsmsg)
|
| 142 |
+
->setStatus($sendSms['status'])
|
| 143 |
+
->setStatusMessage($sendSms['status_message'])
|
| 144 |
+
->setCreatedTime(now())
|
| 145 |
+
->save();
|
| 146 |
+
} catch (Exception $e) {
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
public function getHelper()
|
| 156 |
+
{
|
| 157 |
+
return Mage::helper('voodoo/Data');
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
public function sendSmsOnOrderUnhold(Varien_Event_Observer $observer)
|
| 161 |
+
{
|
| 162 |
+
if ($this->getHelper()->isOrderUnholdEnabled()) {
|
| 163 |
+
$order = $observer->getOrder();
|
| 164 |
+
if ($order instanceof Mage_Sales_Model_Order) {
|
| 165 |
+
if ($order->getState() !== $order->getOrigData('state') && $order->getOrigData('state') === Mage_Sales_Model_Order::STATE_HOLDED) {
|
| 166 |
+
if ($this->getHelper()->isOptinsEnabled()) {
|
| 167 |
+
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 168 |
+
} else {
|
| 169 |
+
if ($this->getHelper()->isbillingorshipping()==0) {
|
| 170 |
+
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 171 |
+
}else{
|
| 172 |
+
$smsto = $order->getShippingAddress()->getTelephone();
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
if ($smsto) {
|
| 176 |
+
$host = "http://www.voodoosms.com/";
|
| 177 |
+
$path = "vsapi/server.php";
|
| 178 |
+
$username = $this->getHelper()->getUsername();
|
| 179 |
+
$password = $this->getHelper()->getPassword();
|
| 180 |
+
$smsfrom = $this->getHelper()->getSenderForOrderUnhold();
|
| 181 |
+
$smsmsg = $this->getHelper()->getMessageForOrderUnhold($order);
|
| 182 |
+
$data = '?method=sendSMS';
|
| 183 |
+
$data .= '&username=' . urlencode($username);
|
| 184 |
+
$data .= '&password=' . urlencode($password);
|
| 185 |
+
$data .= '&destination=' . urlencode($smsto);
|
| 186 |
+
$data .= '&originator=' . urlencode($smsfrom);
|
| 187 |
+
$data .= '&message=' . urlencode($smsmsg);
|
| 188 |
+
$data .= '&validity=300';
|
| 189 |
+
$url = $host . $path . $data;
|
| 190 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 191 |
+
try {
|
| 192 |
+
Mage::getModel('voodoo/voodoo')
|
| 193 |
+
->setOrderId($order->getIncrementId())
|
| 194 |
+
->setFrom($smsfrom)
|
| 195 |
+
->setTo($smsto)
|
| 196 |
+
->setSmsMessage($smsmsg)
|
| 197 |
+
->setStatus($sendSms['status'])
|
| 198 |
+
->setStatusMessage($sendSms['status_message'])
|
| 199 |
+
->setCreatedTime(now())
|
| 200 |
+
->save();
|
| 201 |
+
} catch (Exception $e) {
|
| 202 |
+
}
|
| 203 |
+
if ($this->getHelper()->isOrdersUnholdNotify() and $this->getHelper()->getAdminUnholdTelephone()) {
|
| 204 |
+
$smsto = $this->getHelper()->getAdminUnholdTelephone();
|
| 205 |
+
$smsmsg = Mage::helper('voodoo')->__('%s has been placed on unhold', $order->getIncrementId());
|
| 206 |
+
$data = '?method=sendSMS';
|
| 207 |
+
$data .= '&username=' . urlencode($username);
|
| 208 |
+
$data .= '&password=' . urlencode($password);
|
| 209 |
+
$data .= '&destination=' . urlencode($smsto);
|
| 210 |
+
$data .= '&originator=' . urlencode($smsfrom);
|
| 211 |
+
$data .= '&message=' . urlencode($smsmsg);
|
| 212 |
+
$data .= '&validity=300';
|
| 213 |
+
$url = $host . $path . $data;
|
| 214 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 215 |
+
try {
|
| 216 |
+
Mage::getModel('voodoo/voodoo')
|
| 217 |
+
->setOrderId($order->getIncrementId())
|
| 218 |
+
->setFrom($smsfrom)
|
| 219 |
+
->setTo($smsto)
|
| 220 |
+
->setSmsMessage($smsmsg)
|
| 221 |
+
->setStatus($sendSms['status'])
|
| 222 |
+
->setStatusMessage($sendSms['status_message'])
|
| 223 |
+
->setCreatedTime(now())
|
| 224 |
+
->save();
|
| 225 |
+
} catch (Exception $e) {
|
| 226 |
+
}
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
}
|
| 231 |
+
}
|
| 232 |
+
}
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
public function sendSmsOnOrderCanceled(Varien_Event_Observer $observer)
|
| 236 |
+
{
|
| 237 |
+
if ($this->getHelper()->isOrderCanceledEnabled()) {
|
| 238 |
+
$order = $observer->getOrder();
|
| 239 |
+
if ($order instanceof Mage_Sales_Model_Order) {
|
| 240 |
+
if ($order->getState() !== $order->getOrigData('state') && $order->getState() === Mage_Sales_Model_Order::STATE_CANCELED) {
|
| 241 |
+
if ($this->getHelper()->isOptinsEnabled()) {
|
| 242 |
+
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 243 |
+
} else {
|
| 244 |
+
if ($this->getHelper()->isbillingorshipping()==0) {
|
| 245 |
+
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 246 |
+
}else{
|
| 247 |
+
$smsto = $order->getShippingAddress()->getTelephone();
|
| 248 |
+
}
|
| 249 |
+
}
|
| 250 |
+
if ($smsto) {
|
| 251 |
+
$host = "http://www.voodoosms.com/";
|
| 252 |
+
$path = "vsapi/server.php";
|
| 253 |
+
$username = $this->getHelper()->getUsername();
|
| 254 |
+
$password = $this->getHelper()->getPassword();
|
| 255 |
+
$smsfrom = $this->getHelper()->getSenderForOrderCanceled();
|
| 256 |
+
$smsmsg = $this->getHelper()->getMessageForOrderCanceled($order);
|
| 257 |
+
$data = '?method=sendSMS';
|
| 258 |
+
$data .= '&username=' . urlencode($username);
|
| 259 |
+
$data .= '&password=' . urlencode($password);
|
| 260 |
+
$data .= '&destination=' . urlencode($smsto);
|
| 261 |
+
$data .= '&originator=' . urlencode($smsfrom);
|
| 262 |
+
$data .= '&message=' . urlencode($smsmsg);
|
| 263 |
+
$data .= '&validity=300';
|
| 264 |
+
$url = $host . $path . $data;
|
| 265 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 266 |
+
try {
|
| 267 |
+
Mage::getModel('voodoo/voodoo')
|
| 268 |
+
->setOrderId($order->getIncrementId())
|
| 269 |
+
->setFrom($smsfrom)
|
| 270 |
+
->setTo($smsto)
|
| 271 |
+
->setSmsMessage($smsmsg)
|
| 272 |
+
->setStatus($sendSms['status'])
|
| 273 |
+
->setStatusMessage($sendSms['status_message'])
|
| 274 |
+
->setCreatedTime(now())
|
| 275 |
+
->save();
|
| 276 |
+
} catch (Exception $e) {
|
| 277 |
+
}
|
| 278 |
+
if ($this->getHelper()->isOrdersCancelledNotify() and $this->getHelper()->getAdminCancelledTelephone()) {
|
| 279 |
+
$smsto = $this->getHelper()->getAdminCancelledTelephone();
|
| 280 |
+
$smsmsg = Mage::helper('voodoo')->__('%s has been placed cancelled', $order->getIncrementId());
|
| 281 |
+
$data = '?method=sendSMS';
|
| 282 |
+
$data .= '&username=' . urlencode($username);
|
| 283 |
+
$data .= '&password=' . urlencode($password);
|
| 284 |
+
$data .= '&destination=' . urlencode($smsto);
|
| 285 |
+
$data .= '&originator=' . urlencode($smsfrom);
|
| 286 |
+
$data .= '&message=' . urlencode($smsmsg);
|
| 287 |
+
$data .= '&validity=300';
|
| 288 |
+
$url = $host . $path . $data;
|
| 289 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 290 |
+
try {
|
| 291 |
+
Mage::getModel('voodoo/voodoo')
|
| 292 |
+
->setOrderId($order->getIncrementId())
|
| 293 |
+
->setFrom($smsfrom)
|
| 294 |
+
->setTo($smsto)
|
| 295 |
+
->setSmsMessage($smsmsg)
|
| 296 |
+
->setStatus($sendSms['status'])
|
| 297 |
+
->setStatusMessage($sendSms['status_message'])
|
| 298 |
+
->setCreatedTime(now())
|
| 299 |
+
->save();
|
| 300 |
+
} catch (Exception $e) {
|
| 301 |
+
}
|
| 302 |
+
}
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
}
|
| 306 |
+
}
|
| 307 |
+
}
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
public function sendSmsOnShipmentCreated(Varien_Event_Observer $observer)
|
| 311 |
+
{
|
| 312 |
+
if ($this->getHelper()->isShipmentsEnabled()) {
|
| 313 |
+
$shipment = $observer->getEvent()->getShipment();
|
| 314 |
+
$order = $shipment->getOrder();
|
| 315 |
+
if ($order instanceof Mage_Sales_Model_Order) {
|
| 316 |
+
if ($this->getHelper()->isOptinsEnabled()) {
|
| 317 |
+
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 318 |
+
} else {
|
| 319 |
+
if ($this->getHelper()->isbillingorshipping()==0) {
|
| 320 |
+
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 321 |
+
}else{
|
| 322 |
+
$smsto = $order->getShippingAddress()->getTelephone();
|
| 323 |
+
}
|
| 324 |
+
}
|
| 325 |
+
if ($smsto) {
|
| 326 |
+
$host = "http://www.voodoosms.com/";
|
| 327 |
+
$path = "vsapi/server.php";
|
| 328 |
+
$username = $this->getHelper()->getUsername();
|
| 329 |
+
$password = $this->getHelper()->getPassword();
|
| 330 |
+
$smsfrom = $this->getHelper()->getSenderForShipment();
|
| 331 |
+
$smsmsg = $this->getHelper()->getMessageForShipment($order);
|
| 332 |
+
$data = '?method=sendSMS';
|
| 333 |
+
$data .= '&username=' . urlencode($username);
|
| 334 |
+
$data .= '&password=' . urlencode($password);
|
| 335 |
+
$data .= '&destination=' . urlencode($smsto);
|
| 336 |
+
$data .= '&originator=' . urlencode($smsfrom);
|
| 337 |
+
$data .= '&message=' . urlencode($smsmsg);
|
| 338 |
+
$data .= '&validity=300';
|
| 339 |
+
$url = $host . $path . $data;
|
| 340 |
+
echo $url;
|
| 341 |
+
exit;
|
| 342 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 343 |
+
try {
|
| 344 |
+
Mage::getModel('voodoo/voodoo')
|
| 345 |
+
->setOrderId($order->getIncrementId())
|
| 346 |
+
->setFrom($smsfrom)
|
| 347 |
+
->setTo($smsto)
|
| 348 |
+
->setSmsMessage($smsmsg)
|
| 349 |
+
->setStatus($sendSms['status'])
|
| 350 |
+
->setStatusMessage($sendSms['status_message'])
|
| 351 |
+
->setCreatedTime(now())
|
| 352 |
+
->save();
|
| 353 |
+
} catch (Exception $e) {
|
| 354 |
+
}
|
| 355 |
+
if ($this->getHelper()->isOrdersShipmentsNotify() and $this->getHelper()->getAdminShipmentsTelephone()) {
|
| 356 |
+
$smsto = $this->getHelper()->getAdminTelephone();
|
| 357 |
+
$smsmsg = Mage::helper('voodoo')->__('%s is on shipment state', $order->getIncrementId());
|
| 358 |
+
$data = '?method=sendSMS';
|
| 359 |
+
$data .= '&username=' . urlencode($username);
|
| 360 |
+
$data .= '&password=' . urlencode($password);
|
| 361 |
+
$data .= '&destination=' . urlencode($smsto);
|
| 362 |
+
$data .= '&originator=' . urlencode($smsfrom);
|
| 363 |
+
$data .= '&message=' . urlencode($smsmsg);
|
| 364 |
+
$data .= '&validity=300';
|
| 365 |
+
$url = $host . $path . $data;
|
| 366 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 367 |
+
try {
|
| 368 |
+
Mage::getModel('voodoo/voodoo')
|
| 369 |
+
->setOrderId($order->getIncrementId())
|
| 370 |
+
->setFrom($smsfrom)
|
| 371 |
+
->setTo($smsto)
|
| 372 |
+
->setSmsMessage($smsmsg)
|
| 373 |
+
->setStatus($sendSms['status'])
|
| 374 |
+
->setStatusMessage($sendSms['status_message'])
|
| 375 |
+
->setCreatedTime(now())
|
| 376 |
+
->save();
|
| 377 |
+
} catch (Exception $e) {
|
| 378 |
+
}
|
| 379 |
+
}
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
}
|
| 383 |
+
}
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
/**
|
| 387 |
+
* Event Hook: checkout_type_onepage_save_order
|
| 388 |
+
*
|
| 389 |
+
* @author Ammar
|
| 390 |
+
* @param $observer Varien_Event_Observer
|
| 391 |
+
*/
|
| 392 |
+
public function hookToOrderSaveEvent()
|
| 393 |
+
{
|
| 394 |
+
/**
|
| 395 |
+
* NOTE:
|
| 396 |
+
* Order has already been saved, now we simply add some stuff to it,
|
| 397 |
+
* that will be saved to database. We add the stuff to Order object property
|
| 398 |
+
* called "voodoo"
|
| 399 |
+
*/
|
| 400 |
+
$order = new Mage_Sales_Model_Order();
|
| 401 |
+
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
| 402 |
+
$order->loadByIncrementId($incrementId);
|
| 403 |
+
|
| 404 |
+
//Fetch the data from select box and throw it here
|
| 405 |
+
$_voodoo_data = null;
|
| 406 |
+
$_voodoo_data = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 407 |
+
if ($_voodoo_data!=null) {
|
| 408 |
+
$write = Mage::getSingleton("core/resource")->getConnection("core_write");
|
| 409 |
+
|
| 410 |
+
// Concatenated with . for readability
|
| 411 |
+
$query = "insert into voodoo_number "
|
| 412 |
+
. "(order_id, sms_number) values "
|
| 413 |
+
. "(:order_id, :sms_number)";
|
| 414 |
+
|
| 415 |
+
$binds = array(
|
| 416 |
+
'order_id' => $incrementId,
|
| 417 |
+
'sms_number' => $_voodoo_data,
|
| 418 |
+
);
|
| 419 |
+
$write->query($query, $binds);
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
//Save fhc id to order obcject
|
| 423 |
+
$order->setData(self::ORDER_ATTRIBUTE_FHC_ID, $_voodoo_data);
|
| 424 |
+
$order->save();
|
| 425 |
+
|
| 426 |
+
}
|
| 427 |
+
}
|
app/code/community/TGM/Voodoo/Model/Observer.php
CHANGED
|
@@ -12,53 +12,29 @@ class TGM_Voodoo_Model_Observer
|
|
| 12 |
if ($this->getHelper()->isOptinsEnabled()) {
|
| 13 |
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 14 |
} else {
|
| 15 |
-
if ($this->getHelper()->isbillingorshipping()==0) {
|
| 16 |
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 17 |
-
}else{
|
| 18 |
$smsto = $order->getShippingAddress()->getTelephone();
|
| 19 |
}
|
| 20 |
}
|
| 21 |
if ($smsto) {
|
| 22 |
$host = "http://www.voodoosms.com/";
|
| 23 |
-
$path = "
|
| 24 |
$username = $this->getHelper()->getUsername();
|
| 25 |
$password = $this->getHelper()->getPassword();
|
| 26 |
$smsfrom = $this->getHelper()->getSender();
|
| 27 |
$smsmsg = $this->getHelper()->getMessage($order);
|
| 28 |
-
$data = '?
|
| 29 |
-
$data .= '&
|
| 30 |
-
$data .= '&
|
| 31 |
-
$data .= '&
|
| 32 |
-
$data .= '&
|
| 33 |
-
$data .= '&
|
| 34 |
-
$data .= '&validity=300';
|
| 35 |
$url = $host . $path . $data;
|
| 36 |
-
|
| 37 |
-
$
|
| 38 |
-
|
| 39 |
-
Mage::getModel('voodoo/voodoo')
|
| 40 |
-
->setOrderId($order->getIncrementId())
|
| 41 |
-
->setFrom($smsfrom)
|
| 42 |
-
->setTo($smsto)
|
| 43 |
-
->setSmsMessage($smsmsg)
|
| 44 |
-
->setStatus($sendSms['status'])
|
| 45 |
-
->setStatusMessage($sendSms['status_message'])
|
| 46 |
-
->setCreatedTime(now())
|
| 47 |
-
->save();
|
| 48 |
-
} catch (Exception $e) {
|
| 49 |
-
}
|
| 50 |
-
|
| 51 |
-
if ($this->getHelper()->isOrdersNotify() and $this->getHelper()->getAdminTelephone()) {
|
| 52 |
-
$smsto = $this->getHelper()->getAdminTelephone();
|
| 53 |
-
$smsmsg = Mage::helper('voodoo')->__('A new order has been placed: %s', $order->getIncrementId());
|
| 54 |
-
$data = '?method=sendSMS';
|
| 55 |
-
$data .= '&username=' . urlencode($username);
|
| 56 |
-
$data .= '&password=' . urlencode($password);
|
| 57 |
-
$data .= '&destination=' . urlencode($smsto);
|
| 58 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
| 59 |
-
$data .= '&message=' . urlencode($smsmsg);
|
| 60 |
-
$data .= '&validity=300';
|
| 61 |
-
$url = $host . $path . $data;
|
| 62 |
$sendSms = $this->getHelper()->voodoo($url);
|
| 63 |
try {
|
| 64 |
Mage::getModel('voodoo/voodoo')
|
|
@@ -73,6 +49,36 @@ class TGM_Voodoo_Model_Observer
|
|
| 73 |
} catch (Exception $e) {
|
| 74 |
}
|
| 75 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
}
|
| 77 |
}
|
| 78 |
}
|
|
@@ -87,51 +93,29 @@ class TGM_Voodoo_Model_Observer
|
|
| 87 |
if ($this->getHelper()->isOptinsEnabled()) {
|
| 88 |
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 89 |
} else {
|
| 90 |
-
if ($this->getHelper()->isbillingorshipping()==0) {
|
| 91 |
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 92 |
-
}else{
|
| 93 |
$smsto = $order->getShippingAddress()->getTelephone();
|
| 94 |
}
|
| 95 |
}
|
| 96 |
if ($smsto) {
|
| 97 |
$host = "http://www.voodoosms.com/";
|
| 98 |
-
$path = "
|
| 99 |
$username = $this->getHelper()->getUsername();
|
| 100 |
$password = $this->getHelper()->getPassword();
|
| 101 |
$smsfrom = $this->getHelper()->getSenderForOrderHold();
|
| 102 |
$smsmsg = $this->getHelper()->getMessageForOrderHold($order);
|
| 103 |
-
$data = '?
|
| 104 |
-
$data .= '&
|
| 105 |
-
$data .= '&
|
| 106 |
-
$data .= '&
|
| 107 |
-
$data .= '&
|
| 108 |
-
$data .= '&
|
| 109 |
-
$data .= '&validity=300';
|
| 110 |
$url = $host . $path . $data;
|
| 111 |
-
$
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
->setOrderId($order->getIncrementId())
|
| 115 |
-
->setFrom($smsfrom)
|
| 116 |
-
->setTo($smsto)
|
| 117 |
-
->setSmsMessage($smsmsg)
|
| 118 |
-
->setStatus($sendSms['status'])
|
| 119 |
-
->setStatusMessage($sendSms['status_message'])
|
| 120 |
-
->setCreatedTime(now())
|
| 121 |
-
->save();
|
| 122 |
-
} catch (Exception $e) {
|
| 123 |
-
}
|
| 124 |
-
if ($this->getHelper()->isOrdersHoldNotify() and $this->getHelper()->getAdminHoldTelephone()) {
|
| 125 |
-
$smsto = $this->getHelper()->getAdminHoldTelephone();
|
| 126 |
-
$smsmsg = Mage::helper('voodoo')->__('%s has been placed on hold', $order->getIncrementId());
|
| 127 |
-
$data = '?method=sendSMS';
|
| 128 |
-
$data .= '&username=' . urlencode($username);
|
| 129 |
-
$data .= '&password=' . urlencode($password);
|
| 130 |
-
$data .= '&destination=' . urlencode($smsto);
|
| 131 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
| 132 |
-
$data .= '&message=' . urlencode($smsmsg);
|
| 133 |
-
$data .= '&validity=300';
|
| 134 |
-
$url = $host . $path . $data;
|
| 135 |
$sendSms = $this->getHelper()->voodoo($url);
|
| 136 |
try {
|
| 137 |
Mage::getModel('voodoo/voodoo')
|
|
@@ -146,17 +130,40 @@ class TGM_Voodoo_Model_Observer
|
|
| 146 |
} catch (Exception $e) {
|
| 147 |
}
|
| 148 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
}
|
| 150 |
}
|
| 151 |
}
|
| 152 |
}
|
| 153 |
}
|
| 154 |
|
| 155 |
-
public function getHelper()
|
| 156 |
-
{
|
| 157 |
-
return Mage::helper('voodoo/Data');
|
| 158 |
-
}
|
| 159 |
-
|
| 160 |
public function sendSmsOnOrderUnhold(Varien_Event_Observer $observer)
|
| 161 |
{
|
| 162 |
if ($this->getHelper()->isOrderUnholdEnabled()) {
|
|
@@ -166,51 +173,29 @@ class TGM_Voodoo_Model_Observer
|
|
| 166 |
if ($this->getHelper()->isOptinsEnabled()) {
|
| 167 |
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 168 |
} else {
|
| 169 |
-
if ($this->getHelper()->isbillingorshipping()==0) {
|
| 170 |
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 171 |
-
}else{
|
| 172 |
$smsto = $order->getShippingAddress()->getTelephone();
|
| 173 |
}
|
| 174 |
}
|
| 175 |
if ($smsto) {
|
| 176 |
$host = "http://www.voodoosms.com/";
|
| 177 |
-
$path = "
|
| 178 |
$username = $this->getHelper()->getUsername();
|
| 179 |
$password = $this->getHelper()->getPassword();
|
| 180 |
$smsfrom = $this->getHelper()->getSenderForOrderUnhold();
|
| 181 |
$smsmsg = $this->getHelper()->getMessageForOrderUnhold($order);
|
| 182 |
-
$data = '?
|
| 183 |
-
$data .= '&
|
| 184 |
-
$data .= '&
|
| 185 |
-
$data .= '&
|
| 186 |
-
$data .= '&
|
| 187 |
-
$data .= '&
|
| 188 |
-
$data .= '&validity=300';
|
| 189 |
$url = $host . $path . $data;
|
| 190 |
-
$
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
->setOrderId($order->getIncrementId())
|
| 194 |
-
->setFrom($smsfrom)
|
| 195 |
-
->setTo($smsto)
|
| 196 |
-
->setSmsMessage($smsmsg)
|
| 197 |
-
->setStatus($sendSms['status'])
|
| 198 |
-
->setStatusMessage($sendSms['status_message'])
|
| 199 |
-
->setCreatedTime(now())
|
| 200 |
-
->save();
|
| 201 |
-
} catch (Exception $e) {
|
| 202 |
-
}
|
| 203 |
-
if ($this->getHelper()->isOrdersUnholdNotify() and $this->getHelper()->getAdminUnholdTelephone()) {
|
| 204 |
-
$smsto = $this->getHelper()->getAdminUnholdTelephone();
|
| 205 |
-
$smsmsg = Mage::helper('voodoo')->__('%s has been placed on unhold', $order->getIncrementId());
|
| 206 |
-
$data = '?method=sendSMS';
|
| 207 |
-
$data .= '&username=' . urlencode($username);
|
| 208 |
-
$data .= '&password=' . urlencode($password);
|
| 209 |
-
$data .= '&destination=' . urlencode($smsto);
|
| 210 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
| 211 |
-
$data .= '&message=' . urlencode($smsmsg);
|
| 212 |
-
$data .= '&validity=300';
|
| 213 |
-
$url = $host . $path . $data;
|
| 214 |
$sendSms = $this->getHelper()->voodoo($url);
|
| 215 |
try {
|
| 216 |
Mage::getModel('voodoo/voodoo')
|
|
@@ -225,6 +210,34 @@ class TGM_Voodoo_Model_Observer
|
|
| 225 |
} catch (Exception $e) {
|
| 226 |
}
|
| 227 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
}
|
| 229 |
|
| 230 |
}
|
|
@@ -232,6 +245,11 @@ class TGM_Voodoo_Model_Observer
|
|
| 232 |
}
|
| 233 |
}
|
| 234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
public function sendSmsOnOrderCanceled(Varien_Event_Observer $observer)
|
| 236 |
{
|
| 237 |
if ($this->getHelper()->isOrderCanceledEnabled()) {
|
|
@@ -241,51 +259,29 @@ class TGM_Voodoo_Model_Observer
|
|
| 241 |
if ($this->getHelper()->isOptinsEnabled()) {
|
| 242 |
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 243 |
} else {
|
| 244 |
-
if ($this->getHelper()->isbillingorshipping()==0) {
|
| 245 |
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 246 |
-
}else{
|
| 247 |
$smsto = $order->getShippingAddress()->getTelephone();
|
| 248 |
}
|
| 249 |
}
|
| 250 |
if ($smsto) {
|
| 251 |
$host = "http://www.voodoosms.com/";
|
| 252 |
-
$path = "
|
| 253 |
$username = $this->getHelper()->getUsername();
|
| 254 |
$password = $this->getHelper()->getPassword();
|
| 255 |
$smsfrom = $this->getHelper()->getSenderForOrderCanceled();
|
| 256 |
$smsmsg = $this->getHelper()->getMessageForOrderCanceled($order);
|
| 257 |
-
$data = '?
|
| 258 |
-
$data .= '&
|
| 259 |
-
$data .= '&
|
| 260 |
-
$data .= '&
|
| 261 |
-
$data .= '&
|
| 262 |
-
$data .= '&
|
| 263 |
-
$data .= '&validity=300';
|
| 264 |
$url = $host . $path . $data;
|
| 265 |
-
$
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
->setOrderId($order->getIncrementId())
|
| 269 |
-
->setFrom($smsfrom)
|
| 270 |
-
->setTo($smsto)
|
| 271 |
-
->setSmsMessage($smsmsg)
|
| 272 |
-
->setStatus($sendSms['status'])
|
| 273 |
-
->setStatusMessage($sendSms['status_message'])
|
| 274 |
-
->setCreatedTime(now())
|
| 275 |
-
->save();
|
| 276 |
-
} catch (Exception $e) {
|
| 277 |
-
}
|
| 278 |
-
if ($this->getHelper()->isOrdersCancelledNotify() and $this->getHelper()->getAdminCancelledTelephone()) {
|
| 279 |
-
$smsto = $this->getHelper()->getAdminCancelledTelephone();
|
| 280 |
-
$smsmsg = Mage::helper('voodoo')->__('%s has been placed cancelled', $order->getIncrementId());
|
| 281 |
-
$data = '?method=sendSMS';
|
| 282 |
-
$data .= '&username=' . urlencode($username);
|
| 283 |
-
$data .= '&password=' . urlencode($password);
|
| 284 |
-
$data .= '&destination=' . urlencode($smsto);
|
| 285 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
| 286 |
-
$data .= '&message=' . urlencode($smsmsg);
|
| 287 |
-
$data .= '&validity=300';
|
| 288 |
-
$url = $host . $path . $data;
|
| 289 |
$sendSms = $this->getHelper()->voodoo($url);
|
| 290 |
try {
|
| 291 |
Mage::getModel('voodoo/voodoo')
|
|
@@ -300,6 +296,34 @@ class TGM_Voodoo_Model_Observer
|
|
| 300 |
} catch (Exception $e) {
|
| 301 |
}
|
| 302 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 303 |
}
|
| 304 |
|
| 305 |
}
|
|
@@ -316,53 +340,29 @@ class TGM_Voodoo_Model_Observer
|
|
| 316 |
if ($this->getHelper()->isOptinsEnabled()) {
|
| 317 |
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 318 |
} else {
|
| 319 |
-
if ($this->getHelper()->isbillingorshipping()==0) {
|
| 320 |
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 321 |
-
}else{
|
| 322 |
$smsto = $order->getShippingAddress()->getTelephone();
|
| 323 |
}
|
| 324 |
}
|
| 325 |
if ($smsto) {
|
| 326 |
$host = "http://www.voodoosms.com/";
|
| 327 |
-
$path = "
|
| 328 |
$username = $this->getHelper()->getUsername();
|
| 329 |
$password = $this->getHelper()->getPassword();
|
| 330 |
$smsfrom = $this->getHelper()->getSenderForShipment();
|
| 331 |
$smsmsg = $this->getHelper()->getMessageForShipment($order);
|
| 332 |
-
$data = '?
|
| 333 |
-
$data .= '&
|
| 334 |
-
$data .= '&
|
| 335 |
-
$data .= '&
|
| 336 |
-
$data .= '&
|
| 337 |
-
$data .= '&
|
| 338 |
-
$data .= '&validity=300';
|
| 339 |
$url = $host . $path . $data;
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
$
|
| 343 |
-
try {
|
| 344 |
-
Mage::getModel('voodoo/voodoo')
|
| 345 |
-
->setOrderId($order->getIncrementId())
|
| 346 |
-
->setFrom($smsfrom)
|
| 347 |
-
->setTo($smsto)
|
| 348 |
-
->setSmsMessage($smsmsg)
|
| 349 |
-
->setStatus($sendSms['status'])
|
| 350 |
-
->setStatusMessage($sendSms['status_message'])
|
| 351 |
-
->setCreatedTime(now())
|
| 352 |
-
->save();
|
| 353 |
-
} catch (Exception $e) {
|
| 354 |
-
}
|
| 355 |
-
if ($this->getHelper()->isOrdersShipmentsNotify() and $this->getHelper()->getAdminShipmentsTelephone()) {
|
| 356 |
-
$smsto = $this->getHelper()->getAdminTelephone();
|
| 357 |
-
$smsmsg = Mage::helper('voodoo')->__('%s is on shipment state', $order->getIncrementId());
|
| 358 |
-
$data = '?method=sendSMS';
|
| 359 |
-
$data .= '&username=' . urlencode($username);
|
| 360 |
-
$data .= '&password=' . urlencode($password);
|
| 361 |
-
$data .= '&destination=' . urlencode($smsto);
|
| 362 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
| 363 |
-
$data .= '&message=' . urlencode($smsmsg);
|
| 364 |
-
$data .= '&validity=300';
|
| 365 |
-
$url = $host . $path . $data;
|
| 366 |
$sendSms = $this->getHelper()->voodoo($url);
|
| 367 |
try {
|
| 368 |
Mage::getModel('voodoo/voodoo')
|
|
@@ -377,6 +377,34 @@ class TGM_Voodoo_Model_Observer
|
|
| 377 |
} catch (Exception $e) {
|
| 378 |
}
|
| 379 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 380 |
}
|
| 381 |
|
| 382 |
}
|
|
@@ -404,7 +432,7 @@ class TGM_Voodoo_Model_Observer
|
|
| 404 |
//Fetch the data from select box and throw it here
|
| 405 |
$_voodoo_data = null;
|
| 406 |
$_voodoo_data = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 407 |
-
if ($_voodoo_data!=null) {
|
| 408 |
$write = Mage::getSingleton("core/resource")->getConnection("core_write");
|
| 409 |
|
| 410 |
// Concatenated with . for readability
|
| 12 |
if ($this->getHelper()->isOptinsEnabled()) {
|
| 13 |
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 14 |
} else {
|
| 15 |
+
if ($this->getHelper()->isbillingorshipping() == 0) {
|
| 16 |
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 17 |
+
} else {
|
| 18 |
$smsto = $order->getShippingAddress()->getTelephone();
|
| 19 |
}
|
| 20 |
}
|
| 21 |
if ($smsto) {
|
| 22 |
$host = "http://www.voodoosms.com/";
|
| 23 |
+
$path = "vapi/server/sendSMS";
|
| 24 |
$username = $this->getHelper()->getUsername();
|
| 25 |
$password = $this->getHelper()->getPassword();
|
| 26 |
$smsfrom = $this->getHelper()->getSender();
|
| 27 |
$smsmsg = $this->getHelper()->getMessage($order);
|
| 28 |
+
$data = '?uid=' . urlencode($username);
|
| 29 |
+
$data .= '&pass=' . urlencode($password);
|
| 30 |
+
$data .= '&dest=' . urlencode($smsto);
|
| 31 |
+
$data .= '&orig=' . urlencode($smsfrom);
|
| 32 |
+
$data .= '&msg=' . urlencode($smsmsg);
|
| 33 |
+
$data .= '&validity=300&format=json';
|
|
|
|
| 34 |
$url = $host . $path . $data;
|
| 35 |
+
$verify_number_url = "http://voodoosms.com/vapi/server/checkRanges?uid=" . urlencode($username) . "&pass=" . urlencode($password) . "&dest=" . urlencode($smsto) . "&format=json";
|
| 36 |
+
$verify_number = $this->getHelper()->verify_number($verify_number_url);
|
| 37 |
+
if ($verify_number->result == 200) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
$sendSms = $this->getHelper()->voodoo($url);
|
| 39 |
try {
|
| 40 |
Mage::getModel('voodoo/voodoo')
|
| 49 |
} catch (Exception $e) {
|
| 50 |
}
|
| 51 |
}
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
if ($this->getHelper()->isOrdersNotify() and $this->getHelper()->getAdminTelephone()) {
|
| 55 |
+
$smsto = $this->getHelper()->getAdminTelephone();
|
| 56 |
+
$smsmsg = Mage::helper('voodoo')->__('A new order has been placed: %s', $order->getIncrementId());
|
| 57 |
+
$data = '?uid=' . urlencode($username);
|
| 58 |
+
$data .= '&pass=' . urlencode($password);
|
| 59 |
+
$data .= '&dest=' . urlencode($smsto);
|
| 60 |
+
$data .= '&orig=' . urlencode($smsfrom);
|
| 61 |
+
$data .= '&msg=' . urlencode($smsmsg);
|
| 62 |
+
$data .= '&validity=300&format=json';
|
| 63 |
+
$url = $host . $path . $data;
|
| 64 |
+
$verify_number_url = "http://voodoosms.com/vapi/server/checkRanges?uid=" . urlencode($username) . "&pass=" . urlencode($password) . "&dest=" . urlencode($smsto) . "&format=json";
|
| 65 |
+
$verify_number = $this->getHelper()->verify_number($verify_number_url);
|
| 66 |
+
if ($verify_number->result == 200) {
|
| 67 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 68 |
+
try {
|
| 69 |
+
Mage::getModel('voodoo/voodoo')
|
| 70 |
+
->setOrderId($order->getIncrementId())
|
| 71 |
+
->setFrom($smsfrom)
|
| 72 |
+
->setTo($smsto)
|
| 73 |
+
->setSmsMessage($smsmsg)
|
| 74 |
+
->setStatus($sendSms['status'])
|
| 75 |
+
->setStatusMessage($sendSms['status_message'])
|
| 76 |
+
->setCreatedTime(now())
|
| 77 |
+
->save();
|
| 78 |
+
} catch (Exception $e) {
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
}
|
| 83 |
}
|
| 84 |
}
|
| 93 |
if ($this->getHelper()->isOptinsEnabled()) {
|
| 94 |
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 95 |
} else {
|
| 96 |
+
if ($this->getHelper()->isbillingorshipping() == 0) {
|
| 97 |
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 98 |
+
} else {
|
| 99 |
$smsto = $order->getShippingAddress()->getTelephone();
|
| 100 |
}
|
| 101 |
}
|
| 102 |
if ($smsto) {
|
| 103 |
$host = "http://www.voodoosms.com/";
|
| 104 |
+
$path = "vapi/server/sendSMS";
|
| 105 |
$username = $this->getHelper()->getUsername();
|
| 106 |
$password = $this->getHelper()->getPassword();
|
| 107 |
$smsfrom = $this->getHelper()->getSenderForOrderHold();
|
| 108 |
$smsmsg = $this->getHelper()->getMessageForOrderHold($order);
|
| 109 |
+
$data = '?uid=' . urlencode($username);
|
| 110 |
+
$data .= '&pass=' . urlencode($password);
|
| 111 |
+
$data .= '&dest=' . urlencode($smsto);
|
| 112 |
+
$data .= '&orig=' . urlencode($smsfrom);
|
| 113 |
+
$data .= '&msg=' . urlencode($smsmsg);
|
| 114 |
+
$data .= '&validity=300&format=json';
|
|
|
|
| 115 |
$url = $host . $path . $data;
|
| 116 |
+
$verify_number_url = "http://voodoosms.com/vapi/server/checkRanges?uid=" . urlencode($username) . "&pass=" . urlencode($password) . "&dest=" . urlencode($smsto) . "&format=json";
|
| 117 |
+
$verify_number = $this->getHelper()->verify_number($verify_number_url);
|
| 118 |
+
if ($verify_number->result == 200) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
$sendSms = $this->getHelper()->voodoo($url);
|
| 120 |
try {
|
| 121 |
Mage::getModel('voodoo/voodoo')
|
| 130 |
} catch (Exception $e) {
|
| 131 |
}
|
| 132 |
}
|
| 133 |
+
if ($this->getHelper()->isOrdersHoldNotify() and $this->getHelper()->getAdminHoldTelephone()) {
|
| 134 |
+
$smsto = $this->getHelper()->getAdminHoldTelephone();
|
| 135 |
+
$smsmsg = Mage::helper('voodoo')->__('%s has been placed on hold', $order->getIncrementId());
|
| 136 |
+
$data = '?uid=' . urlencode($username);
|
| 137 |
+
$data .= '&pass=' . urlencode($password);
|
| 138 |
+
$data .= '&dest=' . urlencode($smsto);
|
| 139 |
+
$data .= '&orig=' . urlencode($smsfrom);
|
| 140 |
+
$data .= '&msg=' . urlencode($smsmsg);
|
| 141 |
+
$data .= '&validity=300&format=json';
|
| 142 |
+
$url = $host . $path . $data;
|
| 143 |
+
$verify_number_url = "http://voodoosms.com/vapi/server/checkRanges?uid=" . urlencode($username) . "&pass=" . urlencode($password) . "&dest=" . urlencode($smsto) . "&format=json";
|
| 144 |
+
$verify_number = $this->getHelper()->verify_number($verify_number_url);
|
| 145 |
+
if ($verify_number->result == 200) {
|
| 146 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 147 |
+
try {
|
| 148 |
+
Mage::getModel('voodoo/voodoo')
|
| 149 |
+
->setOrderId($order->getIncrementId())
|
| 150 |
+
->setFrom($smsfrom)
|
| 151 |
+
->setTo($smsto)
|
| 152 |
+
->setSmsMessage($smsmsg)
|
| 153 |
+
->setStatus($sendSms['status'])
|
| 154 |
+
->setStatusMessage($sendSms['status_message'])
|
| 155 |
+
->setCreatedTime(now())
|
| 156 |
+
->save();
|
| 157 |
+
} catch (Exception $e) {
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
}
|
| 162 |
}
|
| 163 |
}
|
| 164 |
}
|
| 165 |
}
|
| 166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
public function sendSmsOnOrderUnhold(Varien_Event_Observer $observer)
|
| 168 |
{
|
| 169 |
if ($this->getHelper()->isOrderUnholdEnabled()) {
|
| 173 |
if ($this->getHelper()->isOptinsEnabled()) {
|
| 174 |
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 175 |
} else {
|
| 176 |
+
if ($this->getHelper()->isbillingorshipping() == 0) {
|
| 177 |
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 178 |
+
} else {
|
| 179 |
$smsto = $order->getShippingAddress()->getTelephone();
|
| 180 |
}
|
| 181 |
}
|
| 182 |
if ($smsto) {
|
| 183 |
$host = "http://www.voodoosms.com/";
|
| 184 |
+
$path = "vapi/server/sendSMS";
|
| 185 |
$username = $this->getHelper()->getUsername();
|
| 186 |
$password = $this->getHelper()->getPassword();
|
| 187 |
$smsfrom = $this->getHelper()->getSenderForOrderUnhold();
|
| 188 |
$smsmsg = $this->getHelper()->getMessageForOrderUnhold($order);
|
| 189 |
+
$data = '?uid=' . urlencode($username);
|
| 190 |
+
$data .= '&pass=' . urlencode($password);
|
| 191 |
+
$data .= '&dest=' . urlencode($smsto);
|
| 192 |
+
$data .= '&orig=' . urlencode($smsfrom);
|
| 193 |
+
$data .= '&msg=' . urlencode($smsmsg);
|
| 194 |
+
$data .= '&validity=300&format=json';
|
|
|
|
| 195 |
$url = $host . $path . $data;
|
| 196 |
+
$verify_number_url = "http://voodoosms.com/vapi/server/checkRanges?uid=" . urlencode($username) . "&pass=" . urlencode($password) . "&dest=" . urlencode($smsto) . "&format=json";
|
| 197 |
+
$verify_number = $this->getHelper()->verify_number($verify_number_url);
|
| 198 |
+
if ($verify_number->result == 200) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
$sendSms = $this->getHelper()->voodoo($url);
|
| 200 |
try {
|
| 201 |
Mage::getModel('voodoo/voodoo')
|
| 210 |
} catch (Exception $e) {
|
| 211 |
}
|
| 212 |
}
|
| 213 |
+
if ($this->getHelper()->isOrdersUnholdNotify() and $this->getHelper()->getAdminUnholdTelephone()) {
|
| 214 |
+
$smsto = $this->getHelper()->getAdminUnholdTelephone();
|
| 215 |
+
$smsmsg = Mage::helper('voodoo')->__('%s has been placed on unhold', $order->getIncrementId());
|
| 216 |
+
$data = '?uid=' . urlencode($username);
|
| 217 |
+
$data .= '&pass=' . urlencode($password);
|
| 218 |
+
$data .= '&dest=' . urlencode($smsto);
|
| 219 |
+
$data .= '&orig=' . urlencode($smsfrom);
|
| 220 |
+
$data .= '&msg=' . urlencode($smsmsg);
|
| 221 |
+
$data .= '&validity=300&format=json';
|
| 222 |
+
$url = $host . $path . $data;
|
| 223 |
+
$verify_number_url = "http://voodoosms.com/vapi/server/checkRanges?uid=" . urlencode($username) . "&pass=" . urlencode($password) . "&dest=" . urlencode($smsto) . "&format=json";
|
| 224 |
+
$verify_number = $this->getHelper()->verify_number($verify_number_url);
|
| 225 |
+
if ($verify_number->result == 200) {
|
| 226 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 227 |
+
try {
|
| 228 |
+
Mage::getModel('voodoo/voodoo')
|
| 229 |
+
->setOrderId($order->getIncrementId())
|
| 230 |
+
->setFrom($smsfrom)
|
| 231 |
+
->setTo($smsto)
|
| 232 |
+
->setSmsMessage($smsmsg)
|
| 233 |
+
->setStatus($sendSms['status'])
|
| 234 |
+
->setStatusMessage($sendSms['status_message'])
|
| 235 |
+
->setCreatedTime(now())
|
| 236 |
+
->save();
|
| 237 |
+
} catch (Exception $e) {
|
| 238 |
+
}
|
| 239 |
+
}
|
| 240 |
+
}
|
| 241 |
}
|
| 242 |
|
| 243 |
}
|
| 245 |
}
|
| 246 |
}
|
| 247 |
|
| 248 |
+
public function getHelper()
|
| 249 |
+
{
|
| 250 |
+
return Mage::helper('voodoo/Data');
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
public function sendSmsOnOrderCanceled(Varien_Event_Observer $observer)
|
| 254 |
{
|
| 255 |
if ($this->getHelper()->isOrderCanceledEnabled()) {
|
| 259 |
if ($this->getHelper()->isOptinsEnabled()) {
|
| 260 |
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 261 |
} else {
|
| 262 |
+
if ($this->getHelper()->isbillingorshipping() == 0) {
|
| 263 |
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 264 |
+
} else {
|
| 265 |
$smsto = $order->getShippingAddress()->getTelephone();
|
| 266 |
}
|
| 267 |
}
|
| 268 |
if ($smsto) {
|
| 269 |
$host = "http://www.voodoosms.com/";
|
| 270 |
+
$path = "vapi/server/sendSMS";
|
| 271 |
$username = $this->getHelper()->getUsername();
|
| 272 |
$password = $this->getHelper()->getPassword();
|
| 273 |
$smsfrom = $this->getHelper()->getSenderForOrderCanceled();
|
| 274 |
$smsmsg = $this->getHelper()->getMessageForOrderCanceled($order);
|
| 275 |
+
$data = '?uid=' . urlencode($username);
|
| 276 |
+
$data .= '&pass=' . urlencode($password);
|
| 277 |
+
$data .= '&dest=' . urlencode($smsto);
|
| 278 |
+
$data .= '&orig=' . urlencode($smsfrom);
|
| 279 |
+
$data .= '&msg=' . urlencode($smsmsg);
|
| 280 |
+
$data .= '&validity=300&format=json';
|
|
|
|
| 281 |
$url = $host . $path . $data;
|
| 282 |
+
$verify_number_url = "http://voodoosms.com/vapi/server/checkRanges?uid=" . urlencode($username) . "&pass=" . urlencode($password) . "&dest=" . urlencode($smsto) . "&format=json";
|
| 283 |
+
$verify_number = $this->getHelper()->verify_number($verify_number_url);
|
| 284 |
+
if ($verify_number->result == 200) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
$sendSms = $this->getHelper()->voodoo($url);
|
| 286 |
try {
|
| 287 |
Mage::getModel('voodoo/voodoo')
|
| 296 |
} catch (Exception $e) {
|
| 297 |
}
|
| 298 |
}
|
| 299 |
+
if ($this->getHelper()->isOrdersCancelledNotify() and $this->getHelper()->getAdminCancelledTelephone()) {
|
| 300 |
+
$smsto = $this->getHelper()->getAdminCancelledTelephone();
|
| 301 |
+
$smsmsg = Mage::helper('voodoo')->__('%s has been placed cancelled', $order->getIncrementId());
|
| 302 |
+
$data = '?uid=' . urlencode($username);
|
| 303 |
+
$data .= '&pass=' . urlencode($password);
|
| 304 |
+
$data .= '&dest=' . urlencode($smsto);
|
| 305 |
+
$data .= '&orig=' . urlencode($smsfrom);
|
| 306 |
+
$data .= '&msg=' . urlencode($smsmsg);
|
| 307 |
+
$data .= '&validity=300&format=json&format=json';
|
| 308 |
+
$url = $host . $path . $data;
|
| 309 |
+
$verify_number_url = "http://voodoosms.com/vapi/server/checkRanges?uid=" . urlencode($username) . "&pass=" . urlencode($password) . "&dest=" . urlencode($smsto) . "&format=json";
|
| 310 |
+
$verify_number = $this->getHelper()->verify_number($verify_number_url);
|
| 311 |
+
if ($verify_number->result == 200) {
|
| 312 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 313 |
+
try {
|
| 314 |
+
Mage::getModel('voodoo/voodoo')
|
| 315 |
+
->setOrderId($order->getIncrementId())
|
| 316 |
+
->setFrom($smsfrom)
|
| 317 |
+
->setTo($smsto)
|
| 318 |
+
->setSmsMessage($smsmsg)
|
| 319 |
+
->setStatus($sendSms['status'])
|
| 320 |
+
->setStatusMessage($sendSms['status_message'])
|
| 321 |
+
->setCreatedTime(now())
|
| 322 |
+
->save();
|
| 323 |
+
} catch (Exception $e) {
|
| 324 |
+
}
|
| 325 |
+
}
|
| 326 |
+
}
|
| 327 |
}
|
| 328 |
|
| 329 |
}
|
| 340 |
if ($this->getHelper()->isOptinsEnabled()) {
|
| 341 |
$smsto = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 342 |
} else {
|
| 343 |
+
if ($this->getHelper()->isbillingorshipping() == 0) {
|
| 344 |
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
| 345 |
+
} else {
|
| 346 |
$smsto = $order->getShippingAddress()->getTelephone();
|
| 347 |
}
|
| 348 |
}
|
| 349 |
if ($smsto) {
|
| 350 |
$host = "http://www.voodoosms.com/";
|
| 351 |
+
$path = "vapi/server/sendSMS";
|
| 352 |
$username = $this->getHelper()->getUsername();
|
| 353 |
$password = $this->getHelper()->getPassword();
|
| 354 |
$smsfrom = $this->getHelper()->getSenderForShipment();
|
| 355 |
$smsmsg = $this->getHelper()->getMessageForShipment($order);
|
| 356 |
+
$data = '?uid=' . urlencode($username);
|
| 357 |
+
$data .= '&pass=' . urlencode($password);
|
| 358 |
+
$data .= '&dest=' . urlencode($smsto);
|
| 359 |
+
$data .= '&orig=' . urlencode($smsfrom);
|
| 360 |
+
$data .= '&msg=' . urlencode($smsmsg);
|
| 361 |
+
$data .= '&validity=300&format=json';
|
|
|
|
| 362 |
$url = $host . $path . $data;
|
| 363 |
+
$verify_number_url = "http://voodoosms.com/vapi/server/checkRanges?uid=" . urlencode($username) . "&pass=" . urlencode($password) . "&dest=" . urlencode($smsto) . "&format=json";
|
| 364 |
+
$verify_number = $this->getHelper()->verify_number($verify_number_url);
|
| 365 |
+
if ($verify_number->result == 200) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
$sendSms = $this->getHelper()->voodoo($url);
|
| 367 |
try {
|
| 368 |
Mage::getModel('voodoo/voodoo')
|
| 377 |
} catch (Exception $e) {
|
| 378 |
}
|
| 379 |
}
|
| 380 |
+
if ($this->getHelper()->isOrdersShipmentsNotify() and $this->getHelper()->getAdminShipmentsTelephone()) {
|
| 381 |
+
$smsto = $this->getHelper()->getAdminTelephone();
|
| 382 |
+
$smsmsg = Mage::helper('voodoo')->__('%s is on shipment state', $order->getIncrementId());
|
| 383 |
+
$data = '?uid=' . urlencode($username);
|
| 384 |
+
$data .= '&pass=' . urlencode($password);
|
| 385 |
+
$data .= '&dest=' . urlencode($smsto);
|
| 386 |
+
$data .= '&orig=' . urlencode($smsfrom);
|
| 387 |
+
$data .= '&msg=' . urlencode($smsmsg);
|
| 388 |
+
$data .= '&validity=300&format=json';
|
| 389 |
+
$url = $host . $path . $data;
|
| 390 |
+
$verify_number_url = "http://voodoosms.com/vapi/server/checkRanges?uid=" . urlencode($username) . "&pass=" . urlencode($password) . "&dest=" . urlencode($smsto) . "&format=json";
|
| 391 |
+
$verify_number = $this->getHelper()->verify_number($verify_number_url);
|
| 392 |
+
if ($verify_number->result == 200) {
|
| 393 |
+
$sendSms = $this->getHelper()->voodoo($url);
|
| 394 |
+
try {
|
| 395 |
+
Mage::getModel('voodoo/voodoo')
|
| 396 |
+
->setOrderId($order->getIncrementId())
|
| 397 |
+
->setFrom($smsfrom)
|
| 398 |
+
->setTo($smsto)
|
| 399 |
+
->setSmsMessage($smsmsg)
|
| 400 |
+
->setStatus($sendSms['status'])
|
| 401 |
+
->setStatusMessage($sendSms['status_message'])
|
| 402 |
+
->setCreatedTime(now())
|
| 403 |
+
->save();
|
| 404 |
+
} catch (Exception $e) {
|
| 405 |
+
}
|
| 406 |
+
}
|
| 407 |
+
}
|
| 408 |
}
|
| 409 |
|
| 410 |
}
|
| 432 |
//Fetch the data from select box and throw it here
|
| 433 |
$_voodoo_data = null;
|
| 434 |
$_voodoo_data = Mage::getSingleton('core/session')->getTGMVoodoo();
|
| 435 |
+
if ($_voodoo_data != null) {
|
| 436 |
$write = Mage::getSingleton("core/resource")->getConnection("core_write");
|
| 437 |
|
| 438 |
// Concatenated with . for readability
|
app/code/community/TGM/Voodoo/Model/Voodoo.php
CHANGED
|
@@ -13,10 +13,10 @@ class TGM_Voodoo_Model_Voodoo extends Mage_Core_Model_Abstract
|
|
| 13 |
$username = Mage::helper('voodoo/Data')->getUsername();
|
| 14 |
$password = Mage::helper('voodoo/Data')->getPassword();
|
| 15 |
$host = "http://www.voodoosms.com/";
|
| 16 |
-
$path = "
|
| 17 |
-
$data
|
| 18 |
-
$data
|
| 19 |
-
$data .= '&
|
| 20 |
$url = $host.$path.$data;
|
| 21 |
$credits = Mage::helper('voodoo/Data')->credits($url);
|
| 22 |
return $credits;
|
| 13 |
$username = Mage::helper('voodoo/Data')->getUsername();
|
| 14 |
$password = Mage::helper('voodoo/Data')->getPassword();
|
| 15 |
$host = "http://www.voodoosms.com/";
|
| 16 |
+
$path = "vapi/server/getcredit";
|
| 17 |
+
$data = '?uid=' . urlencode($username);
|
| 18 |
+
$data .= '&pass=' . urlencode($password);
|
| 19 |
+
$data .= '&format=json';
|
| 20 |
$url = $host.$path.$data;
|
| 21 |
$credits = Mage::helper('voodoo/Data')->credits($url);
|
| 22 |
return $credits;
|
app/code/community/TGM/Voodoo/etc/config.xml
CHANGED
|
@@ -10,7 +10,7 @@
|
|
| 10 |
<config>
|
| 11 |
<modules>
|
| 12 |
<TGM_Voodoo>
|
| 13 |
-
<version>
|
| 14 |
</TGM_Voodoo>
|
| 15 |
</modules>
|
| 16 |
<admin>
|
| 10 |
<config>
|
| 11 |
<modules>
|
| 12 |
<TGM_Voodoo>
|
| 13 |
+
<version>3.1.2</version>
|
| 14 |
</TGM_Voodoo>
|
| 15 |
</modules>
|
| 16 |
<admin>
|
app/code/community/TGM/Voodoo/etc/system.xml
CHANGED
|
@@ -32,8 +32,8 @@
|
|
| 32 |
<show_in_store>1</show_in_store>
|
| 33 |
<fields>
|
| 34 |
<username translate="label">
|
| 35 |
-
<label>Voodoo API Username</label>
|
| 36 |
-
<comment>Enter your
|
| 37 |
<tooltip>Your username must be the same as your voodoo api username</tooltip>
|
| 38 |
<frontend_type>text</frontend_type>
|
| 39 |
<sort_order>5</sort_order>
|
|
@@ -42,8 +42,8 @@
|
|
| 42 |
<show_in_store>1</show_in_store>
|
| 43 |
</username>
|
| 44 |
<password translate="label">
|
| 45 |
-
<label>Voodoo API Password</label>
|
| 46 |
-
<comment>Enter your
|
| 47 |
<tooltip>Your password must be the same as your voodoo api password</tooltip>
|
| 48 |
<frontend_type>password</frontend_type>
|
| 49 |
<sort_order>10</sort_order>
|
|
@@ -75,7 +75,7 @@
|
|
| 75 |
<show_in_store>1</show_in_store>
|
| 76 |
</grabApiAccount>
|
| 77 |
<credits translate="label">
|
| 78 |
-
<label>
|
| 79 |
<comment>Click above to get more credits </comment>
|
| 80 |
<frontend_model>voodoo/credits</frontend_model>
|
| 81 |
<sort_order>25</sort_order>
|
|
@@ -106,7 +106,7 @@
|
|
| 106 |
</fields>
|
| 107 |
</optins>
|
| 108 |
<deno translate="label">
|
| 109 |
-
<label>Default Number (Used when
|
| 110 |
<frontend_type>text</frontend_type>
|
| 111 |
<sort_order>20</sort_order>
|
| 112 |
<show_in_default>1</show_in_default>
|
|
@@ -126,7 +126,7 @@
|
|
| 126 |
</fields>
|
| 127 |
</deno>
|
| 128 |
<orders translate="label">
|
| 129 |
-
<label>When
|
| 130 |
<frontend_type>text</frontend_type>
|
| 131 |
<sort_order>25</sort_order>
|
| 132 |
<show_in_default>1</show_in_default>
|
|
@@ -134,8 +134,8 @@
|
|
| 134 |
<show_in_store>1</show_in_store>
|
| 135 |
<fields>
|
| 136 |
<enabled translate="label comment">
|
| 137 |
-
<label>
|
| 138 |
-
<comment>This option will send
|
| 139 |
<frontend_type>select</frontend_type>
|
| 140 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 141 |
<sort_order>5</sort_order>
|
|
@@ -156,7 +156,7 @@
|
|
| 156 |
</sender>
|
| 157 |
<message translate="label comment">
|
| 158 |
<label>Enter the Message</label>
|
| 159 |
-
<comment>Your Message Content, (Max 160
|
| 160 |
<validate>required-entry validate-length minimum-length-1 maximum-length-160</validate>
|
| 161 |
<tooltip>Enter your default message. You can use {{firstname}} for Firstname, {{middlename}} for Middlename, {{lastname}} for Lastname, {{fax}} for Fax, {{postal}} for Post Code, {{city}} for City, {{email}} for EmailAddress and {{order_id}} for Order Number.</tooltip>
|
| 162 |
<frontend_type>textarea</frontend_type>
|
|
@@ -166,8 +166,8 @@
|
|
| 166 |
<show_in_store>1</show_in_store>
|
| 167 |
</message>
|
| 168 |
<notify translate="label comment">
|
| 169 |
-
<label>Admin
|
| 170 |
-
<comment>This option will send
|
| 171 |
<frontend_type>select</frontend_type>
|
| 172 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 173 |
<sort_order>20</sort_order>
|
|
@@ -177,7 +177,7 @@
|
|
| 177 |
</notify>
|
| 178 |
<receiver translate="label comment">
|
| 179 |
<label>Admin Mobile</label>
|
| 180 |
-
<comment>
|
| 181 |
<validate>required-entry</validate>
|
| 182 |
<frontend_type>text</frontend_type>
|
| 183 |
<sort_order>25</sort_order>
|
|
@@ -200,7 +200,7 @@
|
|
| 200 |
<fields>
|
| 201 |
<enabled translate="label comment">
|
| 202 |
<label>Enabled</label>
|
| 203 |
-
<comment>This option will send
|
| 204 |
<frontend_type>select</frontend_type>
|
| 205 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 206 |
<sort_order>5</sort_order>
|
|
@@ -221,7 +221,7 @@
|
|
| 221 |
</sender>
|
| 222 |
<message translate="label comment">
|
| 223 |
<label>Enter the Message</label>
|
| 224 |
-
<comment>Your Message Content, (Max 160
|
| 225 |
<validate>required-entry validate-length minimum-length-1 maximum-length-160</validate>
|
| 226 |
<tooltip>Enter your default message. You can use {{firstname}} for Firstname, {{middlename}} for Middlename, {{lastname}} for Lastname, {{fax}} for Fax, {{postal}} for Post Code, {{city}} for City, {{email}} for EmailAddress and {{order_id}} for Order Number.</tooltip>
|
| 227 |
<frontend_type>textarea</frontend_type>
|
|
@@ -231,8 +231,8 @@
|
|
| 231 |
<show_in_store>1</show_in_store>
|
| 232 |
</message>
|
| 233 |
<notify translate="label comment">
|
| 234 |
-
<label>Admin
|
| 235 |
-
<comment>This option will send
|
| 236 |
<frontend_type>select</frontend_type>
|
| 237 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 238 |
<sort_order>30</sort_order>
|
|
@@ -242,7 +242,7 @@
|
|
| 242 |
</notify>
|
| 243 |
<receiver translate="label comment">
|
| 244 |
<label>Admin Mobile</label>
|
| 245 |
-
<comment>
|
| 246 |
<validate>required-entry</validate>
|
| 247 |
<frontend_type>text</frontend_type>
|
| 248 |
<sort_order>25</sort_order>
|
|
@@ -265,7 +265,7 @@
|
|
| 265 |
<fields>
|
| 266 |
<enabled translate="label comment">
|
| 267 |
<label>Enabled</label>
|
| 268 |
-
<comment>This option will send
|
| 269 |
<frontend_type>select</frontend_type>
|
| 270 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 271 |
<sort_order>5</sort_order>
|
|
@@ -286,7 +286,7 @@
|
|
| 286 |
</sender>
|
| 287 |
<message translate="label comment">
|
| 288 |
<label>Enter the Message</label>
|
| 289 |
-
<comment>Your Message Content, (Max 160
|
| 290 |
<validate>required-entry validate-length minimum-length-1 maximum-length-160</validate>
|
| 291 |
<tooltip>Enter your default message. You can use {{firstname}} for Firstname, {{middlename}} for Middlename, {{lastname}} for Lastname, {{fax}} for Fax, {{postal}} for Post Code, {{city}} for City, {{email}} for EmailAddress and {{order_id}} for Order Number.</tooltip>
|
| 292 |
<frontend_type>textarea</frontend_type>
|
|
@@ -296,8 +296,8 @@
|
|
| 296 |
<show_in_store>1</show_in_store>
|
| 297 |
</message>
|
| 298 |
<notify translate="label comment">
|
| 299 |
-
<label>Admin
|
| 300 |
-
<comment>This option will send
|
| 301 |
<frontend_type>select</frontend_type>
|
| 302 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 303 |
<sort_order>20</sort_order>
|
|
@@ -307,7 +307,7 @@
|
|
| 307 |
</notify>
|
| 308 |
<receiver translate="label comment">
|
| 309 |
<label>Admin Mobile</label>
|
| 310 |
-
<comment>
|
| 311 |
<validate>required-entry</validate>
|
| 312 |
<frontend_type>text</frontend_type>
|
| 313 |
<sort_order>25</sort_order>
|
|
@@ -330,7 +330,7 @@
|
|
| 330 |
<fields>
|
| 331 |
<enabled translate="label comment">
|
| 332 |
<label>Enabled</label>
|
| 333 |
-
<comment>This option will send
|
| 334 |
<frontend_type>select</frontend_type>
|
| 335 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 336 |
<sort_order>5</sort_order>
|
|
@@ -351,7 +351,7 @@
|
|
| 351 |
</sender>
|
| 352 |
<message translate="label comment">
|
| 353 |
<label>Enter the Message</label>
|
| 354 |
-
<comment>Your Message Content, (Max 160
|
| 355 |
<validate>required-entry validate-length minimum-length-1 maximum-length-160</validate>
|
| 356 |
<tooltip>Enter your default message. You can use {{firstname}} for Firstname, {{middlename}} for Middlename, {{lastname}} for Lastname, {{fax}} for Fax, {{postal}} for Post Code, {{city}} for City, {{email}} for EmailAddress and {{order_id}} for Order Number.</tooltip>
|
| 357 |
<frontend_type>textarea</frontend_type>
|
|
@@ -361,8 +361,8 @@
|
|
| 361 |
<show_in_store>1</show_in_store>
|
| 362 |
</message>
|
| 363 |
<notify translate="label comment">
|
| 364 |
-
<label>Admin
|
| 365 |
-
<comment>This option will send
|
| 366 |
<frontend_type>select</frontend_type>
|
| 367 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 368 |
<sort_order>20</sort_order>
|
|
@@ -372,7 +372,7 @@
|
|
| 372 |
</notify>
|
| 373 |
<receiver translate="label comment">
|
| 374 |
<label>Admin Mobile</label>
|
| 375 |
-
<comment>
|
| 376 |
<validate>required-entry</validate>
|
| 377 |
<frontend_type>text</frontend_type>
|
| 378 |
<sort_order>25</sort_order>
|
|
@@ -386,7 +386,7 @@
|
|
| 386 |
</fields>
|
| 387 |
</order_canceled>
|
| 388 |
<shipments translate="label">
|
| 389 |
-
<label>When Order is
|
| 390 |
<frontend_type>text</frontend_type>
|
| 391 |
<sort_order>45</sort_order>
|
| 392 |
<show_in_default>1</show_in_default>
|
|
@@ -395,7 +395,7 @@
|
|
| 395 |
<fields>
|
| 396 |
<enabled translate="label comment">
|
| 397 |
<label>Enabled</label>
|
| 398 |
-
<comment>It will send
|
| 399 |
<frontend_type>select</frontend_type>
|
| 400 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 401 |
<sort_order>5</sort_order>
|
|
@@ -416,7 +416,7 @@
|
|
| 416 |
</sender>
|
| 417 |
<message translate="label comment">
|
| 418 |
<label>Enter the Message</label>
|
| 419 |
-
<comment>Your Message Content, (Max 160
|
| 420 |
<validate>required-entry validate-length minimum-length-1 maximum-length-160</validate>
|
| 421 |
<tooltip>Enter your default message. You can use {{firstname}} for Firstname, {{middlename}} for Middlename, {{lastname}} for Lastname, {{fax}} for Fax, {{postal}} for Post Code, {{city}} for City, {{email}} for EmailAddress and {{order_id}} for Order Number.</tooltip>
|
| 422 |
<frontend_type>textarea</frontend_type>
|
|
@@ -426,8 +426,8 @@
|
|
| 426 |
<show_in_store>1</show_in_store>
|
| 427 |
</message>
|
| 428 |
<notify translate="label comment">
|
| 429 |
-
<label>Admin
|
| 430 |
-
<comment>This option will send
|
| 431 |
<frontend_type>select</frontend_type>
|
| 432 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 433 |
<sort_order>20</sort_order>
|
|
@@ -437,7 +437,7 @@
|
|
| 437 |
</notify>
|
| 438 |
<receiver translate="label comment">
|
| 439 |
<label>Admin Mobile</label>
|
| 440 |
-
<comment>
|
| 441 |
<validate>required-entry</validate>
|
| 442 |
<frontend_type>text</frontend_type>
|
| 443 |
<sort_order>25</sort_order>
|
| 32 |
<show_in_store>1</show_in_store>
|
| 33 |
<fields>
|
| 34 |
<username translate="label">
|
| 35 |
+
<label>Voodoo SMS API Username</label>
|
| 36 |
+
<comment>Enter your Voodoo SMS API Username</comment>
|
| 37 |
<tooltip>Your username must be the same as your voodoo api username</tooltip>
|
| 38 |
<frontend_type>text</frontend_type>
|
| 39 |
<sort_order>5</sort_order>
|
| 42 |
<show_in_store>1</show_in_store>
|
| 43 |
</username>
|
| 44 |
<password translate="label">
|
| 45 |
+
<label>Voodoo SMS API Password</label>
|
| 46 |
+
<comment>Enter your Voodoo SMS API Password</comment>
|
| 47 |
<tooltip>Your password must be the same as your voodoo api password</tooltip>
|
| 48 |
<frontend_type>password</frontend_type>
|
| 49 |
<sort_order>10</sort_order>
|
| 75 |
<show_in_store>1</show_in_store>
|
| 76 |
</grabApiAccount>
|
| 77 |
<credits translate="label">
|
| 78 |
+
<label>Available Credits</label>
|
| 79 |
<comment>Click above to get more credits </comment>
|
| 80 |
<frontend_model>voodoo/credits</frontend_model>
|
| 81 |
<sort_order>25</sort_order>
|
| 106 |
</fields>
|
| 107 |
</optins>
|
| 108 |
<deno translate="label">
|
| 109 |
+
<label>Default Number (Used when Opt-in is set to No)</label>
|
| 110 |
<frontend_type>text</frontend_type>
|
| 111 |
<sort_order>20</sort_order>
|
| 112 |
<show_in_default>1</show_in_default>
|
| 126 |
</fields>
|
| 127 |
</deno>
|
| 128 |
<orders translate="label">
|
| 129 |
+
<label>When a New Order is Placed</label>
|
| 130 |
<frontend_type>text</frontend_type>
|
| 131 |
<sort_order>25</sort_order>
|
| 132 |
<show_in_default>1</show_in_default>
|
| 134 |
<show_in_store>1</show_in_store>
|
| 135 |
<fields>
|
| 136 |
<enabled translate="label comment">
|
| 137 |
+
<label>Enable Customer Notification</label>
|
| 138 |
+
<comment>This option will send SMS when an Order is Placed</comment>
|
| 139 |
<frontend_type>select</frontend_type>
|
| 140 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 141 |
<sort_order>5</sort_order>
|
| 156 |
</sender>
|
| 157 |
<message translate="label comment">
|
| 158 |
<label>Enter the Message</label>
|
| 159 |
+
<comment>Your Message Content, (Max 918 characters. Text over 160 characters may incurs multiple credit charges)</comment>
|
| 160 |
<validate>required-entry validate-length minimum-length-1 maximum-length-160</validate>
|
| 161 |
<tooltip>Enter your default message. You can use {{firstname}} for Firstname, {{middlename}} for Middlename, {{lastname}} for Lastname, {{fax}} for Fax, {{postal}} for Post Code, {{city}} for City, {{email}} for EmailAddress and {{order_id}} for Order Number.</tooltip>
|
| 162 |
<frontend_type>textarea</frontend_type>
|
| 166 |
<show_in_store>1</show_in_store>
|
| 167 |
</message>
|
| 168 |
<notify translate="label comment">
|
| 169 |
+
<label>Enable Admin Notifications</label>
|
| 170 |
+
<comment>This option will send SMS to the admin when an Order is Placed</comment>
|
| 171 |
<frontend_type>select</frontend_type>
|
| 172 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 173 |
<sort_order>20</sort_order>
|
| 177 |
</notify>
|
| 178 |
<receiver translate="label comment">
|
| 179 |
<label>Admin Mobile</label>
|
| 180 |
+
<comment>Admin Mobile(s): Enter as many numbers as you like here, comma seperated if multiple e.g. 07700900000,07700900001</comment>
|
| 181 |
<validate>required-entry</validate>
|
| 182 |
<frontend_type>text</frontend_type>
|
| 183 |
<sort_order>25</sort_order>
|
| 200 |
<fields>
|
| 201 |
<enabled translate="label comment">
|
| 202 |
<label>Enabled</label>
|
| 203 |
+
<comment>This option will send SMS when an Order Status is set to Hold</comment>
|
| 204 |
<frontend_type>select</frontend_type>
|
| 205 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 206 |
<sort_order>5</sort_order>
|
| 221 |
</sender>
|
| 222 |
<message translate="label comment">
|
| 223 |
<label>Enter the Message</label>
|
| 224 |
+
<comment>Your Message Content, (Max 918 characters. Text over 160 characters may incurs multiple credit charges)</comment>
|
| 225 |
<validate>required-entry validate-length minimum-length-1 maximum-length-160</validate>
|
| 226 |
<tooltip>Enter your default message. You can use {{firstname}} for Firstname, {{middlename}} for Middlename, {{lastname}} for Lastname, {{fax}} for Fax, {{postal}} for Post Code, {{city}} for City, {{email}} for EmailAddress and {{order_id}} for Order Number.</tooltip>
|
| 227 |
<frontend_type>textarea</frontend_type>
|
| 231 |
<show_in_store>1</show_in_store>
|
| 232 |
</message>
|
| 233 |
<notify translate="label comment">
|
| 234 |
+
<label>Enable Admin Notifications</label>
|
| 235 |
+
<comment>This option will send SMS to the admin when an Order Status is set to Hold</comment>
|
| 236 |
<frontend_type>select</frontend_type>
|
| 237 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 238 |
<sort_order>30</sort_order>
|
| 242 |
</notify>
|
| 243 |
<receiver translate="label comment">
|
| 244 |
<label>Admin Mobile</label>
|
| 245 |
+
<comment>Admin Mobile(s): Enter as many numbers as you like here, comma seperated if multiple e.g. 07700900000,07700900001</comment>
|
| 246 |
<validate>required-entry</validate>
|
| 247 |
<frontend_type>text</frontend_type>
|
| 248 |
<sort_order>25</sort_order>
|
| 265 |
<fields>
|
| 266 |
<enabled translate="label comment">
|
| 267 |
<label>Enabled</label>
|
| 268 |
+
<comment>This option will send SMS when Order Status is set to Unhold</comment>
|
| 269 |
<frontend_type>select</frontend_type>
|
| 270 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 271 |
<sort_order>5</sort_order>
|
| 286 |
</sender>
|
| 287 |
<message translate="label comment">
|
| 288 |
<label>Enter the Message</label>
|
| 289 |
+
<comment>Your Message Content, (Max 918 characters. Text over 160 characters may incurs multiple credit charges)</comment>
|
| 290 |
<validate>required-entry validate-length minimum-length-1 maximum-length-160</validate>
|
| 291 |
<tooltip>Enter your default message. You can use {{firstname}} for Firstname, {{middlename}} for Middlename, {{lastname}} for Lastname, {{fax}} for Fax, {{postal}} for Post Code, {{city}} for City, {{email}} for EmailAddress and {{order_id}} for Order Number.</tooltip>
|
| 292 |
<frontend_type>textarea</frontend_type>
|
| 296 |
<show_in_store>1</show_in_store>
|
| 297 |
</message>
|
| 298 |
<notify translate="label comment">
|
| 299 |
+
<label>Enable Admin Notifications</label>
|
| 300 |
+
<comment>This option will send SMS to the Admin when Order Status is set to Unhold</comment>
|
| 301 |
<frontend_type>select</frontend_type>
|
| 302 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 303 |
<sort_order>20</sort_order>
|
| 307 |
</notify>
|
| 308 |
<receiver translate="label comment">
|
| 309 |
<label>Admin Mobile</label>
|
| 310 |
+
<comment>Admin Mobile(s): Enter as many numbers as you like here, comma seperated if multiple e.g. 07700900000,07700900001</comment>
|
| 311 |
<validate>required-entry</validate>
|
| 312 |
<frontend_type>text</frontend_type>
|
| 313 |
<sort_order>25</sort_order>
|
| 330 |
<fields>
|
| 331 |
<enabled translate="label comment">
|
| 332 |
<label>Enabled</label>
|
| 333 |
+
<comment>This option will send SMS to customer when the Order is Cancelled</comment>
|
| 334 |
<frontend_type>select</frontend_type>
|
| 335 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 336 |
<sort_order>5</sort_order>
|
| 351 |
</sender>
|
| 352 |
<message translate="label comment">
|
| 353 |
<label>Enter the Message</label>
|
| 354 |
+
<comment>Your Message Content, (Max 918 characters. Text over 160 characters may incurs multiple credit charges)</comment>
|
| 355 |
<validate>required-entry validate-length minimum-length-1 maximum-length-160</validate>
|
| 356 |
<tooltip>Enter your default message. You can use {{firstname}} for Firstname, {{middlename}} for Middlename, {{lastname}} for Lastname, {{fax}} for Fax, {{postal}} for Post Code, {{city}} for City, {{email}} for EmailAddress and {{order_id}} for Order Number.</tooltip>
|
| 357 |
<frontend_type>textarea</frontend_type>
|
| 361 |
<show_in_store>1</show_in_store>
|
| 362 |
</message>
|
| 363 |
<notify translate="label comment">
|
| 364 |
+
<label>Enable Admin Notifications</label>
|
| 365 |
+
<comment>This option will send SMS to the Admin when Order is Cancelled</comment>
|
| 366 |
<frontend_type>select</frontend_type>
|
| 367 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 368 |
<sort_order>20</sort_order>
|
| 372 |
</notify>
|
| 373 |
<receiver translate="label comment">
|
| 374 |
<label>Admin Mobile</label>
|
| 375 |
+
<comment>Admin Mobile(s): Enter as many numbers as you like here, comma seperated if multiple e.g. 07700900000,07700900001</comment>
|
| 376 |
<validate>required-entry</validate>
|
| 377 |
<frontend_type>text</frontend_type>
|
| 378 |
<sort_order>25</sort_order>
|
| 386 |
</fields>
|
| 387 |
</order_canceled>
|
| 388 |
<shipments translate="label">
|
| 389 |
+
<label>When Order is Shipped</label>
|
| 390 |
<frontend_type>text</frontend_type>
|
| 391 |
<sort_order>45</sort_order>
|
| 392 |
<show_in_default>1</show_in_default>
|
| 395 |
<fields>
|
| 396 |
<enabled translate="label comment">
|
| 397 |
<label>Enabled</label>
|
| 398 |
+
<comment>It will send SMS when the Order is Shipped</comment>
|
| 399 |
<frontend_type>select</frontend_type>
|
| 400 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 401 |
<sort_order>5</sort_order>
|
| 416 |
</sender>
|
| 417 |
<message translate="label comment">
|
| 418 |
<label>Enter the Message</label>
|
| 419 |
+
<comment>Your Message Content, (Max 918 characters. Text over 160 characters may incurs multiple credit charges)</comment>
|
| 420 |
<validate>required-entry validate-length minimum-length-1 maximum-length-160</validate>
|
| 421 |
<tooltip>Enter your default message. You can use {{firstname}} for Firstname, {{middlename}} for Middlename, {{lastname}} for Lastname, {{fax}} for Fax, {{postal}} for Post Code, {{city}} for City, {{email}} for EmailAddress and {{order_id}} for Order Number.</tooltip>
|
| 422 |
<frontend_type>textarea</frontend_type>
|
| 426 |
<show_in_store>1</show_in_store>
|
| 427 |
</message>
|
| 428 |
<notify translate="label comment">
|
| 429 |
+
<label>Enable Admin Notifications</label>
|
| 430 |
+
<comment>This option will send SMS to the admin when an Order is Shipped</comment>
|
| 431 |
<frontend_type>select</frontend_type>
|
| 432 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 433 |
<sort_order>20</sort_order>
|
| 437 |
</notify>
|
| 438 |
<receiver translate="label comment">
|
| 439 |
<label>Admin Mobile</label>
|
| 440 |
+
<comment>Admin Mobile(s): Enter as many numbers as you like here, comma seperated if multiple e.g. 07700900000,07700900001</comment>
|
| 441 |
<validate>required-entry</validate>
|
| 442 |
<frontend_type>text</frontend_type>
|
| 443 |
<sort_order>25</sort_order>
|
app/design/frontend/default/default/layout/voodoo.xml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
|
| 3 |
+
<layout version="0.1.0">
|
| 4 |
+
|
| 5 |
+
<checkout_onepage_index>
|
| 6 |
+
<reference name="checkout.onepage">
|
| 7 |
+
<!-- Extra step added to OnePage Checkout -->
|
| 8 |
+
<block type="voodoo/onepage_voodoo" name="checkout.onepage.voodoo" as="voodoo" after="checkout.onepage.billing" template="checkout/onepage/voodoo.phtml"/>
|
| 9 |
+
</reference>
|
| 10 |
+
</checkout_onepage_index>
|
| 11 |
+
|
| 12 |
+
</layout>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>TGM_Voodoo_Ext</name>
|
| 4 |
-
<version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -35,9 +35,9 @@ Release Version: ‘1.0.0'
|
|
| 35 |
Release Stability: 'Stable'</description>
|
| 36 |
<notes>Release Notes</notes>
|
| 37 |
<authors><author><name>Top Gear Media</name><user>bulksms</user><email>team@voodoosms.com</email></author></authors>
|
| 38 |
-
<date>2015-
|
| 39 |
-
<time>
|
| 40 |
-
<contents><target name="magecommunity"><dir name="TGM"><dir name="Voodoo"><dir name="Block"><dir name="Backend"><dir name="Page"><file name="Footer.php" hash="c7a672484710de89eb6af0524da0bf83"/><file name="Header.php" hash="
|
| 41 |
<compatible/>
|
| 42 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 43 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>TGM_Voodoo_Ext</name>
|
| 4 |
+
<version>3.1.2</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 35 |
Release Stability: 'Stable'</description>
|
| 36 |
<notes>Release Notes</notes>
|
| 37 |
<authors><author><name>Top Gear Media</name><user>bulksms</user><email>team@voodoosms.com</email></author></authors>
|
| 38 |
+
<date>2015-11-02</date>
|
| 39 |
+
<time>14:23:04</time>
|
| 40 |
+
<contents><target name="magecommunity"><dir name="TGM"><dir name="Voodoo"><dir name="Block"><dir name="Backend"><dir name="Page"><file name="Footer.php" hash="c7a672484710de89eb6af0524da0bf83"/><file name="Header.php" hash="16937e5f9deaecb5f3633bdf28675868"/></dir></dir><file name="Credits-bkp.php" hash="f4473f43731901738a4cf079b2338e18"/><file name="Credits.php" hash="985372b01f30961fda66cc3ee97c5fe6"/><file name="GrabAccount.php" hash="3cd93790751c055d2bbb3a8498f25671"/><file name="GrabApiAccount.php" hash="79850ed22302447ac5e3a4ca905a1f55"/><dir name="Onepage"><file name="Voodoo.php" hash="ca6d6eda73e578cea49cad753d744b87"/></dir><file name="Onepage.php" hash="560f9c37ffeca7dc245df0b2b231d244"/><file name="OtherVerifications.php" hash="5ac53ed1f31324f79181baf3287341a0"/><file name="VerifyApiAccount.php" hash="24cbec5d74d126a210af1d48e28a6262"/></dir><dir name="Controller"><file name="Observer.php" hash="af5b01bd3e7b91f5aafc87a44dc1b556"/></dir><dir name="Helper"><file name="Data-bkp.php" hash="744c9e5c5cc5eba38328b86cc06d1372"/><file name="Data.php" hash="79fd7a0cb9d8b2bcb4f3ebf24407eaf6"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Color.php" hash="b12a5cf4996438b331abcf6f48676bd2"/></dir></dir></dir></dir><dir name="Mysql4"><dir name="Mysql4"><dir name="Voodoo"><file name="Collection.php" hash="c97ac45e6c51ddb7ce3349561a542561"/></dir><file name="Voodoo.php" hash="a4bf4656536e83dfc07557b7748a6a42"/></dir><dir name="Voodoo"><file name="Collection.php" hash="c97ac45e6c51ddb7ce3349561a542561"/></dir><file name="Voodoo.php" hash="a4bf4656536e83dfc07557b7748a6a42"/></dir><file name="Observer-bkp-6-10-2015.php" hash="2c957637195ab779f961e42441c584a0"/><file name="Observer.php" hash="2e777d3efc9676523b7f0e27de7572f8"/><dir name="Type"><file name="Onepage.php" hash="769b2910e6d213436ed04f137b0ca184"/></dir><file name="Voodoo.php" hash="c5772968994ecbfe0390ba858a393fdb"/></dir><dir name="controllers"><file name="IndexController.php" hash="50654ac2e787445270ca5a9500534814"/><file name="OnepageController.php" hash="4459c3a29d24637a568bde83026de2be"/></dir><dir name="etc"><file name="config.xml" hash="114d6b9df5a749e70b682b7f7762fb15"/><file name="system.xml" hash="0440e4acf86149d319bd333e44018ebb"/></dir><dir name="sql"><dir name="voodoo_setup"><file name="mysql4-install-1.0.0.php" hash="965a0814ade0be43ad933128c27cdeef"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="voodoo.xml" hash="5b102f6937a94a51d7e6a474ab4715a3"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="voodoo.xml" hash="17ac416a0d16865420344d50dbce154b"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TGM_Voodoo.xml" hash="70457ac3df296584ccdf008d46226653"/></dir></target><target name="magelocale"><dir name="en_US"><file name="TGM_Voodoo.csv" hash="70e4f1215f0542fce3651720c32ce67a"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="magepal.png" hash="abca7476c80b078964c0a08fd736dc8a"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="checkout"><dir name="onepage"><file name="voodoo.phtml" hash=""/></dir></dir></dir></dir></dir></dir></target></contents>
|
| 41 |
<compatible/>
|
| 42 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 43 |
</package>
|
skin/adminhtml/default/default/images/magepal.png
CHANGED
|
Binary file
|
