Carotechs_Smsnotify - Version 0.1.1

Version Notes

SMS notification

Download this release

Release Info

Developer Carotechs
Extension Carotechs_Smsnotify
Version 0.1.1
Comparing to
See all releases


Code changes from version 0.1.0 to 0.1.1

app/code/local/Carotechs/Smsnotify/Helper/Data.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Carotechs_Smsnotify_Helper_Data extends Mage_Core_Helper_Data
4
+ {
5
+ const CONFIG_PATH = 'smsnotify/';
6
+
7
+ public function isOrdersEnabled()
8
+ {
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');
15
+ }
16
+
17
+ public function isOrderUnholdEnabled()
18
+ {
19
+ return Mage::getStoreConfig(self::CONFIG_PATH.'order_unhold/enabled');
20
+ }
21
+
22
+ public function isOrderCanceledEnabled()
23
+ {
24
+ return Mage::getStoreConfig(self::CONFIG_PATH.'order_canceled/enabled');
25
+ }
26
+
27
+ public function isShipmentsEnabled()
28
+ {
29
+ return Mage::getStoreConfig(self::CONFIG_PATH.'shipments/enabled');
30
+ }
31
+
32
+ public function getAPI()
33
+ {
34
+ return Mage::getStoreConfig(self::CONFIG_PATH.'general/api');
35
+ }
36
+
37
+ public function getMessageField()
38
+ {
39
+ return Mage::getStoreConfig(self::CONFIG_PATH.'general/message_field');
40
+ }
41
+
42
+ public function getSentMethod()
43
+ {
44
+ return Mage::getStoreConfig(self::CONFIG_PATH.'general/urlmethod');
45
+ }
46
+
47
+ public function getSender()
48
+ {
49
+ return Mage::getStoreConfig(self::CONFIG_PATH.'orders/sender');
50
+ }
51
+
52
+ public function getSenderForOrderHold()
53
+ {
54
+ return Mage::getStoreConfig(self::CONFIG_PATH.'order_hold/sender');
55
+ }
56
+
57
+ public function getSenderForOrderUnhold()
58
+ {
59
+ return Mage::getStoreConfig(self::CONFIG_PATH.'order_unhold/sender');
60
+ }
61
+
62
+ public function getSenderForOrderCanceled()
63
+ {
64
+ return Mage::getStoreConfig(self::CONFIG_PATH.'order_canceled/sender');
65
+ }
66
+
67
+ public function getSenderForShipment()
68
+ {
69
+ return Mage::getStoreConfig(self::CONFIG_PATH.'shipments/sender');
70
+ }
71
+
72
+ public function getMessage(Mage_Sales_Model_Order $order)
73
+ {
74
+ $billingAddress = $order->getBillingAddress();
75
+ $whatArray = array('{{firstname}}');
76
+ $withWhatArray = array($billingAddress->getFirstname());
77
+
78
+ return str_replace($whatArray,$withWhatArray,Mage::getStoreConfig(self::CONFIG_PATH.'orders/message'));
79
+ }
80
+
81
+ public function getMessageForOrderHold(Mage_Sales_Model_Order $order)
82
+ {
83
+ $billingAddress = $order->getBillingAddress();
84
+ $whatArray = array('{{firstname}}','{{order_id}}');
85
+ $withWhatArray = array($billingAddress->getFirstname(),$order->getIncrementId());
86
+
87
+ return str_replace($whatArray,$withWhatArray,Mage::getStoreConfig(self::CONFIG_PATH.'order_hold/message'));
88
+ }
89
+
90
+ public function getMessageForOrderUnhold(Mage_Sales_Model_Order $order)
91
+ {
92
+ $billingAddress = $order->getBillingAddress();
93
+ $whatArray = array('{{firstname}}','{{order_id}}');
94
+ $withWhatArray = array($billingAddress->getFirstname(),$order->getIncrementId());
95
+
96
+ return str_replace($whatArray,$withWhatArray,Mage::getStoreConfig(self::CONFIG_PATH.'order_unhold/message'));
97
+ }
98
+
99
+ public function getMessageForOrderCanceled(Mage_Sales_Model_Order $order)
100
+ {
101
+ $billingAddress = $order->getBillingAddress();
102
+ $whatArray = array('{{firstname}}','{{order_id}}');
103
+ $withWhatArray = array($billingAddress->getFirstname(),$order->getIncrementId());
104
+
105
+ return str_replace($whatArray,$withWhatArray,Mage::getStoreConfig(self::CONFIG_PATH.'order_canceled/message'));
106
+ }
107
+
108
+ public function getMessageForShipment(Mage_Sales_Model_Order $order)
109
+ {
110
+ $billingAddress = $order->getBillingAddress();
111
+ $whatArray = array('{{firstname}}','{{order_id}}');
112
+ $withWhatArray = array($billingAddress->getFirstname(),$order->getIncrementId());
113
+
114
+ return str_replace($whatArray,$withWhatArray,Mage::getStoreConfig(self::CONFIG_PATH.'shipments/message'));
115
+ }
116
+
117
+ public function getTelephoneFromOrder(Mage_Sales_Model_Order $order)
118
+ {
119
+ $billingAddress = $order->getBillingAddress();
120
+
121
+ $number = $billingAddress->getTelephone();
122
+ $number = preg_replace('#[^\+\d]#', '', trim($number));
123
+
124
+ if (substr($number, 0, 1) === '+') {
125
+ $number = substr($number, 1);
126
+ } elseif (substr($number, 0, 2) === '00') {
127
+ $number = substr($number, 2);
128
+ } else {
129
+ if (substr($number, 0, 1) === '0') {
130
+ $number = substr($number, 1);
131
+ }
132
+ $expectedPrefix = Zend_Locale_Data::getContent(Mage::app()->getLocale()->getLocale(), 'phonetoterritory', $billingAddress->getCountry());
133
+ if (!empty($expectedPrefix)) {
134
+ $prefix = substr($number, 0, strlen($expectedPrefix));
135
+ if ($prefix !== $expectedPrefix) {
136
+ $number = $expectedPrefix . $number;
137
+ }
138
+ }
139
+ }
140
+ $number = preg_replace('#[^\d]#', '', trim($number));
141
+
142
+ return $number;
143
+ }
144
+
145
+ public function isOrdersNotify()
146
+ {
147
+ return Mage::getStoreConfig(self::CONFIG_PATH.'orders/notify');
148
+ }
149
+
150
+ public function getAdminTelephone()
151
+ {
152
+ return Mage::getStoreConfig(self::CONFIG_PATH.'orders/receiver');
153
+ }
154
+
155
+ public function sendSms($url,$data=NULL)
156
+ {
157
+
158
+ try
159
+ { if($data!='')
160
+ {
161
+
162
+ $sendSms = $this->file_get_contents_curl_POST($url,$data);
163
+ }
164
+ else
165
+ {
166
+ $sendSms = $this->file_get_contents_curl($url);
167
+ }
168
+
169
+ }
170
+ catch(Exception $e) {
171
+ $sendSms = '';
172
+ }
173
+ if($sendSms) {
174
+ return true;
175
+ switch($sendSms) {
176
+ case '01':
177
+ $status_message = Mage::helper('smsnotify')->__('24X Username or password incorrect.');
178
+ $status = Mage::helper('smsnotify')->__('Not sent');
179
+ break;
180
+ case '02':
181
+ $status_message = Mage::helper('smsnotify')->__('SmsTo missing.');
182
+ $status = Mage::helper('smsnotify')->__('Not sent');
183
+ break;
184
+ case '03':
185
+ $status_message = Mage::helper('smsnotify')->__('SmsFrom missing.');
186
+ $status = Mage::helper('smsnotify')->__('Not sent');
187
+ break;
188
+ case '04':
189
+ $status_message = Mage::helper('smsnotify')->__('SmsMsg missing.');
190
+ $status = Mage::helper('smsnotify')->__('Not sent');
191
+ break;
192
+ case '09':
193
+ $status_message = Mage::helper('smsnotify')->__('Insufficient credits.');
194
+ $status = Mage::helper('smsnotify')->__('Not sent');
195
+ break;
196
+ default:
197
+ $status_message = Mage::helper('smsnotify')->__('Sms successfully sent.');
198
+ $status = Mage::helper('smsnotify')->__('Sent');
199
+ break;
200
+ }
201
+ }
202
+ else {
203
+ return false;
204
+ $status_message = Mage::helper('smsnotify')->__('Not able to send the sms. Please contact the developer.');
205
+ $status = 'Not sent';
206
+ }
207
+ $ret['status_message'] = $status_message;
208
+ $ret['status'] = $status;
209
+ return $ret;
210
+ }
211
+
212
+ public function file_get_contents_curl($url)
213
+ {
214
+ //echo $url;
215
+ // die();
216
+ $ch = curl_init();
217
+
218
+ curl_setopt($ch, CURLOPT_HEADER, 0);
219
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
220
+ curl_setopt($ch, CURLOPT_URL, $url);
221
+
222
+ $res = curl_exec($ch);
223
+ curl_close($ch);
224
+
225
+ return $res;
226
+ }
227
+
228
+ public function file_get_contents_curl_POST($url,$data)
229
+ {
230
+ //echo $url;
231
+ //echo $data;
232
+ //die();
233
+ $ch = curl_init($url);
234
+ curl_setopt($ch, CURLOPT_POST, true);
235
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
236
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
237
+ $res = curl_exec($ch);
238
+ curl_close($ch);
239
+ return $res;
240
+ }
241
+
242
+ }
app/code/local/Carotechs/Smsnotify/Model/Dropdown/Values.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Carotechs_Smsnotify_Model_Dropdown_Values
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ array(
8
+ 'value' => '0',
9
+ 'label' => 'POST',
10
+ ),
11
+ array(
12
+ 'value' => '1',
13
+ 'label' => 'GET',
14
+ ),
15
+ );
16
+ }
17
+ }
app/code/local/Carotechs/Smsnotify/Model/Observer.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Carotechs_Smsnotify_Model_Observer
3
+ {
4
+ public function sendSmsOnOrderCreated(Varien_Event_Observer $observer)
5
+ {
6
+
7
+ if($this->getHelper()->isOrdersEnabled())
8
+ {
9
+ $orders = $observer->getEvent()->getOrderIds();
10
+ $order = Mage::getModel('sales/order')->load($orders['0']);
11
+ if ($order instanceof Mage_Sales_Model_Order)
12
+ {
13
+ $api_url = $this->getHelper()->getAPI();
14
+ $message_field_name = $this->getHelper()->getMessageField();
15
+ if($message_field_name=='')
16
+ {
17
+ $message_field_name = 'message';
18
+ }
19
+ $sent_method = $this->getHelper()->getSentMethod();
20
+
21
+ $smsto = $this->getHelper()->getTelephoneFromOrder($order);
22
+ $smsmsg = $this->getHelper()->getMessage($order);
23
+
24
+
25
+ $data .= '&'.$message_field_name.'=' . urlencode($smsmsg);
26
+ $api_url = str_replace('{{mobile_no}}',$smsto,$api_url);
27
+
28
+ if($sent_method)
29
+ {
30
+ $method = 'GET';
31
+ $url = $api_url.$data;
32
+ $sendSms = $this->getHelper()->sendSms($url);
33
+ }
34
+ else
35
+ {
36
+ $method = 'POST';
37
+ $url = $api_url;
38
+ $sendSms = $this->getHelper()->sendSms($url,$data);
39
+ }
40
+
41
+ }
42
+ }
43
+ }
44
+
45
+ public function sendSmsOnOrderHold(Varien_Event_Observer $observer)
46
+ {
47
+ if($this->getHelper()->isOrderHoldEnabled()) {
48
+ $order = $observer->getOrder();
49
+ if ($order instanceof Mage_Sales_Model_Order) {
50
+ if ($order->getState() !== $order->getOrigData('state') && $order->getState() === Mage_Sales_Model_Order::STATE_HOLDED)
51
+ {
52
+ $api_url = $this->getHelper()->getAPI();
53
+ $message_field_name = $this->getHelper()->getMessageField();
54
+ if($message_field_name=='')
55
+ {
56
+ $message_field_name = 'message';
57
+ }
58
+ $sent_method = $this->getHelper()->getSentMethod();
59
+
60
+ $smsto = $this->getHelper()->getTelephoneFromOrder($order);
61
+ $smsmsg = $this->getHelper()->getMessageForOrderHold($order);
62
+
63
+
64
+ $data .= '&'.$message_field_name.'=' . urlencode($smsmsg);
65
+ $api_url = str_replace('{{mobile_no}}',$smsto,$api_url);
66
+
67
+ if($sent_method)
68
+ {
69
+ $method = 'GET';
70
+ $url = $api_url.$data;
71
+ $sendSms = $this->getHelper()->sendSms($url);
72
+ }
73
+ else
74
+ {
75
+ $method = 'POST';
76
+ $url = $api_url;
77
+ $sendSms = $this->getHelper()->sendSms($url,$data);
78
+ }
79
+
80
+
81
+ }
82
+ }
83
+ }
84
+ }
85
+
86
+ public function sendSmsOnOrderUnhold(Varien_Event_Observer $observer)
87
+ {
88
+ if($this->getHelper()->isOrderUnholdEnabled()) {
89
+ $order = $observer->getOrder();
90
+ if ($order instanceof Mage_Sales_Model_Order) {
91
+ if ($order->getState() !== $order->getOrigData('state') && $order->getOrigData('state') === Mage_Sales_Model_Order::STATE_HOLDED)
92
+ {
93
+ $api_url = $this->getHelper()->getAPI();
94
+ $message_field_name = $this->getHelper()->getMessageField();
95
+ if($message_field_name=='')
96
+ {
97
+ $message_field_name = 'message';
98
+ }
99
+ $sent_method = $this->getHelper()->getSentMethod();
100
+
101
+ $smsto = $this->getHelper()->getTelephoneFromOrder($order);
102
+ $smsmsg = $this->getHelper()->getMessageForOrderUnhold($order);
103
+
104
+
105
+ $data .= '&'.$message_field_name.'=' . urlencode($smsmsg);
106
+ $api_url = str_replace('{{mobile_no}}',$smsto,$api_url);
107
+
108
+ if($sent_method)
109
+ {
110
+ $method = 'GET';
111
+ $url = $api_url.$data;
112
+ $sendSms = $this->getHelper()->sendSms($url);
113
+ }
114
+ else
115
+ {
116
+ $method = 'POST';
117
+ $url = $api_url;
118
+ $sendSms = $this->getHelper()->sendSms($url,$data);
119
+ }
120
+
121
+ }
122
+ }
123
+ }
124
+ }
125
+
126
+ public function sendSmsOnOrderCanceled(Varien_Event_Observer $observer)
127
+ {
128
+ if($this->getHelper()->isOrderCanceledEnabled()) {
129
+ $order = $observer->getOrder();
130
+ if ($order instanceof Mage_Sales_Model_Order) {
131
+ if ($order->getState() !== $order->getOrigData('state') && $order->getState() === Mage_Sales_Model_Order::STATE_CANCELED)
132
+ {
133
+ $api_url = $this->getHelper()->getAPI();
134
+ $message_field_name = $this->getHelper()->getMessageField();
135
+ if($message_field_name=='')
136
+ {
137
+ $message_field_name = 'message';
138
+ }
139
+ $sent_method = $this->getHelper()->getSentMethod();
140
+
141
+ $smsto = $this->getHelper()->getTelephoneFromOrder($order);
142
+ $smsmsg = $this->getHelper()->getMessageForOrderCanceled($order);
143
+
144
+
145
+ $data .= '&'.$message_field_name.'=' . urlencode($smsmsg);
146
+ $api_url = str_replace('{{mobile_no}}',$smsto,$api_url);
147
+
148
+ if($sent_method)
149
+ {
150
+ $method = 'GET';
151
+ $url = $api_url.$data;
152
+ $sendSms = $this->getHelper()->sendSms($url);
153
+ }
154
+ else
155
+ {
156
+ $method = 'POST';
157
+ $url = $api_url;
158
+ $sendSms = $this->getHelper()->sendSms($url,$data);
159
+ }
160
+
161
+ }
162
+ }
163
+ }
164
+ }
165
+
166
+ public function sendSmsOnShipmentCreated(Varien_Event_Observer $observer)
167
+ {
168
+ if($this->getHelper()->isShipmentsEnabled()) {
169
+ $shipment = $observer->getEvent()->getShipment();
170
+ $order = $shipment->getOrder();
171
+ if ($order instanceof Mage_Sales_Model_Order)
172
+ {
173
+ $api_url = $this->getHelper()->getAPI();
174
+ $message_field_name = $this->getHelper()->getMessageField();
175
+ if($message_field_name=='')
176
+ {
177
+ $message_field_name = 'message';
178
+ }
179
+ $sent_method = $this->getHelper()->getSentMethod();
180
+
181
+ $smsto = $this->getHelper()->getTelephoneFromOrder($order);
182
+ $smsmsg = $this->getHelper()->getMessageForShipment($order);
183
+
184
+
185
+ $data .= '&'.$message_field_name.'=' . urlencode($smsmsg);
186
+ $api_url = str_replace('{{mobile_no}}',$smsto,$api_url);
187
+
188
+ if($sent_method)
189
+ {
190
+ $method = 'GET';
191
+ $url = $api_url.$data;
192
+ $sendSms = $this->getHelper()->sendSms($url);
193
+ }
194
+ else
195
+ {
196
+ $method = 'POST';
197
+ $url = $api_url;
198
+ $sendSms = $this->getHelper()->sendSms($url,$data);
199
+ }
200
+
201
+ }
202
+ }
203
+ }
204
+
205
+ public function getHelper()
206
+ {
207
+ return Mage::helper('smsnotify/Data');
208
+ }
209
+ }
app/code/local/Carotechs/Smsnotify/etc/adminhtml.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <adminhtml>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <smsnotify translate="title" module="smsnotify">
12
+ <title>SMS</title>
13
+ <sort_order>0</sort_order>
14
+ </smsnotify>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </adminhtml>
app/code/local/Carotechs/Smsnotify/etc/config.xml ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category SMS
5
+ * @package Carotechs_Smsnotify
6
+ * @author Carotechs
7
+ */
8
+ -->
9
+ <config>
10
+ <modules>
11
+ <Carotechs_Smsnotify>
12
+ <version>0.1.1</version>
13
+ </Carotechs_Smsnotify>
14
+ </modules>
15
+
16
+ <adminhtml>
17
+ <acl>
18
+ <resources>
19
+ <admin>
20
+ <children>
21
+ <system>
22
+ <children>
23
+ <config>
24
+ <children>
25
+ <smsnotify translate="title" module="smsnotify">
26
+ <title>SMS</title>
27
+ <sort_order>0</sort_order>
28
+ </smsnotify>
29
+ </children>
30
+ </config>
31
+ </children>
32
+ </system>
33
+ </children>
34
+ </admin>
35
+ </resources>
36
+ </acl>
37
+ </adminhtml>
38
+
39
+
40
+ <global>
41
+ <models>
42
+ <smsnotify>
43
+ <class>Carotechs_Smsnotify_Model</class>
44
+ </smsnotify>
45
+ </models>
46
+
47
+ <helpers>
48
+ <smsnotify>
49
+ <class>Carotechs_Smsnotify_Helper</class>
50
+ </smsnotify>
51
+ </helpers>
52
+ <events>
53
+ <checkout_onepage_controller_success_action>
54
+ <observers>
55
+ <Carotechs_Smsnotify_Created>
56
+ <type>singleton</type>
57
+ <class>Carotechs_Smsnotify_Model_Observer</class>
58
+ <method>sendSmsOnOrderCreated</method>
59
+ </Carotechs_Smsnotify_Created>
60
+ </observers>
61
+ </checkout_onepage_controller_success_action>
62
+ <sales_order_save_after>
63
+ <observers>
64
+ <Carotechs_Smsnotify_Order_Hold>
65
+ <type>singleton</type>
66
+ <class>Carotechs_Smsnotify_Model_Observer</class>
67
+ <method>sendSmsOnOrderHold</method>
68
+ </Carotechs_Smsnotify_Order_Hold>
69
+ <Carotechs_Smsnotify_Order_Unhold>
70
+ <type>singleton</type>
71
+ <class>Carotechs_Smsnotify_Model_Observer</class>
72
+ <method>sendSmsOnOrderUnhold</method>
73
+ </Carotechs_Smsnotify_Order_Unhold>
74
+ <Carotechs_Smsnotify_Order_Canceled>
75
+ <type>singleton</type>
76
+ <class>Carotechs_Smsnotify_Model_Observer</class>
77
+ <method>sendSmsOnOrderCanceled</method>
78
+ </Carotechs_Smsnotify_Order_Canceled>
79
+ </observers>
80
+ </sales_order_save_after>
81
+ <sales_order_shipment_save_after>
82
+ <observers>
83
+ <Carotechs_Smsnotify_Shipment_Created>
84
+ <type>singleton</type>
85
+ <class>Carotechs_Smsnotify_Model_Observer</class>
86
+ <method>sendSmsOnShipmentCreated</method>
87
+ </Carotechs_Smsnotify_Shipment_Created>
88
+ </observers>
89
+ </sales_order_shipment_save_after>
90
+ </events>
91
+ </global>
92
+
93
+
94
+ <default>
95
+ <smsnotify>
96
+ <general>
97
+ <api>URL?{{mobile_no}}</api>
98
+ <urlmethod>1</urlmethod>
99
+ <message_field>msg</message_field>
100
+ </general>
101
+ <orders>
102
+ <enabled>0</enabled>
103
+ <sender>Magento</sender>
104
+ <message>Hello {{firstname}}. Your order has been received. Thank you for your purchase!</message>
105
+ <notify>0</notify>
106
+ </orders>
107
+ <order_hold>
108
+ <enabled>0</enabled>
109
+ <sender>Magento</sender>
110
+ <message>Hello {{firstname}}. Your order {{order_id}} has been placed on hold.</message>
111
+ </order_hold>
112
+ <order_unhold>
113
+ <enabled>0</enabled>
114
+ <sender>Magento</sender>
115
+ <message>Hello {{firstname}}. Your order {{order_id}} has been released from holding status.</message>
116
+ </order_unhold>
117
+ <order_canceled>
118
+ <enabled>0</enabled>
119
+ <sender>Magento</sender>
120
+ <message>Hello {{firstname}}. Your order {{order_id}} has been canceled.</message>
121
+ </order_canceled>
122
+ <shipments>
123
+ <enabled>0</enabled>
124
+ <sender>Magento</sender>
125
+ <message>Hello {{firstname}}. Your order ({{order_id}}) has been shipped. Thank you for buying from us!</message>
126
+ </shipments>
127
+ </smsnotify>
128
+ </default>
129
+ </config>
app/code/local/Carotechs/Smsnotify/etc/system.xml ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <Carotechs_extensions translate="label" module="smsnotify">
5
+ <label>Carotechs Extensions</label>
6
+ <sort_order>0</sort_order>
7
+ </Carotechs_extensions>
8
+ </tabs>
9
+ <sections>
10
+ <smsnotify translate="label" module="smsnotify">
11
+ <label>Sms Notifications</label>
12
+ <tab>Carotechs_extensions</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>200</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <general translate="label">
20
+ <label>General</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>10</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <api translate="label">
28
+ <label>SMS Gateway URL</label>
29
+ <comment>example: URL?from=XXX&amp;to={{mobile_no}}</comment>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>1</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </api>
36
+ <urlmethod translate="label">
37
+ <label>URL Call Method</label>
38
+ <frontend_type>select</frontend_type>
39
+ <source_model>smsnotify/dropdown_values</source_model>
40
+ <sort_order>2</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ </urlmethod>
45
+ <message_field translate="label">
46
+ <label>Message field name</label>
47
+ <comment>(ie., msg=your message)</comment>
48
+ <frontend_type>text</frontend_type>
49
+ <sort_order>3</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </message_field>
54
+ </fields>
55
+ </general>
56
+
57
+
58
+ <orders translate="label">
59
+ <label>Orders</label>
60
+ <frontend_type>text</frontend_type>
61
+ <sort_order>15</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ <fields>
66
+ <enabled translate="label comment">
67
+ <label>Enabled</label>
68
+ <comment>Automatically sends a text message to the customer when an order is made</comment>
69
+ <frontend_type>select</frontend_type>
70
+ <source_model>adminhtml/system_config_source_yesno</source_model>
71
+ <sort_order>5</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ </enabled>
76
+
77
+ <message translate="label comment">
78
+ <label>Message</label>
79
+ <comment>Message Template (160 characters)</comment>
80
+ <tooltip>{{firstname}} = First Name</tooltip>
81
+ <validate>required-entry</validate>
82
+ <frontend_type>textarea</frontend_type>
83
+ <sort_order>15</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>1</show_in_store>
87
+ </message>
88
+
89
+ </fields>
90
+ </orders>
91
+ <order_hold translate="label">
92
+ <label>Order Hold</label>
93
+ <frontend_type>text</frontend_type>
94
+ <sort_order>20</sort_order>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>1</show_in_website>
97
+ <show_in_store>1</show_in_store>
98
+ <fields>
99
+ <enabled translate="label comment">
100
+ <label>Enabled</label>
101
+ <comment>Automatically sends a text message to the customer when an order is placed on hold</comment>
102
+ <frontend_type>select</frontend_type>
103
+ <source_model>adminhtml/system_config_source_yesno</source_model>
104
+ <sort_order>5</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>1</show_in_store>
108
+ </enabled>
109
+
110
+ <message translate="label comment">
111
+ <label>Message</label>
112
+ <comment>Message Template (160 characters)</comment>
113
+ <tooltip>{{firstname}} = First Name {{order_id}} = Order Id</tooltip>
114
+ <validate>required-entry</validate>
115
+ <frontend_type>textarea</frontend_type>
116
+ <sort_order>15</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>1</show_in_store>
120
+ </message>
121
+ </fields>
122
+ </order_hold>
123
+ <order_unhold translate="label">
124
+ <label>Order Unhold</label>
125
+ <frontend_type>text</frontend_type>
126
+ <sort_order>25</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>1</show_in_store>
130
+ <fields>
131
+ <enabled translate="label comment">
132
+ <label>Enabled</label>
133
+ <comment>Automatically sends a text message to the customer when an order has been released from holding status</comment>
134
+ <frontend_type>select</frontend_type>
135
+ <source_model>adminhtml/system_config_source_yesno</source_model>
136
+ <sort_order>5</sort_order>
137
+ <show_in_default>1</show_in_default>
138
+ <show_in_website>1</show_in_website>
139
+ <show_in_store>1</show_in_store>
140
+ </enabled>
141
+
142
+ <message translate="label comment">
143
+ <label>Message</label>
144
+ <comment>Message Template (160 characters)</comment>
145
+ <tooltip>{{firstname}} = First Name {{order_id}} = Order Id</tooltip>
146
+ <validate>required-entry</validate>
147
+ <frontend_type>textarea</frontend_type>
148
+ <sort_order>15</sort_order>
149
+ <show_in_default>1</show_in_default>
150
+ <show_in_website>1</show_in_website>
151
+ <show_in_store>1</show_in_store>
152
+ </message>
153
+ </fields>
154
+ </order_unhold>
155
+ <order_canceled translate="label">
156
+ <label>Order Canceled</label>
157
+ <frontend_type>text</frontend_type>
158
+ <sort_order>30</sort_order>
159
+ <show_in_default>1</show_in_default>
160
+ <show_in_website>1</show_in_website>
161
+ <show_in_store>1</show_in_store>
162
+ <fields>
163
+ <enabled translate="label comment">
164
+ <label>Enabled</label>
165
+ <comment>Automatically sends a text message to the customer when an order has been canceled</comment>
166
+ <frontend_type>select</frontend_type>
167
+ <source_model>adminhtml/system_config_source_yesno</source_model>
168
+ <sort_order>5</sort_order>
169
+ <show_in_default>1</show_in_default>
170
+ <show_in_website>1</show_in_website>
171
+ <show_in_store>1</show_in_store>
172
+ </enabled>
173
+
174
+ <message translate="label comment">
175
+ <label>Message</label>
176
+ <comment>Message Template (160 characters)</comment>
177
+ <tooltip>{{firstname}} = First Name {{order_id}} = Order Id</tooltip>
178
+ <validate>required-entry</validate>
179
+ <frontend_type>textarea</frontend_type>
180
+ <sort_order>15</sort_order>
181
+ <show_in_default>1</show_in_default>
182
+ <show_in_website>1</show_in_website>
183
+ <show_in_store>1</show_in_store>
184
+ </message>
185
+ </fields>
186
+ </order_canceled>
187
+ <shipments translate="label">
188
+ <label>Shipments</label>
189
+ <frontend_type>text</frontend_type>
190
+ <sort_order>35</sort_order>
191
+ <show_in_default>1</show_in_default>
192
+ <show_in_website>1</show_in_website>
193
+ <show_in_store>1</show_in_store>
194
+ <fields>
195
+ <enabled translate="label comment">
196
+ <label>Enabled</label>
197
+ <comment>Automatically sends a text message to the customer when the shipment is made</comment>
198
+ <frontend_type>select</frontend_type>
199
+ <source_model>adminhtml/system_config_source_yesno</source_model>
200
+ <sort_order>5</sort_order>
201
+ <show_in_default>1</show_in_default>
202
+ <show_in_website>1</show_in_website>
203
+ <show_in_store>1</show_in_store>
204
+ </enabled>
205
+
206
+ <message translate="label comment">
207
+ <label>Message</label>
208
+ <comment>Message Template (160 characters)</comment>
209
+ <tooltip>{{firstname}} = First Name {{order_id}} = Order Id</tooltip>
210
+ <validate>required-entry</validate>
211
+ <frontend_type>textarea</frontend_type>
212
+ <sort_order>15</sort_order>
213
+ <show_in_default>1</show_in_default>
214
+ <show_in_website>1</show_in_website>
215
+ <show_in_store>1</show_in_store>
216
+ </message>
217
+ </fields>
218
+ </shipments>
219
+ </groups>
220
+ </smsnotify>
221
+
222
+ </sections>
223
+ </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Carotechs_Smsnotify</name>
4
- <version>0.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSLv3.0</license>
7
  <channel>community</channel>
@@ -11,8 +11,8 @@
11
  <notes>SMS notification</notes>
12
  <authors><author><name>carotechs</name><user>carotechs</user><email>apps@carotechs.com</email></author></authors>
13
  <date>2014-12-16</date>
14
- <time>10:00:45</time>
15
- <contents><target name="magelocal"><dir name="Carotechs"><file name="Smsnotify" hash=""/></dir></target><target name="mageetc"><dir name="modules"><file name="Carotechs_Smsnotify.xml" hash="cbc54fef2beda0afca8e70da6b1cb64e"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Carotechs_Smsnotify</name>
4
+ <version>0.1.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSLv3.0</license>
7
  <channel>community</channel>
11
  <notes>SMS notification</notes>
12
  <authors><author><name>carotechs</name><user>carotechs</user><email>apps@carotechs.com</email></author></authors>
13
  <date>2014-12-16</date>
14
+ <time>10:57:51</time>
15
+ <contents><target name="magelocal"><dir name="Carotechs"><dir name="Smsnotify"><dir name="Helper"><file name="Data.php" hash="1a10ea1ea710b24b89af11b1265807b5"/></dir><dir name="Model"><dir name="Dropdown"><file name="Values.php" hash="c4b45a94203c6d01ad5c68254e9a47ef"/></dir><file name="Observer.php" hash="bae47cc5789e4db5f43be0b780a4a2e1"/></dir><dir name="etc"><file name="adminhtml.xml" hash="630a24f98f8d22583a25c1038663ec48"/><file name="config.xml" hash="d5d924277070afef9455e6c3196608c5"/><file name="system.xml" hash="feb405f29e9af22290e74e43961c6ec1"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Carotechs_Smsnotify.xml" hash="cbc54fef2beda0afca8e70da6b1cb64e"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>