Version Notes
Release Notes
Download this release
Release Info
Developer | Top Gear Media |
Extension | TGM_Voodoo_Ext |
Version | 2.3.7 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 2.3.7
- app/code/community/TGM/Voodoo/Block/Backend/Page/Header.php +2 -2
- app/code/community/TGM/Voodoo/Block/Onepage.php +20 -0
- app/code/community/TGM/Voodoo/Block/Onepage/Voodoo.php +14 -0
- app/code/community/TGM/Voodoo/Controller/Observer.php +12 -0
- app/code/community/TGM/Voodoo/Helper/Data-test.php +0 -195
- app/code/community/TGM/Voodoo/Helper/Data.php +43 -3
- app/code/community/TGM/Voodoo/Model/Adminhtml/System/Config/Source/Color.php +15 -0
- app/code/community/TGM/Voodoo/Model/Observer.php +339 -239
- app/code/community/TGM/Voodoo/Model/Observerrrr.php +0 -327
- app/code/community/TGM/Voodoo/Model/Type/Onepage.php +34 -0
- app/code/community/TGM/Voodoo/Model/Voodoo.php +2 -2
- app/code/community/TGM/Voodoo/controllers/OnepageController.php +86 -0
- app/code/community/TGM/Voodoo/etc/config.xml +82 -2
- app/code/community/TGM/Voodoo/etc/system.xml +67 -6
- app/code/community/TGM/Voodoo/sql/voodoo_setup/mysql4-install-1.0.0.php +24 -1
- app/design/adminhtml/default/default/layout/voodoo.xml +7 -7
- app/etc/modules/TGM_Voodoo.xml +1 -8
- package.xml +4 -4
app/code/community/TGM/Voodoo/Block/Backend/Page/Header.php
CHANGED
@@ -13,10 +13,10 @@ class TGM_Voodoo_Block_Backend_Page_Header
|
|
13 |
public function render(Varien_Data_Form_Element_Abstract $element)
|
14 |
{
|
15 |
$html = '<div style="background:#EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:20px 15px 15px; border-radius: 5px;">
|
16 |
-
<img src="'.$this->getSkinUrl().'
|
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>
|
13 |
public function render(Varien_Data_Form_Element_Abstract $element)
|
14 |
{
|
15 |
$html = '<div style="background:#EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:20px 15px 15px; border-radius: 5px;">
|
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 v2.3.7 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/Onepage.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class TGM_Voodoo_Block_Onepage extends Mage_Checkout_Block_Onepage
|
3 |
+
{
|
4 |
+
public function getSteps()
|
5 |
+
{
|
6 |
+
$steps = array();
|
7 |
+
|
8 |
+
if (!$this->isCustomerLoggedIn()) {
|
9 |
+
$steps['login'] = $this->getCheckout()->getStepData('login');
|
10 |
+
}
|
11 |
+
|
12 |
+
$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'voodoo', 'review');
|
13 |
+
|
14 |
+
foreach ($stepCodes as $step) {
|
15 |
+
$steps[$step] = $this->getCheckout()->getStepData($step);
|
16 |
+
}
|
17 |
+
|
18 |
+
return $steps;
|
19 |
+
}
|
20 |
+
}
|
app/code/community/TGM/Voodoo/Block/Onepage/Voodoo.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TGM_Voodoo_Block_Onepage_Voodoo extends Mage_Checkout_Block_Onepage_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->getCheckout()->setStepData('voodoo', array(
|
8 |
+
'label' => Mage::helper('checkout')->__('SMS Notifications'),
|
9 |
+
'is_show' => true
|
10 |
+
));
|
11 |
+
|
12 |
+
parent::_construct();
|
13 |
+
}
|
14 |
+
}
|
app/code/community/TGM/Voodoo/Controller/Observer.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class TGM_Voodoo_Controller_Observer
|
4 |
+
{
|
5 |
+
//Event: adminhtml_controller_action_predispatch_start
|
6 |
+
public function overrideTheme()
|
7 |
+
{
|
8 |
+
|
9 |
+
Mage::getDesign()->setArea('adminhtml')
|
10 |
+
->setTheme((string)Mage::getStoreConfig('design/admin/theme'));
|
11 |
+
}
|
12 |
+
}
|
app/code/community/TGM/Voodoo/Helper/Data-test.php
DELETED
@@ -1,195 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class TGM_Voodoo_Helper_Dataaa extends Mage_Core_Helper_Abstract
|
3 |
-
{
|
4 |
-
|
5 |
-
const EXT_PATH = 'voodoo/';
|
6 |
-
|
7 |
-
public function isEnabled($case){
|
8 |
-
switch($case){
|
9 |
-
case 1:
|
10 |
-
return Mage::getStoreConfig(self::EXT_PATH.'orders/enabled');
|
11 |
-
break;
|
12 |
-
case 2:
|
13 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_hold/enabled');
|
14 |
-
break;
|
15 |
-
case 3:
|
16 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_unhold/enabled');
|
17 |
-
break;
|
18 |
-
case 4:
|
19 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_cancelled/enabled');
|
20 |
-
break;
|
21 |
-
case 5:
|
22 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_shipment/enabled');
|
23 |
-
break;
|
24 |
-
}
|
25 |
-
}
|
26 |
-
|
27 |
-
public function getUsername()
|
28 |
-
{
|
29 |
-
return Mage::getStoreConfig(self::EXT_PATH.'enter/username');
|
30 |
-
}
|
31 |
-
|
32 |
-
public function getPassword()
|
33 |
-
{
|
34 |
-
return Mage::getStoreConfig(self::EXT_PATH.'enter/password');
|
35 |
-
}
|
36 |
-
|
37 |
-
public function getSender($case)
|
38 |
-
{
|
39 |
-
switch($case){
|
40 |
-
case 1:
|
41 |
-
return Mage::getStoreConfig(self::EXT_PATH.'orders/sender');
|
42 |
-
break;
|
43 |
-
case 2:
|
44 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_hold/sender');
|
45 |
-
break;
|
46 |
-
case 3:
|
47 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_unhold/sender');
|
48 |
-
break;
|
49 |
-
case 4:
|
50 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_cancelled/sender');
|
51 |
-
break;
|
52 |
-
case 5:
|
53 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_shipment/sender');
|
54 |
-
break;
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
public function getMessage(Mage_Sales_Model_Order $order,$case)
|
59 |
-
{
|
60 |
-
$billingAddress = $order->getBillingAddress();
|
61 |
-
$codes = array('{{firstname}}','{{middlename}}','{{lastname}}','{{fax}}','{{postal}}','{{city}}','{{email}}','{{order_id}}');
|
62 |
-
$accurate = array($billingAddress->getFirstname(),
|
63 |
-
$billingAddress->getMiddlename(),
|
64 |
-
$billingAddress->getLastname(),
|
65 |
-
$billingAddress->getFax(),
|
66 |
-
$billingAddress->getPostcode(),
|
67 |
-
$billingAddress->getCity(),
|
68 |
-
$billingAddress->getEmail(),
|
69 |
-
$order->getIncrementId()
|
70 |
-
);
|
71 |
-
|
72 |
-
switch($case){
|
73 |
-
case 1:
|
74 |
-
return str_replace($codes,$accurate,Mage::getStoreConfig(self::EXT_PATH.'orders/message'));
|
75 |
-
break;
|
76 |
-
case 2:
|
77 |
-
return str_replace($codes,$accurate,Mage::getStoreConfig(self::EXT_PATH.'order_hold/message'));
|
78 |
-
break;
|
79 |
-
case 3:
|
80 |
-
return str_replace($codes,$accurate,Mage::getStoreConfig(self::EXT_PATH.'order_unhold/message'));
|
81 |
-
break;
|
82 |
-
case 4:
|
83 |
-
return str_replace($codes,$accurate,Mage::getStoreConfig(self::EXT_PATH.'order_cancelled/message'));
|
84 |
-
break;
|
85 |
-
case 5:
|
86 |
-
return str_replace($codes,$accurate,Mage::getStoreConfig(self::EXT_PATH.'order_shipment/message'));
|
87 |
-
break;
|
88 |
-
}
|
89 |
-
}
|
90 |
-
public function getDestination(Mage_Sales_Model_Order $order)
|
91 |
-
{
|
92 |
-
$billingAddress = $order->getBillingAddress();
|
93 |
-
$number = $billingAddress->getTelephone();
|
94 |
-
return $number;
|
95 |
-
}
|
96 |
-
|
97 |
-
public function isNotifyEnabled($case){
|
98 |
-
switch($case){
|
99 |
-
case 1:
|
100 |
-
return Mage::getStoreConfig(self::EXT_PATH.'orders/notify');
|
101 |
-
break;
|
102 |
-
case 2:
|
103 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_hold/notify');
|
104 |
-
break;
|
105 |
-
case 3:
|
106 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_unhold/notify');
|
107 |
-
break;
|
108 |
-
case 4:
|
109 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_cancelled/notify');
|
110 |
-
break;
|
111 |
-
case 5:
|
112 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_shipment/notify');
|
113 |
-
break;
|
114 |
-
}
|
115 |
-
}
|
116 |
-
|
117 |
-
public function getAdminDestination($case){
|
118 |
-
switch($case){
|
119 |
-
case 1:
|
120 |
-
return Mage::getStoreConfig(self::EXT_PATH.'orders/receiver');
|
121 |
-
break;
|
122 |
-
case 2:
|
123 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_hold/receiver');
|
124 |
-
break;
|
125 |
-
case 3:
|
126 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_unhold/receiver');
|
127 |
-
break;
|
128 |
-
case 4:
|
129 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_cancelled/receiver');
|
130 |
-
break;
|
131 |
-
case 5:
|
132 |
-
return Mage::getStoreConfig(self::EXT_PATH.'order_shipment/receiver');
|
133 |
-
break;
|
134 |
-
}
|
135 |
-
}
|
136 |
-
|
137 |
-
public function voodoo($url) {
|
138 |
-
try {
|
139 |
-
$smsSent = $this->file_get_contents_curl($url);
|
140 |
-
}
|
141 |
-
catch(Exception $e) {
|
142 |
-
$smsSent = '';
|
143 |
-
}
|
144 |
-
if($smsSent) {
|
145 |
-
switch($smsSent) {
|
146 |
-
case '401: Unauthorized':
|
147 |
-
$status_message = Mage::helper('voodoo')->__('Voodoo Username or password incorrect (UNAUTHORIZED).');
|
148 |
-
$status = Mage::helper('voodoo')->__('Not sent');
|
149 |
-
break;
|
150 |
-
case '403: Forbidden':
|
151 |
-
$status_message = Mage::helper('voodoo')->__('Wrong Number Inserted (FORBIDDEN).');
|
152 |
-
$status = Mage::helper('voodoo')->__('Not sent');
|
153 |
-
break;
|
154 |
-
case '400: Bad request':
|
155 |
-
$status_message = Mage::helper('voodoo')->__('There might be something wrong happened (BAD REQUEST).');
|
156 |
-
$status = Mage::helper('voodoo')->__('Not sent');
|
157 |
-
break;
|
158 |
-
case '402: Not enough credit':
|
159 |
-
$status_message = Mage::helper('voodoo')->__('Insufficient Credit to send (NOT ENOUGH CREDIT).');
|
160 |
-
$status = Mage::helper('voodoo')->__('Not sent');
|
161 |
-
break;
|
162 |
-
case '513: Message too Large':
|
163 |
-
$status_message = Mage::helper('voodoo')->__('Too long message to send (LARGE MESSAGE).');
|
164 |
-
$status = Mage::helper('voodoo')->__('Not sent');
|
165 |
-
break;
|
166 |
-
default:
|
167 |
-
$status_message = Mage::helper('voodoo')->__('Sms successfully sent.');
|
168 |
-
$status = Mage::helper('voodoo')->__('Sent');
|
169 |
-
break;
|
170 |
-
}
|
171 |
-
}
|
172 |
-
else {
|
173 |
-
$status_message = Mage::helper('voodoo')->__('Not able to send the sms. Please contact the developer.');
|
174 |
-
$status = 'Not sent';
|
175 |
-
}
|
176 |
-
$ret['status_message'] = $status_message;
|
177 |
-
$ret['status'] = $status;
|
178 |
-
return $ret;
|
179 |
-
}
|
180 |
-
|
181 |
-
public function file_get_contents_curl($url) {
|
182 |
-
$ch = curl_init();
|
183 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
184 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
185 |
-
curl_setopt($ch, CURLOPT_URL, $url);
|
186 |
-
$data = curl_exec($ch);
|
187 |
-
curl_close($ch);
|
188 |
-
return $data;
|
189 |
-
}
|
190 |
-
public function credits($url){
|
191 |
-
$credits = $this->file_get_contents_curl($url);
|
192 |
-
return $credits;
|
193 |
-
}
|
194 |
-
|
195 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/TGM/Voodoo/Helper/Data.php
CHANGED
@@ -9,6 +9,14 @@ class TGM_Voodoo_Helper_Data extends Mage_Core_Helper_Abstract
|
|
9 |
return Mage::getStoreConfig(self::CONFIG_PATH.'orders/enabled');
|
10 |
}
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
public function isOrderHoldEnabled()
|
13 |
{
|
14 |
return Mage::getStoreConfig(self::CONFIG_PATH.'order_hold/enabled');
|
@@ -135,7 +143,16 @@ class TGM_Voodoo_Helper_Data extends Mage_Core_Helper_Abstract
|
|
135 |
public function getMessageForShipment(Mage_Sales_Model_Order $order)
|
136 |
{
|
137 |
$billingAddress = $order->getBillingAddress();
|
138 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
$accurate = array($billingAddress->getFirstname(),
|
140 |
$billingAddress->getMiddlename(),
|
141 |
$billingAddress->getLastname(),
|
@@ -143,9 +160,9 @@ class TGM_Voodoo_Helper_Data extends Mage_Core_Helper_Abstract
|
|
143 |
$billingAddress->getPostcode(),
|
144 |
$billingAddress->getCity(),
|
145 |
$billingAddress->getEmail(),
|
146 |
-
$order->getIncrementId()
|
|
|
147 |
);
|
148 |
-
|
149 |
return str_replace($codes,$accurate,Mage::getStoreConfig(self::CONFIG_PATH.'shipments/message'));
|
150 |
}
|
151 |
|
@@ -281,4 +298,27 @@ class TGM_Voodoo_Helper_Data extends Mage_Core_Helper_Abstract
|
|
281 |
$verify_others = $this->file_get_contents_curl($url);
|
282 |
return $verify_others;
|
283 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
}
|
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');
|
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(),
|
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 |
|
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/Adminhtml/System/Config/Source/Color.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class TGM_Voodoo_Model_Adminhtml_System_Config_Source_Color
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
$themes = array(
|
7 |
+
array('value' => 0, 'label' => 'Billing'),
|
8 |
+
array('value' => 1, 'label' => 'Shipping'),
|
9 |
+
);
|
10 |
+
|
11 |
+
return $themes;
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
?>
|
app/code/community/TGM/Voodoo/Model/Observer.php
CHANGED
@@ -1,115 +1,64 @@
|
|
1 |
<?php
|
2 |
class TGM_Voodoo_Model_Observer
|
3 |
{
|
4 |
-
|
5 |
-
{
|
6 |
-
if($this->getHelper()->isOrdersEnabled()) {
|
7 |
-
$orders = $observer->getEvent()->getOrderIds();
|
8 |
-
$order = Mage::getModel('sales/order')->load($orders['0']);
|
9 |
-
if ($order instanceof Mage_Sales_Model_Order) {
|
10 |
-
$host = "http://www.voodoosms.com/";
|
11 |
-
$path = "vsapi/server.php";
|
12 |
-
$username = $this->getHelper()->getUsername();
|
13 |
-
$password = $this->getHelper()->getPassword();;
|
14 |
-
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
15 |
-
$smsfrom = $this->getHelper()->getSender();;
|
16 |
-
$smsmsg = $this->getHelper()->getMessage($order);;
|
17 |
-
$data = '?method=sendSMS';
|
18 |
-
$data .= '&username=' . urlencode($username);
|
19 |
-
$data .= '&password=' . urlencode($password);
|
20 |
-
$data .= '&destination=' . urlencode($smsto);
|
21 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
22 |
-
$data .= '&message=' . urlencode($smsmsg);
|
23 |
-
$data .= '&validity=300';
|
24 |
-
$url = $host.$path.$data;
|
25 |
-
$sendSms = $this->getHelper()->voodoo($url);
|
26 |
-
try {
|
27 |
-
Mage::getModel('voodoo/voodoo')
|
28 |
-
->setOrderId($order->getIncrementId())
|
29 |
-
->setFrom($smsfrom)
|
30 |
-
->setTo($smsto)
|
31 |
-
->setSmsMessage($smsmsg)
|
32 |
-
->setStatus($sendSms['status'])
|
33 |
-
->setStatusMessage($sendSms['status_message'])
|
34 |
-
->setCreatedTime(now())
|
35 |
-
->save();
|
36 |
-
}
|
37 |
-
catch (Exception $e) {}
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
$
|
47 |
-
|
48 |
-
$
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
->setTo($smsto)
|
56 |
-
->setSmsMessage($smsmsg)
|
57 |
-
->setStatus($sendSms['status'])
|
58 |
-
->setStatusMessage($sendSms['status_message'])
|
59 |
-
->setCreatedTime(now())
|
60 |
-
->save();
|
61 |
-
}
|
62 |
-
catch (Exception $e) {}
|
63 |
-
}
|
64 |
-
}
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
public function sendSmsOnOrderHold(Varien_Event_Observer $observer)
|
69 |
-
{
|
70 |
-
if($this->getHelper()->isOrderHoldEnabled()) {
|
71 |
-
$order = $observer->getOrder();
|
72 |
-
if ($order instanceof Mage_Sales_Model_Order) {
|
73 |
-
if ($order->getState() !== $order->getOrigData('state') && $order->getState() === Mage_Sales_Model_Order::STATE_HOLDED) {
|
74 |
$host = "http://www.voodoosms.com/";
|
75 |
$path = "vsapi/server.php";
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
$data
|
82 |
-
$data .= '&username=' . urlencode($username);
|
83 |
$data .= '&password=' . urlencode($password);
|
84 |
$data .= '&destination=' . urlencode($smsto);
|
85 |
$data .= '&originator=' . urlencode($smsfrom);
|
86 |
$data .= '&message=' . urlencode($smsmsg);
|
87 |
$data .= '&validity=300';
|
88 |
-
$url = $host
|
|
|
89 |
$sendSms = $this->getHelper()->voodoo($url);
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
$
|
105 |
-
$
|
106 |
-
$data
|
|
|
107 |
$data .= '&password=' . urlencode($password);
|
108 |
$data .= '&destination=' . urlencode($smsto);
|
109 |
$data .= '&originator=' . urlencode($smsfrom);
|
110 |
$data .= '&message=' . urlencode($smsmsg);
|
111 |
$data .= '&validity=300';
|
112 |
-
$url = $host
|
113 |
$sendSms = $this->getHelper()->voodoo($url);
|
114 |
try {
|
115 |
Mage::getModel('voodoo/voodoo')
|
@@ -121,59 +70,44 @@ class TGM_Voodoo_Model_Observer
|
|
121 |
->setStatusMessage($sendSms['status_message'])
|
122 |
->setCreatedTime(now())
|
123 |
->save();
|
|
|
124 |
}
|
125 |
-
catch (Exception $e) {}
|
126 |
}
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
$
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
->setOrderId($order->getIncrementId())
|
157 |
-
->setFrom($smsfrom)
|
158 |
-
->setTo($smsto)
|
159 |
-
->setSmsMessage($smsmsg)
|
160 |
-
->setStatus($sendSms['status'])
|
161 |
-
->setStatusMessage($sendSms['status_message'])
|
162 |
-
->setCreatedTime(now())
|
163 |
-
->save();
|
164 |
-
}
|
165 |
-
catch (Exception $e) {}
|
166 |
-
if($this->getHelper()->isOrdersUnholdNotify() and $this->getHelper()->getAdminUnholdTelephone()) {
|
167 |
-
$smsto = $this->getHelper()->getAdminUnholdTelephone();
|
168 |
-
$smsmsg = Mage::helper('voodoo')->__('%s has been placed on unhold',$order->getIncrementId());
|
169 |
-
$data = '?method=sendSMS';
|
170 |
-
$data .= '&username=' . urlencode($username);
|
171 |
$data .= '&password=' . urlencode($password);
|
172 |
$data .= '&destination=' . urlencode($smsto);
|
173 |
$data .= '&originator=' . urlencode($smsfrom);
|
174 |
$data .= '&message=' . urlencode($smsmsg);
|
175 |
$data .= '&validity=300';
|
176 |
-
$url = $host
|
177 |
$sendSms = $this->getHelper()->voodoo($url);
|
178 |
try {
|
179 |
Mage::getModel('voodoo/voodoo')
|
@@ -185,59 +119,149 @@ class TGM_Voodoo_Model_Observer
|
|
185 |
->setStatusMessage($sendSms['status_message'])
|
186 |
->setCreatedTime(now())
|
187 |
->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
}
|
189 |
-
catch (Exception $e) {}
|
190 |
}
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
$
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
$
|
232 |
-
|
233 |
-
|
234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
$data .= '&password=' . urlencode($password);
|
236 |
$data .= '&destination=' . urlencode($smsto);
|
237 |
$data .= '&originator=' . urlencode($smsfrom);
|
238 |
$data .= '&message=' . urlencode($smsmsg);
|
239 |
$data .= '&validity=300';
|
240 |
-
$url = $host
|
241 |
$sendSms = $this->getHelper()->voodoo($url);
|
242 |
try {
|
243 |
Mage::getModel('voodoo/voodoo')
|
@@ -249,59 +273,72 @@ class TGM_Voodoo_Model_Observer
|
|
249 |
->setStatusMessage($sendSms['status_message'])
|
250 |
->setCreatedTime(now())
|
251 |
->save();
|
|
|
252 |
}
|
253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
}
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
if ($order instanceof Mage_Sales_Model_Order) {
|
266 |
-
$host = "http://www.voodoosms.com/";
|
267 |
-
$path = "vsapi/server.php";
|
268 |
-
$username = $this->getHelper()->getUsername();
|
269 |
-
$password = $this->getHelper()->getPassword();
|
270 |
-
$smsto = $this->getHelper()->getTelephoneFromOrder($order);
|
271 |
-
$smsfrom = $this->getHelper()->getSenderForShipment();
|
272 |
-
$smsmsg = $this->getHelper()->getMessageForShipment($order);
|
273 |
-
$data = '?method=sendSMS';
|
274 |
-
$data .= '&username=' . urlencode($username);
|
275 |
-
$data .= '&password=' . urlencode($password);
|
276 |
-
$data .= '&destination=' . urlencode($smsto);
|
277 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
278 |
-
$data .= '&message=' . urlencode($smsmsg);
|
279 |
-
$data .= '&validity=300';
|
280 |
-
$url = $host.$path.$data;
|
281 |
-
$sendSms = $this->getHelper()->voodoo($url);
|
282 |
-
try {
|
283 |
-
Mage::getModel('voodoo/voodoo')
|
284 |
-
->setOrderId($order->getIncrementId())
|
285 |
-
->setFrom($smsfrom)
|
286 |
-
->setTo($smsto)
|
287 |
-
->setSmsMessage($smsmsg)
|
288 |
-
->setStatus($sendSms['status'])
|
289 |
-
->setStatusMessage($sendSms['status_message'])
|
290 |
-
->setCreatedTime(now())
|
291 |
-
->save();
|
292 |
-
}
|
293 |
-
catch (Exception $e) {}
|
294 |
-
if($this->getHelper()->isOrdersShipmentsNotify() and $this->getHelper()->getAdminShipmentsTelephone()) {
|
295 |
-
$smsto = $this->getHelper()->getAdminTelephone();
|
296 |
-
$smsmsg = Mage::helper('voodoo')->__('%s is on shipment state',$order->getIncrementId());
|
297 |
-
$data = '?method=sendSMS';
|
298 |
-
$data .= '&username=' . urlencode($username);
|
299 |
$data .= '&password=' . urlencode($password);
|
300 |
$data .= '&destination=' . urlencode($smsto);
|
301 |
$data .= '&originator=' . urlencode($smsfrom);
|
302 |
$data .= '&message=' . urlencode($smsmsg);
|
303 |
$data .= '&validity=300';
|
304 |
-
$url = $host
|
|
|
|
|
305 |
$sendSms = $this->getHelper()->voodoo($url);
|
306 |
try {
|
307 |
Mage::getModel('voodoo/voodoo')
|
@@ -313,15 +350,78 @@ class TGM_Voodoo_Model_Observer
|
|
313 |
->setStatusMessage($sendSms['status_message'])
|
314 |
->setCreatedTime(now())
|
315 |
->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
}
|
317 |
-
catch (Exception $e) {}
|
318 |
}
|
319 |
-
}
|
320 |
-
}
|
321 |
-
}
|
322 |
|
323 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
{
|
325 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
}
|
327 |
}
|
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')
|
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')
|
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')
|
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')
|
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/Observerrrr.php
DELETED
@@ -1,327 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class TGM_Voodoo_Model_Observerrrr
|
3 |
-
{
|
4 |
-
public function sendSmsOnOrderCreated(Varien_Event_Observer $observer)
|
5 |
-
{
|
6 |
-
if($this->getHelper()->isEnabled(1)) {
|
7 |
-
$orders = $observer->getEvent()->getOrderIds();
|
8 |
-
$order = Mage::getModel('sales/order')->load($orders['0']);
|
9 |
-
if ($order instanceof Mage_Sales_Model_Order) {
|
10 |
-
$host = "http://www.voodoosms.com/";
|
11 |
-
$path = "vsapi/server.php";
|
12 |
-
$username = $this->getHelper()->getUsername();
|
13 |
-
$password = $this->getHelper()->getPassword();
|
14 |
-
$smsto = $this->getHelper()->getDestination($order);
|
15 |
-
$smsfrom = $this->getHelper()->getSender(1);
|
16 |
-
$smsmsg = $this->getHelper()->getMessage($order,1);;
|
17 |
-
$data = '?method=sendSMS';
|
18 |
-
$data .= '&username=' . urlencode($username);
|
19 |
-
$data .= '&password=' . urlencode($password);
|
20 |
-
$data .= '&destination=' . urlencode($smsto);
|
21 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
22 |
-
$data .= '&message=' . urlencode($smsmsg);
|
23 |
-
$data .= '&validity=300';
|
24 |
-
$url = $host.$path.$data;
|
25 |
-
$sendSms = $this->getHelper()->voodoo($url);
|
26 |
-
try {
|
27 |
-
Mage::getModel('voodoo/voodoo')
|
28 |
-
->setOrderId($order->getIncrementId())
|
29 |
-
->setFrom($smsfrom)
|
30 |
-
->setTo($smsto)
|
31 |
-
->setSmsMessage($smsmsg)
|
32 |
-
->setStatus($sendSms['status'])
|
33 |
-
->setStatusMessage($sendSms['status_message'])
|
34 |
-
->setCreatedTime(now())
|
35 |
-
->save();
|
36 |
-
}
|
37 |
-
catch (Exception $e) {}
|
38 |
-
|
39 |
-
if($this->getHelper()->isNotifyEnabled(1) and $this->getHelper()->getAdminDestination(1)) {
|
40 |
-
$smsto = $this->getHelper()->getAdminDestination(1);
|
41 |
-
$smsmsg = Mage::helper('voodoo')->__('A new order has been placed: %s',$order->getIncrementId());
|
42 |
-
$data = '?method=sendSMS';
|
43 |
-
$data .= '&username=' . urlencode($username);
|
44 |
-
$data .= '&password=' . urlencode($password);
|
45 |
-
$data .= '&destination=' . urlencode($smsto);
|
46 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
47 |
-
$data .= '&message=' . urlencode($smsmsg);
|
48 |
-
$data .= '&validity=300';
|
49 |
-
$url = $host.$path.$data;
|
50 |
-
$sendSms = $this->getHelper()->voodoo($url);
|
51 |
-
try {
|
52 |
-
Mage::getModel('voodoo/voodoo')
|
53 |
-
->setOrderId($order->getIncrementId())
|
54 |
-
->setFrom($smsfrom)
|
55 |
-
->setTo($smsto)
|
56 |
-
->setSmsMessage($smsmsg)
|
57 |
-
->setStatus($sendSms['status'])
|
58 |
-
->setStatusMessage($sendSms['status_message'])
|
59 |
-
->setCreatedTime(now())
|
60 |
-
->save();
|
61 |
-
}
|
62 |
-
catch (Exception $e) {}
|
63 |
-
}
|
64 |
-
}
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
public function sendSmsOnOrderHold(Varien_Event_Observer $observer)
|
69 |
-
{
|
70 |
-
if($this->getHelper()->isEnabled(2)) {
|
71 |
-
$order = $observer->getOrder();
|
72 |
-
if ($order instanceof Mage_Sales_Model_Order) {
|
73 |
-
if ($order->getState() !== $order->getOrigData('state') && $order->getState() === Mage_Sales_Model_Order::STATE_HOLDED) {
|
74 |
-
$host = "http://www.voodoosms.com/";
|
75 |
-
$path = "vsapi/server.php";
|
76 |
-
$username = $this->getHelper()->getUsername();
|
77 |
-
$password = $this->getHelper()->getPassword();;
|
78 |
-
$smsto = $this->getHelper()->getDestination($order);
|
79 |
-
$smsfrom = $this->getHelper()->getSender(2);
|
80 |
-
$smsmsg = $this->getHelper()->getMessage($order,2);
|
81 |
-
$data = '?method=sendSMS';
|
82 |
-
$data .= '&username=' . urlencode($username);
|
83 |
-
$data .= '&password=' . urlencode($password);
|
84 |
-
$data .= '&destination=' . urlencode($smsto);
|
85 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
86 |
-
$data .= '&message=' . urlencode($smsmsg);
|
87 |
-
$data .= '&validity=300';
|
88 |
-
$url = $host.$path.$data;
|
89 |
-
$sendSms = $this->getHelper()->voodoo($url);
|
90 |
-
try {
|
91 |
-
Mage::getModel('voodoo/voodoo')
|
92 |
-
->setOrderId($order->getIncrementId())
|
93 |
-
->setFrom($smsfrom)
|
94 |
-
->setTo($smsto)
|
95 |
-
->setSmsMessage($smsmsg)
|
96 |
-
->setStatus($sendSms['status'])
|
97 |
-
->setStatusMessage($sendSms['status_message'])
|
98 |
-
->setCreatedTime(now())
|
99 |
-
->save();
|
100 |
-
}
|
101 |
-
catch (Exception $e) {}
|
102 |
-
if($this->getHelper()->isNotifyEnabled(2) and $this->getHelper()->getAdminDestination(2)) {
|
103 |
-
$smsto = $this->getHelper()->getAdminDestination(2);
|
104 |
-
$smsmsg = Mage::helper('voodoo')->__('%s has been placed on hold',$order->getIncrementId());
|
105 |
-
$data = '?method=sendSMS';
|
106 |
-
$data .= '&username=' . urlencode($username);
|
107 |
-
$data .= '&password=' . urlencode($password);
|
108 |
-
$data .= '&destination=' . urlencode($smsto);
|
109 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
110 |
-
$data .= '&message=' . urlencode($smsmsg);
|
111 |
-
$data .= '&validity=300';
|
112 |
-
$url = $host.$path.$data;
|
113 |
-
$sendSms = $this->getHelper()->voodoo($url);
|
114 |
-
try {
|
115 |
-
Mage::getModel('voodoo/voodoo')
|
116 |
-
->setOrderId($order->getIncrementId())
|
117 |
-
->setFrom($smsfrom)
|
118 |
-
->setTo($smsto)
|
119 |
-
->setSmsMessage($smsmsg)
|
120 |
-
->setStatus($sendSms['status'])
|
121 |
-
->setStatusMessage($sendSms['status_message'])
|
122 |
-
->setCreatedTime(now())
|
123 |
-
->save();
|
124 |
-
}
|
125 |
-
catch (Exception $e) {}
|
126 |
-
}
|
127 |
-
}
|
128 |
-
}
|
129 |
-
}
|
130 |
-
}
|
131 |
-
|
132 |
-
public function sendSmsOnOrderUnhold(Varien_Event_Observer $observer)
|
133 |
-
{
|
134 |
-
if($this->getHelper()->isEnabled(3)) {
|
135 |
-
$order = $observer->getOrder();
|
136 |
-
if ($order instanceof Mage_Sales_Model_Order) {
|
137 |
-
if ($order->getState() !== $order->getOrigData('state') && $order->getOrigData('state') === Mage_Sales_Model_Order::STATE_HOLDED) {
|
138 |
-
$host = "http://www.voodoosms.com/";
|
139 |
-
$path = "vsapi/server.php";
|
140 |
-
$username = $this->getHelper()->getUsername();
|
141 |
-
$password = $this->getHelper()->getPassword();;
|
142 |
-
$smsto = $this->getHelper()->getDestination($order);
|
143 |
-
$smsfrom = $this->getHelper()->getSender(3);
|
144 |
-
$smsmsg = $this->getHelper()->getMessage($order,3);
|
145 |
-
$data = '?method=sendSMS';
|
146 |
-
$data .= '&username=' . urlencode($username);
|
147 |
-
$data .= '&password=' . urlencode($password);
|
148 |
-
$data .= '&destination=' . urlencode($smsto);
|
149 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
150 |
-
$data .= '&message=' . urlencode($smsmsg);
|
151 |
-
$data .= '&validity=300';
|
152 |
-
$url = $host.$path.$data;
|
153 |
-
$sendSms = $this->getHelper()->voodoo($url);
|
154 |
-
try {
|
155 |
-
Mage::getModel('voodoo/voodoo')
|
156 |
-
->setOrderId($order->getIncrementId())
|
157 |
-
->setFrom($smsfrom)
|
158 |
-
->setTo($smsto)
|
159 |
-
->setSmsMessage($smsmsg)
|
160 |
-
->setStatus($sendSms['status'])
|
161 |
-
->setStatusMessage($sendSms['status_message'])
|
162 |
-
->setCreatedTime(now())
|
163 |
-
->save();
|
164 |
-
}
|
165 |
-
catch (Exception $e) {}
|
166 |
-
if($this->getHelper()->isNotifyEnabled(3) and $this->getHelper()->getAdminDestination(3)) {
|
167 |
-
$smsto = $this->getHelper()->getAdminDestination(3);
|
168 |
-
$smsmsg = Mage::helper('voodoo')->__('%s has been placed on unhold',$order->getIncrementId());
|
169 |
-
$data = '?method=sendSMS';
|
170 |
-
$data .= '&username=' . urlencode($username);
|
171 |
-
$data .= '&password=' . urlencode($password);
|
172 |
-
$data .= '&destination=' . urlencode($smsto);
|
173 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
174 |
-
$data .= '&message=' . urlencode($smsmsg);
|
175 |
-
$data .= '&validity=300';
|
176 |
-
$url = $host.$path.$data;
|
177 |
-
$sendSms = $this->getHelper()->voodoo($url);
|
178 |
-
try {
|
179 |
-
Mage::getModel('voodoo/voodoo')
|
180 |
-
->setOrderId($order->getIncrementId())
|
181 |
-
->setFrom($smsfrom)
|
182 |
-
->setTo($smsto)
|
183 |
-
->setSmsMessage($smsmsg)
|
184 |
-
->setStatus($sendSms['status'])
|
185 |
-
->setStatusMessage($sendSms['status_message'])
|
186 |
-
->setCreatedTime(now())
|
187 |
-
->save();
|
188 |
-
}
|
189 |
-
catch (Exception $e) {}
|
190 |
-
}
|
191 |
-
}
|
192 |
-
}
|
193 |
-
}
|
194 |
-
}
|
195 |
-
|
196 |
-
public function sendSmsOnOrderCanceled(Varien_Event_Observer $observer)
|
197 |
-
{
|
198 |
-
if($this->getHelper()->isEnabled(4)) {
|
199 |
-
$order = $observer->getOrder();
|
200 |
-
if ($order instanceof Mage_Sales_Model_Order) {
|
201 |
-
if ($order->getState() !== $order->getOrigData('state') && $order->getState() === Mage_Sales_Model_Order::STATE_CANCELED) {
|
202 |
-
$host = "http://www.voodoosms.com/";
|
203 |
-
$path = "vsapi/server.php";
|
204 |
-
$username = $this->getHelper()->getUsername();
|
205 |
-
$password = $this->getHelper()->getPassword();;
|
206 |
-
$smsto = $this->getHelper()->getDestination($order);
|
207 |
-
$smsfrom = $this->getHelper()->getSender(4);
|
208 |
-
$smsmsg = $this->getHelper()->getMessage($order,4);
|
209 |
-
$data = '?method=sendSMS';
|
210 |
-
$data .= '&username=' . urlencode($username);
|
211 |
-
$data .= '&password=' . urlencode($password);
|
212 |
-
$data .= '&destination=' . urlencode($smsto);
|
213 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
214 |
-
$data .= '&message=' . urlencode($smsmsg);
|
215 |
-
$data .= '&validity=300';
|
216 |
-
$url = $host.$path.$data;
|
217 |
-
$sendSms = $this->getHelper()->voodoo($url);
|
218 |
-
try {
|
219 |
-
Mage::getModel('voodoo/voodoo')
|
220 |
-
->setOrderId($order->getIncrementId())
|
221 |
-
->setFrom($smsfrom)
|
222 |
-
->setTo($smsto)
|
223 |
-
->setSmsMessage($smsmsg)
|
224 |
-
->setStatus($sendSms['status'])
|
225 |
-
->setStatusMessage($sendSms['status_message'])
|
226 |
-
->setCreatedTime(now())
|
227 |
-
->save();
|
228 |
-
}
|
229 |
-
catch (Exception $e) {}
|
230 |
-
if($this->getHelper()->isNotifyEnabled(4) and $this->getHelper()->getAdminDestination(4)) {
|
231 |
-
$smsto = $this->getHelper()->getAdminDestination(4);
|
232 |
-
$smsmsg = Mage::helper('voodoo')->__('%s has been placed cancelled',$order->getIncrementId());
|
233 |
-
$data = '?method=sendSMS';
|
234 |
-
$data .= '&username=' . urlencode($username);
|
235 |
-
$data .= '&password=' . urlencode($password);
|
236 |
-
$data .= '&destination=' . urlencode($smsto);
|
237 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
238 |
-
$data .= '&message=' . urlencode($smsmsg);
|
239 |
-
$data .= '&validity=300';
|
240 |
-
$url = $host.$path.$data;
|
241 |
-
$sendSms = $this->getHelper()->voodoo($url);
|
242 |
-
try {
|
243 |
-
Mage::getModel('voodoo/voodoo')
|
244 |
-
->setOrderId($order->getIncrementId())
|
245 |
-
->setFrom($smsfrom)
|
246 |
-
->setTo($smsto)
|
247 |
-
->setSmsMessage($smsmsg)
|
248 |
-
->setStatus($sendSms['status'])
|
249 |
-
->setStatusMessage($sendSms['status_message'])
|
250 |
-
->setCreatedTime(now())
|
251 |
-
->save();
|
252 |
-
}
|
253 |
-
catch (Exception $e) {}
|
254 |
-
}
|
255 |
-
}
|
256 |
-
}
|
257 |
-
}
|
258 |
-
}
|
259 |
-
|
260 |
-
public function sendSmsOnShipmentCreated(Varien_Event_Observer $observer)
|
261 |
-
{
|
262 |
-
if($this->getHelper()->isEnabled(5)) {
|
263 |
-
$shipment = $observer->getEvent()->getShipment();
|
264 |
-
$order = $shipment->getOrder();
|
265 |
-
if ($order instanceof Mage_Sales_Model_Order) {
|
266 |
-
$host = "http://www.voodoosms.com/";
|
267 |
-
$path = "vsapi/server.php";
|
268 |
-
$username = $this->getHelper()->getUsername();
|
269 |
-
$password = $this->getHelper()->getPassword();;
|
270 |
-
$smsto = $this->getHelper()->getDestination($order);
|
271 |
-
$smsfrom = $this->getHelper()->getSender(5);
|
272 |
-
$smsmsg = $this->getHelper()->getMessage($order,5);
|
273 |
-
$data = '?method=sendSMS';
|
274 |
-
$data .= '&username=' . urlencode($username);
|
275 |
-
$data .= '&password=' . urlencode($password);
|
276 |
-
$data .= '&destination=' . urlencode($smsto);
|
277 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
278 |
-
$data .= '&message=' . urlencode($smsmsg);
|
279 |
-
$data .= '&validity=300';
|
280 |
-
$url = $host.$path.$data;
|
281 |
-
$sendSms = $this->getHelper()->voodoo($url);
|
282 |
-
try {
|
283 |
-
Mage::getModel('voodoo/voodoo')
|
284 |
-
->setOrderId($order->getIncrementId())
|
285 |
-
->setFrom($smsfrom)
|
286 |
-
->setTo($smsto)
|
287 |
-
->setSmsMessage($smsmsg)
|
288 |
-
->setStatus($sendSms['status'])
|
289 |
-
->setStatusMessage($sendSms['status_message'])
|
290 |
-
->setCreatedTime(now())
|
291 |
-
->save();
|
292 |
-
}
|
293 |
-
catch (Exception $e) {}
|
294 |
-
if($this->getHelper()->isNotifyEnabled(5) and $this->getHelper()->getAdminDestination(5)) {
|
295 |
-
$smsto = $this->getHelper()->getAdminDestination(5);
|
296 |
-
$smsmsg = Mage::helper('voodoo')->__('%s is on shipment state',$order->getIncrementId());
|
297 |
-
$data = '?method=sendSMS';
|
298 |
-
$data .= '&username=' . urlencode($username);
|
299 |
-
$data .= '&password=' . urlencode($password);
|
300 |
-
$data .= '&destination=' . urlencode($smsto);
|
301 |
-
$data .= '&originator=' . urlencode($smsfrom);
|
302 |
-
$data .= '&message=' . urlencode($smsmsg);
|
303 |
-
$data .= '&validity=300';
|
304 |
-
$url = $host.$path.$data;
|
305 |
-
$sendSms = $this->getHelper()->voodoo($url);
|
306 |
-
try {
|
307 |
-
Mage::getModel('voodoo/voodoo')
|
308 |
-
->setOrderId($order->getIncrementId())
|
309 |
-
->setFrom($smsfrom)
|
310 |
-
->setTo($smsto)
|
311 |
-
->setSmsMessage($smsmsg)
|
312 |
-
->setStatus($sendSms['status'])
|
313 |
-
->setStatusMessage($sendSms['status_message'])
|
314 |
-
->setCreatedTime(now())
|
315 |
-
->save();
|
316 |
-
}
|
317 |
-
catch (Exception $e) {}
|
318 |
-
}
|
319 |
-
}
|
320 |
-
}
|
321 |
-
}
|
322 |
-
|
323 |
-
public function getHelper()
|
324 |
-
{
|
325 |
-
return Mage::helper('voodoo/Data');
|
326 |
-
}
|
327 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/TGM/Voodoo/Model/Type/Onepage.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class TGM_Voodoo_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage
|
5 |
+
{
|
6 |
+
public function initCheckout()
|
7 |
+
{
|
8 |
+
$checkout = $this->getCheckout();
|
9 |
+
if (is_array($checkout->getStepData())) {
|
10 |
+
foreach ($checkout->getStepData() as $step=>$data) {
|
11 |
+
if (!($step==='login'
|
12 |
+
|| Mage::getSingleton('customer/session')->isLoggedIn() && $step==='billing')) {
|
13 |
+
$checkout->setStepData($step, 'allow', false);
|
14 |
+
}
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
$checkout->setStepData('voodoo', 'allow', true);
|
19 |
+
|
20 |
+
/*
|
21 |
+
* want to laod the correct customer information by assiging to address
|
22 |
+
* instead of just loading from sales/quote_address
|
23 |
+
*/
|
24 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
25 |
+
if ($customer) {
|
26 |
+
$this->getQuote()->assignCustomer($customer);
|
27 |
+
}
|
28 |
+
if ($this->getQuote()->getIsMultiShipping()) {
|
29 |
+
$this->getQuote()->setIsMultiShipping(false);
|
30 |
+
$this->getQuote()->save();
|
31 |
+
}
|
32 |
+
return $this;
|
33 |
+
}
|
34 |
+
}
|
app/code/community/TGM/Voodoo/Model/Voodoo.php
CHANGED
@@ -66,7 +66,7 @@ class TGM_Voodoo_Model_Voodoo extends Mage_Core_Model_Abstract
|
|
66 |
return $verify_others;
|
67 |
}
|
68 |
|
69 |
-
|
70 |
{
|
71 |
$dirPath = Mage::getBaseDir('var') . DS . 'export';
|
72 |
|
@@ -81,6 +81,6 @@ class TGM_Voodoo_Model_Voodoo extends Mage_Core_Model_Abstract
|
|
81 |
|
82 |
return true;
|
83 |
}
|
84 |
-
|
85 |
|
86 |
}
|
66 |
return $verify_others;
|
67 |
}
|
68 |
|
69 |
+
public function exportOrder($order,$sendSms)
|
70 |
{
|
71 |
$dirPath = Mage::getBaseDir('var') . DS . 'export';
|
72 |
|
81 |
|
82 |
return true;
|
83 |
}
|
84 |
+
|
85 |
|
86 |
}
|
app/code/community/TGM/Voodoo/controllers/OnepageController.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once 'Mage/Checkout/controllers/OnepageController.php';
|
4 |
+
|
5 |
+
class TGM_Voodoo_OnepageController extends Mage_Checkout_OnepageController
|
6 |
+
{
|
7 |
+
public function doSomestuffAction()
|
8 |
+
{
|
9 |
+
if(true) {
|
10 |
+
$result['update_section'] = array(
|
11 |
+
'name' => 'payment-method',
|
12 |
+
'html' => $this->_getPaymentMethodsHtml()
|
13 |
+
);
|
14 |
+
}
|
15 |
+
else {
|
16 |
+
$result['goto_section'] = 'shipping';
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
public function savePaymentAction()
|
21 |
+
{
|
22 |
+
$this->_expireAjax();
|
23 |
+
if ($this->getRequest()->isPost()) {
|
24 |
+
$data = $this->getRequest()->getPost('payment', array());
|
25 |
+
/*
|
26 |
+
* first to check payment information entered is correct or not
|
27 |
+
*/
|
28 |
+
|
29 |
+
try {
|
30 |
+
$result = $this->getOnepage()->savePayment($data);
|
31 |
+
}
|
32 |
+
catch (Mage_Payment_Exception $e) {
|
33 |
+
if ($e->getFields()) {
|
34 |
+
$result['fields'] = $e->getFields();
|
35 |
+
}
|
36 |
+
$result['error'] = $e->getMessage();
|
37 |
+
}
|
38 |
+
catch (Exception $e) {
|
39 |
+
$result['error'] = $e->getMessage();
|
40 |
+
}
|
41 |
+
$redirectUrl = $this->getOnePage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
|
42 |
+
if (empty($result['error']) && !$redirectUrl) {
|
43 |
+
$this->loadLayout('checkout_onepage_voodoo');
|
44 |
+
|
45 |
+
$result['goto_section'] = 'voodoo';
|
46 |
+
}
|
47 |
+
|
48 |
+
if ($redirectUrl) {
|
49 |
+
$result['redirect'] = $redirectUrl;
|
50 |
+
}
|
51 |
+
|
52 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
public function saveVoodooAction()
|
57 |
+
{
|
58 |
+
$this->_expireAjax();
|
59 |
+
if ($this->getRequest()->isPost()) {
|
60 |
+
|
61 |
+
//Grab the submited value voodoo for us value
|
62 |
+
$_tgm_voodoo = $this->getRequest()->getPost('getvoice');
|
63 |
+
Mage::getSingleton('core/session')->setTGMVoodoo($_tgm_voodoo);
|
64 |
+
|
65 |
+
$result = array();
|
66 |
+
|
67 |
+
$redirectUrl = $this->getOnePage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
|
68 |
+
if (!$redirectUrl) {
|
69 |
+
$this->loadLayout('checkout_onepage_review');
|
70 |
+
|
71 |
+
$result['goto_section'] = 'review';
|
72 |
+
$result['update_section'] = array(
|
73 |
+
'name' => 'review',
|
74 |
+
'html' => $this->_getReviewHtml()
|
75 |
+
);
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
if ($redirectUrl) {
|
80 |
+
$result['redirect'] = $redirectUrl;
|
81 |
+
}
|
82 |
+
|
83 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
84 |
+
}
|
85 |
+
}
|
86 |
+
}
|
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>
|
@@ -102,11 +102,20 @@
|
|
102 |
</voodoo>
|
103 |
</entities>
|
104 |
</voodoo_mysql4>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
</models>
|
106 |
<resources>
|
107 |
<voodoo_setup>
|
108 |
<setup>
|
109 |
<module>TGM_Voodoo</module>
|
|
|
110 |
</setup>
|
111 |
<connection>
|
112 |
<use>core_setup</use>
|
@@ -127,6 +136,19 @@
|
|
127 |
<voodoo>
|
128 |
<class>TGM_Voodoo_Block</class>
|
129 |
</voodoo>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
</blocks>
|
131 |
<helpers>
|
132 |
<voodoo>
|
@@ -134,7 +156,19 @@
|
|
134 |
</voodoo>
|
135 |
</helpers>
|
136 |
<events>
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
<observers>
|
139 |
<TGM_Voodoo_Created>
|
140 |
<type>singleton</type>
|
@@ -203,4 +237,50 @@
|
|
203 |
</shipments>
|
204 |
</voodoo>
|
205 |
</default>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
</config>
|
10 |
<config>
|
11 |
<modules>
|
12 |
<TGM_Voodoo>
|
13 |
+
<version>2.3.7</version>
|
14 |
</TGM_Voodoo>
|
15 |
</modules>
|
16 |
<admin>
|
102 |
</voodoo>
|
103 |
</entities>
|
104 |
</voodoo_mysql4>
|
105 |
+
<checkout>
|
106 |
+
<rewrite>
|
107 |
+
<type_onepage>TGM_Voodoo_Model_Type_Onepage</type_onepage>
|
108 |
+
</rewrite>
|
109 |
+
</checkout>
|
110 |
+
<tgmadminthemecontroller>
|
111 |
+
<class>TGM_Voodoo_Controller</class>
|
112 |
+
</tgmadminthemecontroller>
|
113 |
</models>
|
114 |
<resources>
|
115 |
<voodoo_setup>
|
116 |
<setup>
|
117 |
<module>TGM_Voodoo</module>
|
118 |
+
<class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
|
119 |
</setup>
|
120 |
<connection>
|
121 |
<use>core_setup</use>
|
136 |
<voodoo>
|
137 |
<class>TGM_Voodoo_Block</class>
|
138 |
</voodoo>
|
139 |
+
<checkout>
|
140 |
+
<rewrite>
|
141 |
+
<onepage>TGM_Voodoo_Block_Onepage</onepage>
|
142 |
+
</rewrite>
|
143 |
+
</checkout>
|
144 |
+
|
145 |
+
<voodoo>
|
146 |
+
<class>TGM_Voodoo_Block</class>
|
147 |
+
</voodoo>
|
148 |
+
|
149 |
+
<voodooonepage>
|
150 |
+
<class>TGM_Voodoo_Block_Onepage</class>
|
151 |
+
</voodooonepage>
|
152 |
</blocks>
|
153 |
<helpers>
|
154 |
<voodoo>
|
156 |
</voodoo>
|
157 |
</helpers>
|
158 |
<events>
|
159 |
+
<!-- START Adds the Admin theme switcher, enables to avoid modify admin themes -->
|
160 |
+
<adminhtml_controller_action_predispatch_start>
|
161 |
+
<observers>
|
162 |
+
<tgm_themeoverride_observer>
|
163 |
+
<type>singleton</type>
|
164 |
+
<!-- tgmadminthemecontroller/observer -->
|
165 |
+
<class>TGM_Voodoo_Controller_Observer</class>
|
166 |
+
<method>overrideTheme</method>
|
167 |
+
</tgm_themeoverride_observer>
|
168 |
+
</observers>
|
169 |
+
</adminhtml_controller_action_predispatch_start>
|
170 |
+
<!-- END Adds the Admin theme switcher, enables to avoid modify admin themes -->
|
171 |
+
<checkout_onepage_controller_success_action>
|
172 |
<observers>
|
173 |
<TGM_Voodoo_Created>
|
174 |
<type>singleton</type>
|
237 |
</shipments>
|
238 |
</voodoo>
|
239 |
</default>
|
240 |
+
<frontend>
|
241 |
+
<routers>
|
242 |
+
<tgm_voodoo>
|
243 |
+
<use>standard</use>
|
244 |
+
<args>
|
245 |
+
<module>TGM_Voodoo</module>
|
246 |
+
<frontName>Voodoo</frontName>
|
247 |
+
</args>
|
248 |
+
</tgm_voodoo>
|
249 |
+
<checkout>
|
250 |
+
<args>
|
251 |
+
<modules>
|
252 |
+
<TGM_Voodoo before="Mage_Checkout">TGM_Voodoo</TGM_Voodoo>
|
253 |
+
</modules>
|
254 |
+
</args>
|
255 |
+
</checkout>
|
256 |
+
|
257 |
+
</routers>
|
258 |
+
|
259 |
+
<events>
|
260 |
+
<!-- START Custom added by Branko Ajzele: Hooks into order save event -->
|
261 |
+
<checkout_onepage_controller_success_action>
|
262 |
+
<observers>
|
263 |
+
<hooksystem_order_success>
|
264 |
+
<type>singleton</type>
|
265 |
+
<class>voodoo/observer</class>
|
266 |
+
<method>hookToOrderSaveEvent</method>
|
267 |
+
</hooksystem_order_success>
|
268 |
+
</observers>
|
269 |
+
</checkout_onepage_controller_success_action>
|
270 |
+
<!-- END Custom added by Branko Ajzele: Hooks into order save event -->
|
271 |
+
|
272 |
+
|
273 |
+
|
274 |
+
|
275 |
+
</events>
|
276 |
+
|
277 |
+
<layout>
|
278 |
+
<updates>
|
279 |
+
<voodoo>
|
280 |
+
<file>voodoo.xml</file>
|
281 |
+
</voodoo>
|
282 |
+
</updates>
|
283 |
+
</layout>
|
284 |
+
|
285 |
+
</frontend>
|
286 |
</config>
|
app/code/community/TGM/Voodoo/etc/system.xml
CHANGED
@@ -85,10 +85,50 @@
|
|
85 |
</credits>
|
86 |
</fields>
|
87 |
</enter>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
<orders translate="label">
|
89 |
<label>When new order is placed</label>
|
90 |
<frontend_type>text</frontend_type>
|
91 |
-
<sort_order>
|
92 |
<show_in_default>1</show_in_default>
|
93 |
<show_in_website>1</show_in_website>
|
94 |
<show_in_store>1</show_in_store>
|
@@ -153,7 +193,7 @@
|
|
153 |
<order_hold translate="label">
|
154 |
<label>When Order Status is set to Hold</label>
|
155 |
<frontend_type>text</frontend_type>
|
156 |
-
<sort_order>
|
157 |
<show_in_default>1</show_in_default>
|
158 |
<show_in_website>1</show_in_website>
|
159 |
<show_in_store>1</show_in_store>
|
@@ -195,7 +235,7 @@
|
|
195 |
<comment>This option will send sms to the admin when an order is placed</comment>
|
196 |
<frontend_type>select</frontend_type>
|
197 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
198 |
-
<sort_order>
|
199 |
<show_in_default>1</show_in_default>
|
200 |
<show_in_website>1</show_in_website>
|
201 |
<show_in_store>1</show_in_store>
|
@@ -218,7 +258,7 @@
|
|
218 |
<order_unhold translate="label">
|
219 |
<label>When Order Status is set to Unhold</label>
|
220 |
<frontend_type>text</frontend_type>
|
221 |
-
<sort_order>
|
222 |
<show_in_default>1</show_in_default>
|
223 |
<show_in_website>1</show_in_website>
|
224 |
<show_in_store>1</show_in_store>
|
@@ -283,7 +323,7 @@
|
|
283 |
<order_canceled translate="label">
|
284 |
<label>When Order is Cancelled</label>
|
285 |
<frontend_type>text</frontend_type>
|
286 |
-
<sort_order>
|
287 |
<show_in_default>1</show_in_default>
|
288 |
<show_in_website>1</show_in_website>
|
289 |
<show_in_store>1</show_in_store>
|
@@ -348,7 +388,7 @@
|
|
348 |
<shipments translate="label">
|
349 |
<label>When Order is set for shipment</label>
|
350 |
<frontend_type>text</frontend_type>
|
351 |
-
<sort_order>
|
352 |
<show_in_default>1</show_in_default>
|
353 |
<show_in_website>1</show_in_website>
|
354 |
<show_in_store>1</show_in_store>
|
@@ -420,5 +460,26 @@
|
|
420 |
</groups>
|
421 |
|
422 |
</voodoo>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
</sections>
|
|
|
424 |
</config>
|
85 |
</credits>
|
86 |
</fields>
|
87 |
</enter>
|
88 |
+
<optins translate="label">
|
89 |
+
<label>Customer SMS Opt-In</label>
|
90 |
+
<frontend_type>text</frontend_type>
|
91 |
+
<sort_order>15</sort_order>
|
92 |
+
<show_in_default>1</show_in_default>
|
93 |
+
<show_in_website>1</show_in_website>
|
94 |
+
<show_in_store>1</show_in_store>
|
95 |
+
<fields>
|
96 |
+
<enabled translate="label comment">
|
97 |
+
<label>Allow Opt-In Feature</label>
|
98 |
+
<comment>If YES, then during checkout the customer will be asked if they want to receive SMS Notification and which number to send them to. If NO, the default rules apply.</comment>
|
99 |
+
<frontend_type>select</frontend_type>
|
100 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
101 |
+
<sort_order>5</sort_order>
|
102 |
+
<show_in_default>1</show_in_default>
|
103 |
+
<show_in_website>1</show_in_website>
|
104 |
+
<show_in_store>1</show_in_store>
|
105 |
+
</enabled>
|
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>
|
113 |
+
<show_in_website>1</show_in_website>
|
114 |
+
<show_in_store>1</show_in_store>
|
115 |
+
<fields>
|
116 |
+
<bish translate="label comment">
|
117 |
+
<label>Use Shipping or Billing Contact Details</label>
|
118 |
+
<comment>During checkout, if Opt-In is set to NO, select which number should be used to send the SMS notifications configured in this module to.</comment>
|
119 |
+
<frontend_type>select</frontend_type>
|
120 |
+
<source_model>TGM_Voodoo_Model_Adminhtml_System_Config_Source_Color</source_model>
|
121 |
+
<sort_order>5</sort_order>
|
122 |
+
<show_in_default>1</show_in_default>
|
123 |
+
<show_in_website>1</show_in_website>
|
124 |
+
<show_in_store>1</show_in_store>
|
125 |
+
</bish>
|
126 |
+
</fields>
|
127 |
+
</deno>
|
128 |
<orders translate="label">
|
129 |
<label>When 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>
|
133 |
<show_in_website>1</show_in_website>
|
134 |
<show_in_store>1</show_in_store>
|
193 |
<order_hold translate="label">
|
194 |
<label>When Order Status is set to Hold</label>
|
195 |
<frontend_type>text</frontend_type>
|
196 |
+
<sort_order>30</sort_order>
|
197 |
<show_in_default>1</show_in_default>
|
198 |
<show_in_website>1</show_in_website>
|
199 |
<show_in_store>1</show_in_store>
|
235 |
<comment>This option will send sms to the admin when an order is placed</comment>
|
236 |
<frontend_type>select</frontend_type>
|
237 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
238 |
+
<sort_order>30</sort_order>
|
239 |
<show_in_default>1</show_in_default>
|
240 |
<show_in_website>1</show_in_website>
|
241 |
<show_in_store>1</show_in_store>
|
258 |
<order_unhold translate="label">
|
259 |
<label>When Order Status is set to Unhold</label>
|
260 |
<frontend_type>text</frontend_type>
|
261 |
+
<sort_order>35</sort_order>
|
262 |
<show_in_default>1</show_in_default>
|
263 |
<show_in_website>1</show_in_website>
|
264 |
<show_in_store>1</show_in_store>
|
323 |
<order_canceled translate="label">
|
324 |
<label>When Order is Cancelled</label>
|
325 |
<frontend_type>text</frontend_type>
|
326 |
+
<sort_order>40</sort_order>
|
327 |
<show_in_default>1</show_in_default>
|
328 |
<show_in_website>1</show_in_website>
|
329 |
<show_in_store>1</show_in_store>
|
388 |
<shipments translate="label">
|
389 |
<label>When Order is set for shipment</label>
|
390 |
<frontend_type>text</frontend_type>
|
391 |
+
<sort_order>45</sort_order>
|
392 |
<show_in_default>1</show_in_default>
|
393 |
<show_in_website>1</show_in_website>
|
394 |
<show_in_store>1</show_in_store>
|
460 |
</groups>
|
461 |
|
462 |
</voodoo>
|
463 |
+
<design>
|
464 |
+
<groups>
|
465 |
+
<admin translate="label">
|
466 |
+
<label>Admin Theme</label>
|
467 |
+
<frontend_type>text</frontend_type>
|
468 |
+
<sort_order>1</sort_order>
|
469 |
+
<show_in_default>1</show_in_default>
|
470 |
+
<fields>
|
471 |
+
<theme translate="label comment">
|
472 |
+
<label>Admin theme name</label>
|
473 |
+
<comment>Override default admin theme.</comment>
|
474 |
+
<frontend_type>text</frontend_type>
|
475 |
+
<sort_order>1</sort_order>
|
476 |
+
<show_in_default>1</show_in_default>
|
477 |
+
</theme>
|
478 |
+
</fields>
|
479 |
+
</admin>
|
480 |
+
</groups>
|
481 |
+
</design>
|
482 |
+
|
483 |
</sections>
|
484 |
+
|
485 |
</config>
|
app/code/community/TGM/Voodoo/sql/voodoo_setup/mysql4-install-1.0.0.php
CHANGED
@@ -25,7 +25,30 @@ CREATE TABLE {$this->getTable('voodoo')} (
|
|
25 |
`created_time` datetime DEFAULT NULL,
|
26 |
PRIMARY KEY (`voodoo_id`)
|
27 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
$installer->endSetup();
|
25 |
`created_time` datetime DEFAULT NULL,
|
26 |
PRIMARY KEY (`voodoo_id`)
|
27 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
28 |
+
DROP TABLE IF EXISTS {$this->getTable('voodoo_number')};
|
29 |
+
CREATE TABLE {$this->getTable('voodoo_number')} (
|
30 |
+
`number_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
31 |
+
`order_id` varchar(255) NOT NULL DEFAULT '',
|
32 |
+
`sms_number` varchar(255) NOT NULL DEFAULT '',
|
33 |
+
PRIMARY KEY (`number_id`)
|
34 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
35 |
");
|
36 |
+
//START Add order attribute by Branko Ajzele
|
37 |
+
$sql = "SELECT entity_type_id FROM ".$this->getTable('eav_entity_type')." WHERE entity_type_code='order'";
|
38 |
+
$row = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchRow($sql);
|
39 |
+
|
40 |
+
$attribute = array(
|
41 |
+
'type' => 'text',
|
42 |
+
'label' => 'voodoo',
|
43 |
+
'visible' => false,
|
44 |
+
'required' => false,
|
45 |
+
'user_defined' => false,
|
46 |
+
'searchable' => false,
|
47 |
+
'filterable' => false,
|
48 |
+
'comparable' => false,
|
49 |
+
);
|
50 |
+
|
51 |
+
$installer->addAttribute($row['entity_type_id'], 'voodoo', $attribute);
|
52 |
+
//END Add customer attribute Branko Ajzele
|
53 |
|
54 |
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/voodoo.xml
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<voodoo_adminhtml_voodoo_index>
|
4 |
-
<reference name="content">
|
5 |
-
<block type="voodoo/adminhtml_voodoo" name="voodoo" />
|
6 |
-
</reference>
|
7 |
-
</voodoo_adminhtml_voodoo_index>
|
8 |
</layout>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<voodoo_adminhtml_voodoo_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="voodoo/adminhtml_voodoo" name="voodoo" />
|
6 |
+
</reference>
|
7 |
+
</voodoo_adminhtml_voodoo_index>
|
8 |
</layout>
|
app/etc/modules/TGM_Voodoo.xml
CHANGED
@@ -1,12 +1,5 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
|
3 |
-
/**
|
4 |
-
* @category MN
|
5 |
-
* @package MN_Sendsms
|
6 |
-
* @author 24x
|
7 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
-
*/
|
9 |
-
-->
|
10 |
<config>
|
11 |
<modules>
|
12 |
<TGM_Voodoo>
|
1 |
<?xml version="1.0"?>
|
2 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
<config>
|
4 |
<modules>
|
5 |
<TGM_Voodoo>
|
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>
|
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>2.3.7</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-08-27</date>
|
39 |
+
<time>07:24:51</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="fc4179e3f5f6451aa99d8235fdf33c01"/></dir></dir><file name="Credits.php" hash="f4473f43731901738a4cf079b2338e18"/><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="744c9e5c5cc5eba38328b86cc06d1372"/></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="2c957637195ab779f961e42441c584a0"/><dir name="Type"><file name="Onepage.php" hash="769b2910e6d213436ed04f137b0ca184"/></dir><file name="Voodoo.php" hash="59c278c4c55821506802252160962163"/></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="8c67a3093c0788749402549a7a610758"/><file name="system.xml" hash="d4ba44474dd07dad31ce319c6c617e09"/></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></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="24887cb06828b73676ab1dcd69977c79"/></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>
|