Version Notes
Changes in OPT-In template and layout
moved to voodoo sms new API
Option to select between billing number or shipping number to send SMS if OPT-IN in not selected
Download this release
Release Info
Developer | Top Gear Media |
Extension | TGM_Voodoo_Ext |
Version | 3.2.2 |
Comparing to | |
See all releases |
Code changes from version 3.1.2 to 3.2.2
- app/code/community/TGM/Voodoo/Block/Backend/Page/Header.php +1 -1
- app/code/community/TGM/Voodoo/Helper/Data-bkp.php +0 -324
- app/code/community/TGM/Voodoo/Model/Observer-bkp-6-10-2015.php +0 -427
- app/code/community/TGM/Voodoo/etc/config.xml +1 -1
- app/design/frontend/default/default/template/checkout/onepage/voodoo.phtml +109 -0
- package.xml +7 -5
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 v3.
|
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.2.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/Helper/Data-bkp.php
DELETED
@@ -1,324 +0,0 @@
|
|
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/Model/Observer-bkp-6-10-2015.php
DELETED
@@ -1,427 +0,0 @@
|
|
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/etc/config.xml
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
<config>
|
11 |
<modules>
|
12 |
<TGM_Voodoo>
|
13 |
-
<version>3.
|
14 |
</TGM_Voodoo>
|
15 |
</modules>
|
16 |
<admin>
|
10 |
<config>
|
11 |
<modules>
|
12 |
<TGM_Voodoo>
|
13 |
+
<version>3.2.2</version>
|
14 |
</TGM_Voodoo>
|
15 |
</modules>
|
16 |
<admin>
|
app/design/frontend/default/default/template/checkout/onepage/voodoo.phtml
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<form id="co-voodoo-form" action="">
|
2 |
+
<?php
|
3 |
+
if (Mage::getStoreConfig('voodoo/optins/enabled') == 1) {
|
4 |
+
?>
|
5 |
+
<div class="field name-optin">
|
6 |
+
<label for="getvoice">
|
7 |
+
To receive an SMS notification for delivery status please enter the mobile number
|
8 |
+
here</label>
|
9 |
+
<div class="input-box">
|
10 |
+
<input type="tel" title="Mobile Number" class="input-text" name="getvoice" id="getvoice"
|
11 |
+
placeholder="Enter Number">
|
12 |
+
|
13 |
+
</div>
|
14 |
+
</div>
|
15 |
+
<?php }
|
16 |
+
else{
|
17 |
+
?>
|
18 |
+
<p>You will get an order confirmation sms on the <?php if(Mage::getStoreConfig('voodoo/deno/bish') == 0){ ?>Billing <?php }else{ ?>Shipping<?php } ?> number provided by you</p>
|
19 |
+
<?php
|
20 |
+
} ?>
|
21 |
+
</form>
|
22 |
+
|
23 |
+
<div class="buttons-set" style="">
|
24 |
+
<div id="voodoo-buttons-container">
|
25 |
+
<button type="button" class="button" onclick="voodoo.save();"><span><?php echo $this->__('Continue') ?></span>
|
26 |
+
</button>
|
27 |
+
<span id="voodoo-please-wait" style="display:none;" class="opc-please-wait">
|
28 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" class="v-middle"
|
29 |
+
alt=""/> <?php echo $this->__('Loading next step...') ?>
|
30 |
+
</span>
|
31 |
+
</div>
|
32 |
+
</div>
|
33 |
+
|
34 |
+
<script type="text/javascript">
|
35 |
+
//<![CDATA[
|
36 |
+
|
37 |
+
var Voodoo = Class.create();
|
38 |
+
Voodoo.prototype = {
|
39 |
+
initialize: function (form, saveUrl) {
|
40 |
+
this.form = form;
|
41 |
+
if ($(this.form)) {
|
42 |
+
$(this.form).observe('submit', function (event) {
|
43 |
+
this.save();
|
44 |
+
Event.stop(event);
|
45 |
+
}.bind(this));
|
46 |
+
}
|
47 |
+
this.saveUrl = saveUrl;
|
48 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
49 |
+
this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
|
50 |
+
},
|
51 |
+
|
52 |
+
save: function () {
|
53 |
+
if (checkout.loadWaiting != false) return;
|
54 |
+
|
55 |
+
var validator = new Validation(this.form);
|
56 |
+
if (validator.validate()) {
|
57 |
+
|
58 |
+
checkout.setLoadWaiting('voodoo');
|
59 |
+
|
60 |
+
|
61 |
+
var request = new Ajax.Request(
|
62 |
+
this.saveUrl,
|
63 |
+
{
|
64 |
+
method: 'post',
|
65 |
+
onComplete: this.onComplete,
|
66 |
+
onSuccess: this.onSave,
|
67 |
+
onFailure: checkout.ajaxFailure.bind(checkout),
|
68 |
+
parameters: Form.serialize(this.form)
|
69 |
+
}
|
70 |
+
);
|
71 |
+
}
|
72 |
+
},
|
73 |
+
|
74 |
+
resetLoadWaiting: function (transport) {
|
75 |
+
checkout.setLoadWaiting(false);
|
76 |
+
},
|
77 |
+
|
78 |
+
nextStep: function (transport) {
|
79 |
+
if (transport && transport.responseText) {
|
80 |
+
try {
|
81 |
+
response = eval('(' + transport.responseText + ')');
|
82 |
+
}
|
83 |
+
catch (e) {
|
84 |
+
response = {};
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
if (response.error) {
|
89 |
+
if ((typeof response.message) == 'string') {
|
90 |
+
alert(response.message);
|
91 |
+
} else {
|
92 |
+
if (window.billingRegionUpdater) {
|
93 |
+
billingRegionUpdater.update();
|
94 |
+
}
|
95 |
+
|
96 |
+
alert(response.message.join("\n"));
|
97 |
+
}
|
98 |
+
|
99 |
+
return false;
|
100 |
+
}
|
101 |
+
|
102 |
+
checkout.setStepResponse(response);
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
var voodoo = new Voodoo('co-voodoo-form', '<?php echo $this->getUrl('checkout/onepage/saveVoodoo') ?>');
|
107 |
+
|
108 |
+
//]]>
|
109 |
+
</script>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>TGM_Voodoo_Ext</name>
|
4 |
-
<version>3.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -33,11 +33,13 @@ select which versions it works with? (hopefully 1.5.0.0 & later?)
|
|
33 |
Licence type: ‘OSL’
|
34 |
Release Version: ‘1.0.0'
|
35 |
Release Stability: 'Stable'</description>
|
36 |
-
<notes>
|
|
|
|
|
37 |
<authors><author><name>Top Gear Media</name><user>bulksms</user><email>team@voodoosms.com</email></author></authors>
|
38 |
-
<date>2015-11-
|
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.2.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>
|
33 |
Licence type: ‘OSL’
|
34 |
Release Version: ‘1.0.0'
|
35 |
Release Stability: 'Stable'</description>
|
36 |
+
<notes>Changes in OPT-In template and layout
|
37 |
+
moved to voodoo sms new API
|
38 |
+
Option to select between billing number or shipping number to send SMS if OPT-IN in not selected</notes>
|
39 |
<authors><author><name>Top Gear Media</name><user>bulksms</user><email>team@voodoosms.com</email></author></authors>
|
40 |
+
<date>2015-11-03</date>
|
41 |
+
<time>11:31:13</time>
|
42 |
+
<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="e8b0815fbf42d2fa46e4a189ec9ef9b2"/></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.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.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="a3bde2945c9e3dbe38cee28ac964a2f2"/><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 name="template"><dir name="checkout"><dir name="onepage"><file name="voodoo.phtml" hash="d692466cb7b1e8e3a1873bf766fe4701"/></dir></dir></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></contents>
|
43 |
<compatible/>
|
44 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
45 |
</package>
|