MN_Sendsms - Version 1.0.0

Version Notes

First release

Download this release

Release Info

Developer Marius N
Extension MN_Sendsms
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (24) hide show
  1. app/code/community/MN/Sendsms/Block/Adminhtml/Sendsms.php +12 -0
  2. app/code/community/MN/Sendsms/Block/Adminhtml/Sendsms/Edit.php +26 -0
  3. app/code/community/MN/Sendsms/Block/Adminhtml/Sendsms/Edit/Form.php +19 -0
  4. app/code/community/MN/Sendsms/Block/Adminhtml/Sendsms/Edit/Tab/Form.php +44 -0
  5. app/code/community/MN/Sendsms/Block/Adminhtml/Sendsms/Edit/Tabs.php +24 -0
  6. app/code/community/MN/Sendsms/Block/Adminhtml/Sendsms/Grid.php +89 -0
  7. app/code/community/MN/Sendsms/Block/Buttons.php +19 -0
  8. app/code/community/MN/Sendsms/Block/Sendsms.php +17 -0
  9. app/code/community/MN/Sendsms/Block/System/Config/Buycredits.php +21 -0
  10. app/code/community/MN/Sendsms/Block/System/Config/Info.php +23 -0
  11. app/code/community/MN/Sendsms/Helper/Data.php +206 -0
  12. app/code/community/MN/Sendsms/Model/Mysql4/Sendsms.php +10 -0
  13. app/code/community/MN/Sendsms/Model/Mysql4/Sendsms/Collection.php +10 -0
  14. app/code/community/MN/Sendsms/Model/Observer.php +215 -0
  15. app/code/community/MN/Sendsms/Model/Sendsms.php +10 -0
  16. app/code/community/MN/Sendsms/controllers/Adminhtml/SendsmsController.php +168 -0
  17. app/code/community/MN/Sendsms/controllers/IndexController.php +9 -0
  18. app/code/community/MN/Sendsms/etc/config.xml +237 -0
  19. app/code/community/MN/Sendsms/etc/system.xml +320 -0
  20. app/code/community/MN/Sendsms/sql/sendsms_setup/mysql4-install-1.0.0.php +24 -0
  21. app/design/adminhtml/default/default/layout/sendsms.xml +8 -0
  22. app/etc/modules/MN_Sendsms.xml +17 -0
  23. app/locale/en_US/MN_Sendsms.csv +53 -0
  24. package.xml +29 -0
app/code/community/MN/Sendsms/Block/Adminhtml/Sendsms.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MN_Sendsms_Block_Adminhtml_Sendsms extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_sendsms';
7
+ $this->_blockGroup = 'sendsms';
8
+ $this->_headerText = Mage::helper('sendsms')->__('Manage Text Messages');
9
+ $this->_addButtonLabel = Mage::helper('sendsms')->__('Send Manual SMS');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/community/MN/Sendsms/Block/Adminhtml/Sendsms/Edit.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MN_Sendsms_Block_Adminhtml_Sendsms_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'sendsms';
11
+ $this->_controller = 'adminhtml_sendsms';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('sendsms')->__('Send SMS'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('sendsms')->__('Delete Item'));
15
+
16
+ }
17
+
18
+ public function getHeaderText()
19
+ {
20
+ if( Mage::registry('sendsms_data') && Mage::registry('sendsms_data')->getId() ) {
21
+ return Mage::helper('sendsms')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('sendsms_data')->getTitle()));
22
+ } else {
23
+ return Mage::helper('sendsms')->__('Send Manual SMS');
24
+ }
25
+ }
26
+ }
app/code/community/MN/Sendsms/Block/Adminhtml/Sendsms/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MN_Sendsms_Block_Adminhtml_Sendsms_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/community/MN/Sendsms/Block/Adminhtml/Sendsms/Edit/Tab/Form.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MN_Sendsms_Block_Adminhtml_Sendsms_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('sendsms_form', array('legend'=>Mage::helper('sendsms')->__('SMS information')));
10
+
11
+ $fieldset->addField('from', 'text', array(
12
+ 'label' => Mage::helper('sendsms')->__('From'),
13
+ 'required' => true,
14
+ 'name' => 'from',
15
+ 'after_element_html' => '<br/><small>'.Mage::helper('sendsms')->__('Name or Telephone').'</small>',
16
+ ));
17
+
18
+ $fieldset->addField('to', 'text', array(
19
+ 'label' => Mage::helper('sendsms')->__('To (or Order number)'),
20
+ 'required' => true,
21
+ 'name' => 'to',
22
+ 'after_element_html' => '<br/><small>'.Mage::helper('sendsms')->__('Telephone (ex: +40740123456 or 100000001)').'</small>',
23
+ ));
24
+
25
+ $fieldset->addField('sms_message', 'editor', array(
26
+ 'name' => 'sms_message',
27
+ 'label' => Mage::helper('sendsms')->__('Message'),
28
+ 'title' => Mage::helper('sendsms')->__('Message'),
29
+ 'style' => 'width:274px; height:15em;',
30
+ 'after_element_html' => Mage::helper('sendsms')->__('Message Template (160 characters)'),
31
+ 'wysiwyg' => false,
32
+ 'required' => true,
33
+ ));
34
+
35
+ if ( Mage::getSingleton('adminhtml/session')->getSendsmsData() )
36
+ {
37
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getSendsmsData());
38
+ Mage::getSingleton('adminhtml/session')->setSendsmsData(null);
39
+ } elseif ( Mage::registry('sendsms_data') ) {
40
+ $form->setValues(Mage::registry('sendsms_data')->getData());
41
+ }
42
+ return parent::_prepareForm();
43
+ }
44
+ }
app/code/community/MN/Sendsms/Block/Adminhtml/Sendsms/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MN_Sendsms_Block_Adminhtml_Sendsms_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('sendsms_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('sendsms')->__('SMS Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('sendsms')->__('SMS Information'),
18
+ 'title' => Mage::helper('sendsms')->__('SMS Information'),
19
+ 'content' => $this->getLayout()->createBlock('sendsms/adminhtml_sendsms_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/community/MN/Sendsms/Block/Adminhtml/Sendsms/Grid.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MN_Sendsms_Block_Adminhtml_Sendsms_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('sendsmsGrid');
9
+ $this->setDefaultSort('sendsms_id');
10
+ $this->setDefaultDir('DESC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('sendsms/sendsms')->getCollection();
17
+ $this->setCollection($collection);
18
+ return parent::_prepareCollection();
19
+ }
20
+
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn('sendsms_id', array(
24
+ 'header' => Mage::helper('sendsms')->__('ID'),
25
+ 'align' =>'right',
26
+ 'width' => '50px',
27
+ 'index' => 'sendsms_id',
28
+ ));
29
+
30
+ $this->addColumn('order_id', array(
31
+ 'header' => Mage::helper('sendsms')->__('Order Id'),
32
+ 'align' =>'left',
33
+ 'index' => 'order_id',
34
+ ));
35
+
36
+ $this->addColumn('from', array(
37
+ 'header' => Mage::helper('sendsms')->__('From'),
38
+ 'align' =>'left',
39
+ 'index' => 'from',
40
+ ));
41
+
42
+ $this->addColumn('to', array(
43
+ 'header' => Mage::helper('sendsms')->__('To'),
44
+ 'align' =>'left',
45
+ 'index' => 'to',
46
+ ));
47
+
48
+ $this->addColumn('sms_message', array(
49
+ 'header' => Mage::helper('sendsms')->__('SMS Message'),
50
+ 'align' =>'left',
51
+ 'index' => 'sms_message',
52
+ ));
53
+
54
+ $this->addColumn('status', array(
55
+ 'header' => Mage::helper('sendsms')->__('Status'),
56
+ 'align' =>'left',
57
+ 'index' => 'status',
58
+ ));
59
+
60
+ $this->addColumn('status_message', array(
61
+ 'header' => Mage::helper('sendsms')->__('Status Message'),
62
+ 'align' =>'left',
63
+ 'index' => 'status_message',
64
+ ));
65
+
66
+ $this->addColumn('created_time', array(
67
+ 'header' => Mage::helper('sendsms')->__('Created Time'),
68
+ 'align' =>'left',
69
+ 'index' => 'created_time',
70
+ 'type' => 'datetime',
71
+ ));
72
+
73
+ return parent::_prepareColumns();
74
+ }
75
+
76
+ protected function _prepareMassaction()
77
+ {
78
+ $this->setMassactionIdField('sendsms_id');
79
+ $this->getMassactionBlock()->setFormFieldName('sendsms');
80
+
81
+ $this->getMassactionBlock()->addItem('delete', array(
82
+ 'label' => Mage::helper('sendsms')->__('Delete'),
83
+ 'url' => $this->getUrl('*/*/massDelete'),
84
+ 'confirm' => Mage::helper('sendsms')->__('Are you sure?')
85
+ ));
86
+
87
+ return $this;
88
+ }
89
+ }
app/code/community/MN/Sendsms/Block/Buttons.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MN_Sendsms_Block_Buttons extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ $this->setElement($element);
7
+ $url = 'http://www.24x.com/magentosms';
8
+
9
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
10
+ ->setType('button')
11
+ ->setClass('button')
12
+ ->setLabel(Mage::helper('sendsms')->__('Get an Account'))
13
+ ->setOnClick("window.open('$url','window1','width=870, height=705, scrollbars=1, resizable=1'); return false;")
14
+ ->toHtml();
15
+
16
+ return $html;
17
+ }
18
+ }
19
+ ?>
app/code/community/MN/Sendsms/Block/Sendsms.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MN_Sendsms_Block_Sendsms extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getSendsms()
10
+ {
11
+ if (!$this->hasData('sendsms')) {
12
+ $this->setData('sendsms', Mage::registry('sendsms'));
13
+ }
14
+ return $this->getData('sendsms');
15
+
16
+ }
17
+ }
app/code/community/MN/Sendsms/Block/System/Config/Buycredits.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MN_Sendsms_Block_System_Config_Buycredits
3
+ extends Mage_Adminhtml_Block_Abstract
4
+ implements Varien_Data_Form_Element_Renderer_Interface
5
+ {
6
+
7
+ /**
8
+ * Render fieldset html
9
+ *
10
+ * @param Varien_Data_Form_Element_Abstract $element
11
+ * @return string
12
+ */
13
+ public function render(Varien_Data_Form_Element_Abstract $element)
14
+ {
15
+ $html = '<div style="margin-bottom:10px;padding:10px 5px 5px;">
16
+ <iframe src="http://www.24x.com/magentosms" width="100%" height="705px"></iframe>
17
+ </div>';
18
+
19
+ return $html;
20
+ }
21
+ }
app/code/community/MN/Sendsms/Block/System/Config/Info.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MN_Sendsms_Block_System_Config_Info
3
+ extends Mage_Adminhtml_Block_Abstract
4
+ implements Varien_Data_Form_Element_Renderer_Interface
5
+ {
6
+
7
+ /**
8
+ * Render fieldset html
9
+ *
10
+ * @param Varien_Data_Form_Element_Abstract $element
11
+ * @return string
12
+ */
13
+ public function render(Varien_Data_Form_Element_Abstract $element)
14
+ {
15
+ $html = '<div style="border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px;">
16
+ <h4>Magento SMS - powered by 24X</h4>
17
+ <p>Find out more <a href="http://24x.com/contactus.aspx" target="_blank">about us</a></p>
18
+ <p>If you have any questions or need any help, feel free to contact us at <a href="mailto:magentosms@24xemail.com">magentosms@24xemail.com</a></p>
19
+ </div>';
20
+
21
+ return $html;
22
+ }
23
+ }
app/code/community/MN/Sendsms/Helper/Data.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MN_Sendsms_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ const CONFIG_PATH = 'sendsms/';
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 getUsername()
33
+ {
34
+ return Mage::getStoreConfig(self::CONFIG_PATH.'general/username');
35
+ }
36
+
37
+ public function getPassword()
38
+ {
39
+ return Mage::getStoreConfig(self::CONFIG_PATH.'general/password');
40
+ }
41
+
42
+ public function getSender()
43
+ {
44
+ return Mage::getStoreConfig(self::CONFIG_PATH.'orders/sender');
45
+ }
46
+
47
+ public function getSenderForOrderHold()
48
+ {
49
+ return Mage::getStoreConfig(self::CONFIG_PATH.'order_hold/sender');
50
+ }
51
+
52
+ public function getSenderForOrderUnhold()
53
+ {
54
+ return Mage::getStoreConfig(self::CONFIG_PATH.'order_unhold/sender');
55
+ }
56
+
57
+ public function getSenderForOrderCanceled()
58
+ {
59
+ return Mage::getStoreConfig(self::CONFIG_PATH.'order_canceled/sender');
60
+ }
61
+
62
+ public function getSenderForShipment()
63
+ {
64
+ return Mage::getStoreConfig(self::CONFIG_PATH.'shipments/sender');
65
+ }
66
+
67
+ public function getMessage(Mage_Sales_Model_Order $order)
68
+ {
69
+ $billingAddress = $order->getBillingAddress();
70
+ $whatArray = array('{{firstname}}');
71
+ $withWhatArray = array($billingAddress->getFirstname());
72
+
73
+ return str_replace($whatArray,$withWhatArray,Mage::getStoreConfig(self::CONFIG_PATH.'orders/message'));
74
+ }
75
+
76
+ public function getMessageForOrderHold(Mage_Sales_Model_Order $order)
77
+ {
78
+ $billingAddress = $order->getBillingAddress();
79
+ $whatArray = array('{{firstname}}','{{order_id}}');
80
+ $withWhatArray = array($billingAddress->getFirstname(),$order->getIncrementId());
81
+
82
+ return str_replace($whatArray,$withWhatArray,Mage::getStoreConfig(self::CONFIG_PATH.'order_hold/message'));
83
+ }
84
+
85
+ public function getMessageForOrderUnhold(Mage_Sales_Model_Order $order)
86
+ {
87
+ $billingAddress = $order->getBillingAddress();
88
+ $whatArray = array('{{firstname}}','{{order_id}}');
89
+ $withWhatArray = array($billingAddress->getFirstname(),$order->getIncrementId());
90
+
91
+ return str_replace($whatArray,$withWhatArray,Mage::getStoreConfig(self::CONFIG_PATH.'order_unhold/message'));
92
+ }
93
+
94
+ public function getMessageForOrderCanceled(Mage_Sales_Model_Order $order)
95
+ {
96
+ $billingAddress = $order->getBillingAddress();
97
+ $whatArray = array('{{firstname}}','{{order_id}}');
98
+ $withWhatArray = array($billingAddress->getFirstname(),$order->getIncrementId());
99
+
100
+ return str_replace($whatArray,$withWhatArray,Mage::getStoreConfig(self::CONFIG_PATH.'order_canceled/message'));
101
+ }
102
+
103
+ public function getMessageForShipment(Mage_Sales_Model_Order $order)
104
+ {
105
+ $billingAddress = $order->getBillingAddress();
106
+ $whatArray = array('{{firstname}}','{{order_id}}');
107
+ $withWhatArray = array($billingAddress->getFirstname(),$order->getIncrementId());
108
+
109
+ return str_replace($whatArray,$withWhatArray,Mage::getStoreConfig(self::CONFIG_PATH.'shipments/message'));
110
+ }
111
+
112
+ public function getTelephoneFromOrder(Mage_Sales_Model_Order $order)
113
+ {
114
+ $billingAddress = $order->getBillingAddress();
115
+
116
+ $number = $billingAddress->getTelephone();
117
+ $number = preg_replace('#[^\+\d]#', '', trim($number));
118
+
119
+ if (substr($number, 0, 1) === '+') {
120
+ $number = substr($number, 1);
121
+ } elseif (substr($number, 0, 2) === '00') {
122
+ $number = substr($number, 2);
123
+ } else {
124
+ if (substr($number, 0, 1) === '0') {
125
+ $number = substr($number, 1);
126
+ }
127
+ $expectedPrefix = Zend_Locale_Data::getContent(Mage::app()->getLocale()->getLocale(), 'phonetoterritory', $billingAddress->getCountry());
128
+ if (!empty($expectedPrefix)) {
129
+ $prefix = substr($number, 0, strlen($expectedPrefix));
130
+ if ($prefix !== $expectedPrefix) {
131
+ $number = $expectedPrefix . $number;
132
+ }
133
+ }
134
+ }
135
+ $number = preg_replace('#[^\d]#', '', trim($number));
136
+
137
+ return $number;
138
+ }
139
+
140
+ public function isOrdersNotify()
141
+ {
142
+ return Mage::getStoreConfig(self::CONFIG_PATH.'orders/notify');
143
+ }
144
+
145
+ public function getAdminTelephone()
146
+ {
147
+ return Mage::getStoreConfig(self::CONFIG_PATH.'orders/receiver');
148
+ }
149
+
150
+ public function sendSms($url) {
151
+ try {
152
+ $sendSms = $this->file_get_contents_curl($url);
153
+ }
154
+ catch(Exception $e) {
155
+ $sendSms = '';
156
+ }
157
+ if($sendSms) {
158
+ switch($sendSms) {
159
+ case '01':
160
+ $status_message = Mage::helper('sendsms')->__('24X Username or password incorrect.');
161
+ $status = Mage::helper('sendsms')->__('Not sent');
162
+ break;
163
+ case '02':
164
+ $status_message = Mage::helper('sendsms')->__('SmsTo missing.');
165
+ $status = Mage::helper('sendsms')->__('Not sent');
166
+ break;
167
+ case '03':
168
+ $status_message = Mage::helper('sendsms')->__('SmsFrom missing.');
169
+ $status = Mage::helper('sendsms')->__('Not sent');
170
+ break;
171
+ case '04':
172
+ $status_message = Mage::helper('sendsms')->__('SmsMsg missing.');
173
+ $status = Mage::helper('sendsms')->__('Not sent');
174
+ break;
175
+ case '09':
176
+ $status_message = Mage::helper('sendsms')->__('Insufficient credits.');
177
+ $status = Mage::helper('sendsms')->__('Not sent');
178
+ break;
179
+ default:
180
+ $status_message = Mage::helper('sendsms')->__('Sms successfully sent.');
181
+ $status = Mage::helper('sendsms')->__('Sent');
182
+ break;
183
+ }
184
+ }
185
+ else {
186
+ $status_message = Mage::helper('sendsms')->__('Not able to send the sms. Please contact the developer.');
187
+ $status = 'Not sent';
188
+ }
189
+ $ret['status_message'] = $status_message;
190
+ $ret['status'] = $status;
191
+ return $ret;
192
+ }
193
+
194
+ public function file_get_contents_curl($url) {
195
+ $ch = curl_init();
196
+
197
+ curl_setopt($ch, CURLOPT_HEADER, 0);
198
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
199
+ curl_setopt($ch, CURLOPT_URL, $url);
200
+
201
+ $data = curl_exec($ch);
202
+ curl_close($ch);
203
+
204
+ return $data;
205
+ }
206
+ }
app/code/community/MN/Sendsms/Model/Mysql4/Sendsms.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MN_Sendsms_Model_Mysql4_Sendsms extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the sendsms_id refers to the key field in your database table.
8
+ $this->_init('sendsms/sendsms', 'sendsms_id');
9
+ }
10
+ }
app/code/community/MN/Sendsms/Model/Mysql4/Sendsms/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MN_Sendsms_Model_Mysql4_Sendsms_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('sendsms/sendsms');
9
+ }
10
+ }
app/code/community/MN/Sendsms/Model/Observer.php ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MN_Sendsms_Model_Observer
3
+ {
4
+ public function sendSmsOnOrderCreated(Varien_Event_Observer $observer)
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.auto-cz.ro/";
11
+ $path = "MN/sendsms.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 = '?user=' . urlencode($username);
18
+ $data .= '&password=' . urlencode($password);
19
+ $data .= '&smsto=' . urlencode($smsto);
20
+ $data .= '&smsfrom=' . urlencode($smsfrom);
21
+ $data .= '&smsmsg=' . urlencode($smsmsg);
22
+ $url = $host.$path.$data;
23
+ $sendSms = $this->getHelper()->sendSms($url);
24
+ try {
25
+ Mage::getModel('sendsms/sendsms')
26
+ ->setOrderId($order->getIncrementId())
27
+ ->setFrom($smsfrom)
28
+ ->setTo($smsto)
29
+ ->setSmsMessage($smsmsg)
30
+ ->setStatus($sendSms['status'])
31
+ ->setStatusMessage($sendSms['status_message'])
32
+ ->setCreatedTime(now())
33
+ ->save();
34
+ }
35
+ catch (Exception $e) {}
36
+
37
+ if($this->getHelper()->isOrdersNotify() and $this->getHelper()->getAdminTelephone()) {
38
+ $smsto = $this->getHelper()->getAdminTelephone();
39
+ $smsmsg = Mage::helper('sendsms')->__('A new order has been placed: %s',$order->getIncrementId());
40
+ $data = '?user=' . urlencode($username);
41
+ $data .= '&password=' . urlencode($password);
42
+ $data .= '&smsto=' . urlencode($smsto);
43
+ $data .= '&smsfrom=' . urlencode($smsfrom);
44
+ $data .= '&smsmsg=' . urlencode($smsmsg);
45
+ $url = $host.$path.$data;
46
+ $sendSms = $this->getHelper()->sendSms($url);
47
+ try {
48
+ Mage::getModel('sendsms/sendsms')
49
+ ->setOrderId($order->getIncrementId())
50
+ ->setFrom($smsfrom)
51
+ ->setTo($smsto)
52
+ ->setSmsMessage($smsmsg)
53
+ ->setStatus($sendSms['status'])
54
+ ->setStatusMessage($sendSms['status_message'])
55
+ ->setCreatedTime(now())
56
+ ->save();
57
+ }
58
+ catch (Exception $e) {}
59
+ }
60
+ }
61
+ }
62
+ }
63
+
64
+ public function sendSmsOnOrderHold(Varien_Event_Observer $observer)
65
+ {
66
+ if($this->getHelper()->isOrderHoldEnabled()) {
67
+ $order = $observer->getOrder();
68
+ if ($order instanceof Mage_Sales_Model_Order) {
69
+ if ($order->getState() !== $order->getOrigData('state') && $order->getState() === Mage_Sales_Model_Order::STATE_HOLDED) {
70
+ $host = "http://www.auto-cz.ro/";
71
+ $path = "MN/sendsms.php";
72
+ $username = $this->getHelper()->getUsername();
73
+ $password = $this->getHelper()->getPassword();
74
+ $smsto = $this->getHelper()->getTelephoneFromOrder($order);
75
+ $smsfrom = $this->getHelper()->getSenderForOrderHold();
76
+ $smsmsg = $this->getHelper()->getMessageForOrderHold($order);
77
+ $data = '?user=' . urlencode($username);
78
+ $data .= '&password=' . urlencode($password);
79
+ $data .= '&smsto=' . urlencode($smsto);
80
+ $data .= '&smsfrom=' . urlencode($smsfrom);
81
+ $data .= '&smsmsg=' . urlencode($smsmsg);
82
+ $url = $host.$path.$data;
83
+ $sendSms = $this->getHelper()->sendSms($url);
84
+ try {
85
+ Mage::getModel('sendsms/sendsms')
86
+ ->setOrderId($order->getIncrementId())
87
+ ->setFrom($smsfrom)
88
+ ->setTo($smsto)
89
+ ->setSmsMessage($smsmsg)
90
+ ->setStatus($sendSms['status'])
91
+ ->setStatusMessage($sendSms['status_message'])
92
+ ->setCreatedTime(now())
93
+ ->save();
94
+ }
95
+ catch (Exception $e) {}
96
+ }
97
+ }
98
+ }
99
+ }
100
+
101
+ public function sendSmsOnOrderUnhold(Varien_Event_Observer $observer)
102
+ {
103
+ if($this->getHelper()->isOrderUnholdEnabled()) {
104
+ $order = $observer->getOrder();
105
+ if ($order instanceof Mage_Sales_Model_Order) {
106
+ if ($order->getState() !== $order->getOrigData('state') && $order->getOrigData('state') === Mage_Sales_Model_Order::STATE_HOLDED) {
107
+ $host = "http://www.auto-cz.ro/";
108
+ $path = "MN/sendsms.php";
109
+ $username = $this->getHelper()->getUsername();
110
+ $password = $this->getHelper()->getPassword();
111
+ $smsto = $this->getHelper()->getTelephoneFromOrder($order);
112
+ $smsfrom = $this->getHelper()->getSenderForOrderUnhold();
113
+ $smsmsg = $this->getHelper()->getMessageForOrderUnhold($order);
114
+ $data = '?user=' . urlencode($username);
115
+ $data .= '&password=' . urlencode($password);
116
+ $data .= '&smsto=' . urlencode($smsto);
117
+ $data .= '&smsfrom=' . urlencode($smsfrom);
118
+ $data .= '&smsmsg=' . urlencode($smsmsg);
119
+ $url = $host.$path.$data;
120
+ $sendSms = $this->getHelper()->sendSms($url);
121
+ try {
122
+ Mage::getModel('sendsms/sendsms')
123
+ ->setOrderId($order->getIncrementId())
124
+ ->setFrom($smsfrom)
125
+ ->setTo($smsto)
126
+ ->setSmsMessage($smsmsg)
127
+ ->setStatus($sendSms['status'])
128
+ ->setStatusMessage($sendSms['status_message'])
129
+ ->setCreatedTime(now())
130
+ ->save();
131
+ }
132
+ catch (Exception $e) {}
133
+ }
134
+ }
135
+ }
136
+ }
137
+
138
+ public function sendSmsOnOrderCanceled(Varien_Event_Observer $observer)
139
+ {
140
+ if($this->getHelper()->isOrderCanceledEnabled()) {
141
+ $order = $observer->getOrder();
142
+ if ($order instanceof Mage_Sales_Model_Order) {
143
+ if ($order->getState() !== $order->getOrigData('state') && $order->getState() === Mage_Sales_Model_Order::STATE_CANCELED) {
144
+ $host = "http://www.auto-cz.ro/";
145
+ $path = "MN/sendsms.php";
146
+ $username = $this->getHelper()->getUsername();
147
+ $password = $this->getHelper()->getPassword();
148
+ $smsto = $this->getHelper()->getTelephoneFromOrder($order);
149
+ $smsfrom = $this->getHelper()->getSenderForOrderCanceled();
150
+ $smsmsg = $this->getHelper()->getMessageForOrderCanceled($order);
151
+ $data = '?user=' . urlencode($username);
152
+ $data .= '&password=' . urlencode($password);
153
+ $data .= '&smsto=' . urlencode($smsto);
154
+ $data .= '&smsfrom=' . urlencode($smsfrom);
155
+ $data .= '&smsmsg=' . urlencode($smsmsg);
156
+ $url = $host.$path.$data;
157
+ $sendSms = $this->getHelper()->sendSms($url);
158
+ try {
159
+ Mage::getModel('sendsms/sendsms')
160
+ ->setOrderId($order->getIncrementId())
161
+ ->setFrom($smsfrom)
162
+ ->setTo($smsto)
163
+ ->setSmsMessage($smsmsg)
164
+ ->setStatus($sendSms['status'])
165
+ ->setStatusMessage($sendSms['status_message'])
166
+ ->setCreatedTime(now())
167
+ ->save();
168
+ }
169
+ catch (Exception $e) {}
170
+ }
171
+ }
172
+ }
173
+ }
174
+
175
+ public function sendSmsOnShipmentCreated(Varien_Event_Observer $observer)
176
+ {
177
+ if($this->getHelper()->isShipmentsEnabled()) {
178
+ $shipment = $observer->getEvent()->getShipment();
179
+ $order = $shipment->getOrder();
180
+ if ($order instanceof Mage_Sales_Model_Order) {
181
+ $host = "http://www.auto-cz.ro/";
182
+ $path = "MN/sendsms.php";
183
+ $username = $this->getHelper()->getUsername();
184
+ $password = $this->getHelper()->getPassword();
185
+ $smsto = $this->getHelper()->getTelephoneFromOrder($order);
186
+ $smsfrom = $this->getHelper()->getSenderForShipment();
187
+ $smsmsg = $this->getHelper()->getMessageForShipment($order);
188
+ $data = '?user=' . urlencode($username);
189
+ $data .= '&password=' . urlencode($password);
190
+ $data .= '&smsto=' . urlencode($smsto);
191
+ $data .= '&smsfrom=' . urlencode($smsfrom);
192
+ $data .= '&smsmsg=' . urlencode($smsmsg);
193
+ $url = $host.$path.$data;
194
+ $sendSms = $this->getHelper()->sendSms($url);
195
+ try {
196
+ Mage::getModel('sendsms/sendsms')
197
+ ->setOrderId($order->getIncrementId())
198
+ ->setFrom($smsfrom)
199
+ ->setTo($smsto)
200
+ ->setSmsMessage($smsmsg)
201
+ ->setStatus($sendSms['status'])
202
+ ->setStatusMessage($sendSms['status_message'])
203
+ ->setCreatedTime(now())
204
+ ->save();
205
+ }
206
+ catch (Exception $e) {}
207
+ }
208
+ }
209
+ }
210
+
211
+ public function getHelper()
212
+ {
213
+ return Mage::helper('sendsms/Data');
214
+ }
215
+ }
app/code/community/MN/Sendsms/Model/Sendsms.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MN_Sendsms_Model_Sendsms extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('sendsms/sendsms');
9
+ }
10
+ }
app/code/community/MN/Sendsms/controllers/Adminhtml/SendsmsController.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MN_Sendsms_Adminhtml_SendsmsController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('sendsms/items')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+ public function editAction() {
20
+ $id = $this->getRequest()->getParam('id');
21
+ $model = Mage::getModel('sendsms/sendsms')->load($id);
22
+
23
+ if ($model->getId() || $id == 0) {
24
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
25
+ if (!empty($data)) {
26
+ $model->setData($data);
27
+ }
28
+
29
+ Mage::register('sendsms_data', $model);
30
+
31
+ $this->loadLayout();
32
+ $this->_setActiveMenu('sendsms/items');
33
+
34
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
35
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
36
+
37
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
38
+
39
+ $this->_addContent($this->getLayout()->createBlock('sendsms/adminhtml_sendsms_edit'))
40
+ ->_addLeft($this->getLayout()->createBlock('sendsms/adminhtml_sendsms_edit_tabs'));
41
+
42
+ $this->renderLayout();
43
+ } else {
44
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sendsms')->__('Item does not exist'));
45
+ $this->_redirect('*/*/');
46
+ }
47
+ }
48
+
49
+ public function newAction() {
50
+ $this->_forward('edit');
51
+ }
52
+
53
+ public function saveAction() {
54
+ if ($data = $this->getRequest()->getPost()) {
55
+
56
+ //check if destination input is an order
57
+ $order = Mage::getModel('sales/order')->loadByIncrementId($data['to']);
58
+ if($order instanceof Mage_Sales_Model_Order and $order->getData()) {
59
+ $data['to'] = $this->getHelper()->getTelephoneFromOrder($order);
60
+ }
61
+
62
+ //send the SMS
63
+ $host = "http://www.auto-cz.ro/";
64
+ $path = "MN/sendsms.php";
65
+ $username = $this->getHelper()->getUsername();
66
+ $password = $this->getHelper()->getPassword();
67
+ $smsto = $data['to'];
68
+ $smsfrom = $data['from'];
69
+ $smsmsg = $data['sms_message'];
70
+ $_data = '?user=' . urlencode($username);
71
+ $_data .= '&password=' . urlencode($password);
72
+ $_data .= '&smsto=' . urlencode($smsto);
73
+ $_data .= '&smsfrom=' . urlencode($smsfrom);
74
+ $_data .= '&smsmsg=' . urlencode($smsmsg);
75
+ $url = $host.$path.$_data;
76
+ $sendSms = $this->getHelper()->sendSms($url);
77
+ $data['status'] = $sendSms['status'];
78
+ $data['status_message'] = $sendSms['status_message'];
79
+
80
+ $model = Mage::getModel('sendsms/sendsms');
81
+ $model->setData($data)
82
+ ->setId($this->getRequest()->getParam('id'));
83
+
84
+ try {
85
+ $model->setCreatedTime(now());
86
+ $model->save();
87
+
88
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sendsms')->__('Item was successfully saved'));
89
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
90
+
91
+ if ($this->getRequest()->getParam('back')) {
92
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
93
+ return;
94
+ }
95
+ $this->_redirect('*/*/');
96
+ return;
97
+ } catch (Exception $e) {
98
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
99
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
100
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
101
+ return;
102
+ }
103
+ }
104
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sendsms')->__('Unable to find item to save'));
105
+ $this->_redirect('*/*/');
106
+ }
107
+
108
+ public function deleteAction() {
109
+ if( $this->getRequest()->getParam('id') > 0 ) {
110
+ try {
111
+ $model = Mage::getModel('sendsms/sendsms');
112
+
113
+ $model->setId($this->getRequest()->getParam('id'))
114
+ ->delete();
115
+
116
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
117
+ $this->_redirect('*/*/');
118
+ } catch (Exception $e) {
119
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
120
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
121
+ }
122
+ }
123
+ $this->_redirect('*/*/');
124
+ }
125
+
126
+ public function massDeleteAction() {
127
+ $sendsmsIds = $this->getRequest()->getParam('sendsms');
128
+ if(!is_array($sendsmsIds)) {
129
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
130
+ } else {
131
+ try {
132
+ foreach ($sendsmsIds as $sendsmsId) {
133
+ $sendsms = Mage::getModel('sendsms/sendsms')->load($sendsmsId);
134
+ $sendsms->delete();
135
+ }
136
+ Mage::getSingleton('adminhtml/session')->addSuccess(
137
+ Mage::helper('adminhtml')->__(
138
+ 'Total of %d record(s) were successfully deleted', count($sendsmsIds)
139
+ )
140
+ );
141
+ } catch (Exception $e) {
142
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
143
+ }
144
+ }
145
+ $this->_redirect('*/*/index');
146
+ }
147
+
148
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
149
+ {
150
+ $response = $this->getResponse();
151
+ $response->setHeader('HTTP/1.1 200 OK','');
152
+ $response->setHeader('Pragma', 'public', true);
153
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
154
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
155
+ $response->setHeader('Last-Modified', date('r'));
156
+ $response->setHeader('Accept-Ranges', 'bytes');
157
+ $response->setHeader('Content-Length', strlen($content));
158
+ $response->setHeader('Content-type', $contentType);
159
+ $response->setBody($content);
160
+ $response->sendResponse();
161
+ die;
162
+ }
163
+
164
+ public function getHelper()
165
+ {
166
+ return Mage::helper('sendsms/Data');
167
+ }
168
+ }
app/code/community/MN/Sendsms/controllers/IndexController.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MN_Sendsms_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->renderLayout();
8
+ }
9
+ }
app/code/community/MN/Sendsms/etc/config.xml ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <MN_Sendsms>
13
+ <version>1.0.0</version>
14
+ </MN_Sendsms>
15
+ </modules>
16
+ <admin>
17
+ <routers>
18
+ <sendsms>
19
+ <use>admin</use>
20
+ <args>
21
+ <module>MN_Sendsms</module>
22
+ <frontName>sendsms</frontName>
23
+ </args>
24
+ </sendsms>
25
+ </routers>
26
+ </admin>
27
+ <adminhtml>
28
+ <translate>
29
+ <modules>
30
+ <mn_sendsms>
31
+ <files>
32
+ <default>MN_Sendsms.csv</default>
33
+ </files>
34
+ </mn_sendsms>
35
+ </modules>
36
+ </translate>
37
+ <menu>
38
+ <sendsms translate="title" module="sendsms">
39
+ <title>24x</title>
40
+ <sort_order>71</sort_order>
41
+ <children>
42
+ <credits translate="title" module="sendsms">
43
+ <title>Buy Credits/Pricing</title>
44
+ <sort_order>0</sort_order>
45
+ <action>adminhtml/system_config/edit/section/buycredits</action>
46
+ </credits>
47
+ <items translate="title" module="sendsms">
48
+ <title>Manage Text Messages</title>
49
+ <sort_order>5</sort_order>
50
+ <action>sendsms/adminhtml_sendsms</action>
51
+ </items>
52
+ <manual translate="title" module="sendsms">
53
+ <title>Send Manual Message(s)</title>
54
+ <sort_order>10</sort_order>
55
+ <action>sendsms/adminhtml_sendsms/new</action>
56
+ </manual>
57
+ <settings translate="title" module="sendsms">
58
+ <title>Settings</title>
59
+ <sort_order>15</sort_order>
60
+ <action>adminhtml/system_config/edit/section/sendsms</action>
61
+ </settings>
62
+ </children>
63
+ </sendsms>
64
+ </menu>
65
+ <acl>
66
+ <resources>
67
+ <all>
68
+ <title>Allow Everything</title>
69
+ </all>
70
+ <admin>
71
+ <children>
72
+ <sendsms translate="title" module="sendsms">
73
+ <title>24x</title>
74
+ <sort_order>71</sort_order>
75
+ <children>
76
+ <credits translate="title" module="sendsms">
77
+ <title>Buy Credits/Pricing</title>
78
+ <sort_order>0</sort_order>
79
+ </credits>
80
+ <items translate="title" module="sendsms">
81
+ <title>Manage Text Messages</title>
82
+ <sort_order>5</sort_order>
83
+ </items>
84
+ <manual translate="title" module="sendsms">
85
+ <title>Send Manual Message(s)</title>
86
+ <sort_order>10</sort_order>
87
+ </manual>
88
+ <settings translate="title" module="sendsms">
89
+ <title>Settings</title>
90
+ <sort_order>15</sort_order>
91
+ </settings>
92
+ </children>
93
+ </sendsms>
94
+ <system>
95
+ <children>
96
+ <config>
97
+ <children>
98
+ <sendsms translate="title" module="sendsms">
99
+ <title>Sms Notifications</title>
100
+ <sort_order>50</sort_order>
101
+ </sendsms>
102
+ <buycredits translate="title" module="sendsms">
103
+ <title>Buy Credits/Pricing</title>
104
+ <sort_order>55</sort_order>
105
+ </buycredits>
106
+ </children>
107
+ </config>
108
+ </children>
109
+ </system>
110
+ </children>
111
+ </admin>
112
+ </resources>
113
+ </acl>
114
+ <layout>
115
+ <updates>
116
+ <sendsms>
117
+ <file>sendsms.xml</file>
118
+ </sendsms>
119
+ </updates>
120
+ </layout>
121
+ </adminhtml>
122
+ <global>
123
+ <models>
124
+ <sendsms>
125
+ <class>MN_Sendsms_Model</class>
126
+ <resourceModel>sendsms_mysql4</resourceModel>
127
+ </sendsms>
128
+ <sendsms_mysql4>
129
+ <class>MN_Sendsms_Model_Mysql4</class>
130
+ <entities>
131
+ <sendsms>
132
+ <table>sendsms</table>
133
+ </sendsms>
134
+ </entities>
135
+ </sendsms_mysql4>
136
+ </models>
137
+ <resources>
138
+ <sendsms_setup>
139
+ <setup>
140
+ <module>MN_Sendsms</module>
141
+ </setup>
142
+ <connection>
143
+ <use>core_setup</use>
144
+ </connection>
145
+ </sendsms_setup>
146
+ <sendsms_write>
147
+ <connection>
148
+ <use>core_write</use>
149
+ </connection>
150
+ </sendsms_write>
151
+ <sendsms_read>
152
+ <connection>
153
+ <use>core_read</use>
154
+ </connection>
155
+ </sendsms_read>
156
+ </resources>
157
+ <blocks>
158
+ <sendsms>
159
+ <class>MN_Sendsms_Block</class>
160
+ </sendsms>
161
+ </blocks>
162
+ <helpers>
163
+ <sendsms>
164
+ <class>MN_Sendsms_Helper</class>
165
+ </sendsms>
166
+ </helpers>
167
+ <events>
168
+ <checkout_onepage_controller_success_action>
169
+ <observers>
170
+ <MN_Sendsms_Created>
171
+ <type>singleton</type>
172
+ <class>MN_Sendsms_Model_Observer</class>
173
+ <method>sendSmsOnOrderCreated</method>
174
+ </MN_Sendsms_Created>
175
+ </observers>
176
+ </checkout_onepage_controller_success_action>
177
+ <sales_order_save_after>
178
+ <observers>
179
+ <MN_Sendsms_Order_Hold>
180
+ <type>singleton</type>
181
+ <class>MN_Sendsms_Model_Observer</class>
182
+ <method>sendSmsOnOrderHold</method>
183
+ </MN_Sendsms_Order_Hold>
184
+ <MN_Sendsms_Order_Unhold>
185
+ <type>singleton</type>
186
+ <class>MN_Sendsms_Model_Observer</class>
187
+ <method>sendSmsOnOrderUnhold</method>
188
+ </MN_Sendsms_Order_Unhold>
189
+ <MN_Sendsms_Order_Canceled>
190
+ <type>singleton</type>
191
+ <class>MN_Sendsms_Model_Observer</class>
192
+ <method>sendSmsOnOrderCanceled</method>
193
+ </MN_Sendsms_Order_Canceled>
194
+ </observers>
195
+ </sales_order_save_after>
196
+ <sales_order_shipment_save_after>
197
+ <observers>
198
+ <MN_Sendsms_Shipment_Created>
199
+ <type>singleton</type>
200
+ <class>MN_Sendsms_Model_Observer</class>
201
+ <method>sendSmsOnShipmentCreated</method>
202
+ </MN_Sendsms_Shipment_Created>
203
+ </observers>
204
+ </sales_order_shipment_save_after>
205
+ </events>
206
+ </global>
207
+ <default>
208
+ <sendsms>
209
+ <orders>
210
+ <enabled>0</enabled>
211
+ <sender>Magento</sender>
212
+ <message>Hello {{firstname}}. Your order has been received. Thank you for your purchase!</message>
213
+ <notify>0</notify>
214
+ </orders>
215
+ <order_hold>
216
+ <enabled>0</enabled>
217
+ <sender>Magento</sender>
218
+ <message>Hello {{firstname}}. Your order {{order_id}} has been placed on hold.</message>
219
+ </order_hold>
220
+ <order_unhold>
221
+ <enabled>0</enabled>
222
+ <sender>Magento</sender>
223
+ <message>Hello {{firstname}}. Your order {{order_id}} has been released from holding status.</message>
224
+ </order_unhold>
225
+ <order_canceled>
226
+ <enabled>0</enabled>
227
+ <sender>Magento</sender>
228
+ <message>Hello {{firstname}}. Your order {{order_id}} has been canceled.</message>
229
+ </order_canceled>
230
+ <shipments>
231
+ <enabled>0</enabled>
232
+ <sender>Magento</sender>
233
+ <message>Hello {{firstname}}. Your order ({{order_id}}) has been shipped. Thank you for buying from us!</message>
234
+ </shipments>
235
+ </sendsms>
236
+ </default>
237
+ </config>
app/code/community/MN/Sendsms/etc/system.xml ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <mn translate="label" module="sendsms">
5
+ <label>24x</label>
6
+ <sort_order>300</sort_order>
7
+ </mn>
8
+ </tabs>
9
+ <sections>
10
+ <sendsms translate="label" module="sendsms">
11
+ <label>Sms Notifications</label>
12
+ <tab>mn</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
+ <info>
20
+ <frontend_model>sendsms/system_config_info</frontend_model>
21
+ <sort_order>0</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ </info>
26
+ <getting translate="label">
27
+ <label>Getting Started</label>
28
+ <frontend_type>text</frontend_type>
29
+ <sort_order>5</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ <fields>
34
+ <buttons translate="label comment">
35
+ <label>Get a FREE account with 5 FREE credits</label>
36
+ <comment>If you are outside the UK please email magentosms@24xemail.com for an account. This is to ensure that your account will operate through the fastest and most reliable routes within your country.</comment>
37
+ <frontend_model>sendsms/buttons</frontend_model>
38
+ <sort_order>0</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ </buttons>
43
+ </fields>
44
+ </getting>
45
+ <general translate="label">
46
+ <label>General</label>
47
+ <frontend_type>text</frontend_type>
48
+ <sort_order>10</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ <fields>
53
+ <username translate="label">
54
+ <label>24X Username</label>
55
+ <frontend_type>text</frontend_type>
56
+ <sort_order>5</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ </username>
61
+ <password translate="label">
62
+ <label>24X Password</label>
63
+ <frontend_type>password</frontend_type>
64
+ <sort_order>10</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ </password>
69
+ </fields>
70
+ </general>
71
+ <orders translate="label">
72
+ <label>Orders</label>
73
+ <frontend_type>text</frontend_type>
74
+ <sort_order>15</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>1</show_in_store>
78
+ <fields>
79
+ <enabled translate="label comment">
80
+ <label>Enabled</label>
81
+ <comment>Automatically sends a text message to the customer when an order is made</comment>
82
+ <frontend_type>select</frontend_type>
83
+ <source_model>adminhtml/system_config_source_yesno</source_model>
84
+ <sort_order>5</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ </enabled>
89
+ <sender translate="label comment">
90
+ <label>Sender</label>
91
+ <comment>Name of the sender</comment>
92
+ <validate>required-entry</validate>
93
+ <frontend_type>text</frontend_type>
94
+ <sort_order>10</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
+ </sender>
99
+ <message translate="label comment">
100
+ <label>Message</label>
101
+ <comment>Message Template (160 characters)</comment>
102
+ <tooltip>{{firstname}} = First Name</tooltip>
103
+ <validate>required-entry</validate>
104
+ <frontend_type>textarea</frontend_type>
105
+ <sort_order>15</sort_order>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>1</show_in_website>
108
+ <show_in_store>1</show_in_store>
109
+ </message>
110
+ <notify translate="label comment">
111
+ <label>Notify Admin</label>
112
+ <comment>Automatically sends a text message also to the Admin when an order is made</comment>
113
+ <frontend_type>select</frontend_type>
114
+ <source_model>adminhtml/system_config_source_yesno</source_model>
115
+ <sort_order>20</sort_order>
116
+ <show_in_default>1</show_in_default>
117
+ <show_in_website>1</show_in_website>
118
+ <show_in_store>1</show_in_store>
119
+ </notify>
120
+ <receiver translate="label comment">
121
+ <label>Admin Telephone</label>
122
+ <comment>ex: +40740123456</comment>
123
+ <validate>required-entry</validate>
124
+ <frontend_type>text</frontend_type>
125
+ <sort_order>25</sort_order>
126
+ <show_in_default>1</show_in_default>
127
+ <show_in_website>1</show_in_website>
128
+ <show_in_store>1</show_in_store>
129
+ <depends>
130
+ <notify>1</notify>
131
+ </depends>
132
+ </receiver>
133
+ </fields>
134
+ </orders>
135
+ <order_hold translate="label">
136
+ <label>Order Hold</label>
137
+ <frontend_type>text</frontend_type>
138
+ <sort_order>20</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>1</show_in_store>
142
+ <fields>
143
+ <enabled translate="label comment">
144
+ <label>Enabled</label>
145
+ <comment>Automatically sends a text message to the customer when an order is placed on hold</comment>
146
+ <frontend_type>select</frontend_type>
147
+ <source_model>adminhtml/system_config_source_yesno</source_model>
148
+ <sort_order>5</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
+ </enabled>
153
+ <sender translate="label comment">
154
+ <label>Sender</label>
155
+ <comment>Name of the sender</comment>
156
+ <validate>required-entry</validate>
157
+ <frontend_type>text</frontend_type>
158
+ <sort_order>10</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
+ </sender>
163
+ <message translate="label comment">
164
+ <label>Message</label>
165
+ <comment>Message Template (160 characters)</comment>
166
+ <tooltip>{{firstname}} = First Name {{order_id}} = Order Id</tooltip>
167
+ <validate>required-entry</validate>
168
+ <frontend_type>textarea</frontend_type>
169
+ <sort_order>15</sort_order>
170
+ <show_in_default>1</show_in_default>
171
+ <show_in_website>1</show_in_website>
172
+ <show_in_store>1</show_in_store>
173
+ </message>
174
+ </fields>
175
+ </order_hold>
176
+ <order_unhold translate="label">
177
+ <label>Order Unhold</label>
178
+ <frontend_type>text</frontend_type>
179
+ <sort_order>25</sort_order>
180
+ <show_in_default>1</show_in_default>
181
+ <show_in_website>1</show_in_website>
182
+ <show_in_store>1</show_in_store>
183
+ <fields>
184
+ <enabled translate="label comment">
185
+ <label>Enabled</label>
186
+ <comment>Automatically sends a text message to the customer when an order has been released from holding status</comment>
187
+ <frontend_type>select</frontend_type>
188
+ <source_model>adminhtml/system_config_source_yesno</source_model>
189
+ <sort_order>5</sort_order>
190
+ <show_in_default>1</show_in_default>
191
+ <show_in_website>1</show_in_website>
192
+ <show_in_store>1</show_in_store>
193
+ </enabled>
194
+ <sender translate="label comment">
195
+ <label>Sender</label>
196
+ <comment>Name of the sender</comment>
197
+ <validate>required-entry</validate>
198
+ <frontend_type>text</frontend_type>
199
+ <sort_order>10</sort_order>
200
+ <show_in_default>1</show_in_default>
201
+ <show_in_website>1</show_in_website>
202
+ <show_in_store>1</show_in_store>
203
+ </sender>
204
+ <message translate="label comment">
205
+ <label>Message</label>
206
+ <comment>Message Template (160 characters)</comment>
207
+ <tooltip>{{firstname}} = First Name {{order_id}} = Order Id</tooltip>
208
+ <validate>required-entry</validate>
209
+ <frontend_type>textarea</frontend_type>
210
+ <sort_order>15</sort_order>
211
+ <show_in_default>1</show_in_default>
212
+ <show_in_website>1</show_in_website>
213
+ <show_in_store>1</show_in_store>
214
+ </message>
215
+ </fields>
216
+ </order_unhold>
217
+ <order_canceled translate="label">
218
+ <label>Order Canceled</label>
219
+ <frontend_type>text</frontend_type>
220
+ <sort_order>30</sort_order>
221
+ <show_in_default>1</show_in_default>
222
+ <show_in_website>1</show_in_website>
223
+ <show_in_store>1</show_in_store>
224
+ <fields>
225
+ <enabled translate="label comment">
226
+ <label>Enabled</label>
227
+ <comment>Automatically sends a text message to the customer when an order has been canceled</comment>
228
+ <frontend_type>select</frontend_type>
229
+ <source_model>adminhtml/system_config_source_yesno</source_model>
230
+ <sort_order>5</sort_order>
231
+ <show_in_default>1</show_in_default>
232
+ <show_in_website>1</show_in_website>
233
+ <show_in_store>1</show_in_store>
234
+ </enabled>
235
+ <sender translate="label comment">
236
+ <label>Sender</label>
237
+ <comment>Name of the sender</comment>
238
+ <validate>required-entry</validate>
239
+ <frontend_type>text</frontend_type>
240
+ <sort_order>10</sort_order>
241
+ <show_in_default>1</show_in_default>
242
+ <show_in_website>1</show_in_website>
243
+ <show_in_store>1</show_in_store>
244
+ </sender>
245
+ <message translate="label comment">
246
+ <label>Message</label>
247
+ <comment>Message Template (160 characters)</comment>
248
+ <tooltip>{{firstname}} = First Name {{order_id}} = Order Id</tooltip>
249
+ <validate>required-entry</validate>
250
+ <frontend_type>textarea</frontend_type>
251
+ <sort_order>15</sort_order>
252
+ <show_in_default>1</show_in_default>
253
+ <show_in_website>1</show_in_website>
254
+ <show_in_store>1</show_in_store>
255
+ </message>
256
+ </fields>
257
+ </order_canceled>
258
+ <shipments translate="label">
259
+ <label>Shipments</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>
265
+ <fields>
266
+ <enabled translate="label comment">
267
+ <label>Enabled</label>
268
+ <comment>Automatically sends a text message to the customer when the shipment is made</comment>
269
+ <frontend_type>select</frontend_type>
270
+ <source_model>adminhtml/system_config_source_yesno</source_model>
271
+ <sort_order>5</sort_order>
272
+ <show_in_default>1</show_in_default>
273
+ <show_in_website>1</show_in_website>
274
+ <show_in_store>1</show_in_store>
275
+ </enabled>
276
+ <sender translate="label comment">
277
+ <label>Sender</label>
278
+ <comment>Name of the sender</comment>
279
+ <validate>required-entry</validate>
280
+ <frontend_type>text</frontend_type>
281
+ <sort_order>10</sort_order>
282
+ <show_in_default>1</show_in_default>
283
+ <show_in_website>1</show_in_website>
284
+ <show_in_store>1</show_in_store>
285
+ </sender>
286
+ <message translate="label comment">
287
+ <label>Message</label>
288
+ <comment>Message Template (160 characters)</comment>
289
+ <tooltip>{{firstname}} = First Name {{order_id}} = Order Id</tooltip>
290
+ <validate>required-entry</validate>
291
+ <frontend_type>textarea</frontend_type>
292
+ <sort_order>15</sort_order>
293
+ <show_in_default>1</show_in_default>
294
+ <show_in_website>1</show_in_website>
295
+ <show_in_store>1</show_in_store>
296
+ </message>
297
+ </fields>
298
+ </shipments>
299
+ </groups>
300
+ </sendsms>
301
+ <buycredits translate="label" module="sendsms">
302
+ <label>Buy Credits/Pricing</label>
303
+ <tab>mn</tab>
304
+ <frontend_type>text</frontend_type>
305
+ <sort_order>210</sort_order>
306
+ <show_in_default>1</show_in_default>
307
+ <show_in_website>1</show_in_website>
308
+ <show_in_store>1</show_in_store>
309
+ <groups>
310
+ <info>
311
+ <frontend_model>sendsms/system_config_buycredits</frontend_model>
312
+ <sort_order>10</sort_order>
313
+ <show_in_default>1</show_in_default>
314
+ <show_in_website>1</show_in_website>
315
+ <show_in_store>1</show_in_store>
316
+ </info>
317
+ </groups>
318
+ </buycredits>
319
+ </sections>
320
+ </config>
app/code/community/MN/Sendsms/sql/sendsms_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ DROP TABLE IF EXISTS {$this->getTable('sendsms')};
10
+ CREATE TABLE {$this->getTable('sendsms')} (
11
+ `sendsms_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
12
+ `order_id` varchar(255) NOT NULL DEFAULT '',
13
+ `from` varchar(255) NOT NULL DEFAULT '',
14
+ `to` varchar(255) NOT NULL DEFAULT '',
15
+ `sms_message` text NOT NULL,
16
+ `status` varchar(255) NOT NULL DEFAULT '',
17
+ `status_message` varchar(255) NOT NULL DEFAULT '',
18
+ `created_time` datetime DEFAULT NULL,
19
+ PRIMARY KEY (`sendsms_id`)
20
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
21
+
22
+ ");
23
+
24
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/sendsms.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <sendsms_adminhtml_sendsms_index>
4
+ <reference name="content">
5
+ <block type="sendsms/adminhtml_sendsms" name="sendsms" />
6
+ </reference>
7
+ </sendsms_adminhtml_sendsms_index>
8
+ </layout>
app/etc/modules/MN_Sendsms.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <MN_Sendsms>
13
+ <active>true</active>
14
+ <codePool>community</codePool>
15
+ </MN_Sendsms>
16
+ </modules>
17
+ </config>
app/locale/en_US/MN_Sendsms.csv ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "24x","24x"
2
+ "Manage Text Messages","Manage Text Messages"
3
+ "Send Manual Message(s)","Send Manual Message(s)"
4
+ "Settings","Settings"
5
+ "Sms Notifications","Sms Notifications"
6
+ "Buy Credits/Pricing","Buy Credits/Pricing"
7
+ "Getting Started","Getting Started"
8
+ "Get an Account","Get an Account"
9
+ "Get a FREE account with 5 FREE credits","Get a FREE account with 5 FREE credits"
10
+ "If you are outside the UK please email magentosms@24xemail.com for an account. This is to ensure that your account will operate through the fastest and most reliable routes within your country.","If you are outside the UK please email magentosms@24xemail.com for an account. This is to ensure that your account will operate through the fastest and most reliable routes within your country."
11
+ "General","General"
12
+ "24X Username","24X Username"
13
+ "24X Password","24X Password"
14
+ "Orders","Orders"
15
+ "Enabled","Enabled"
16
+ "Automatically sends a text message to the customer when an order is made","Automatically sends a text message to the customer when an order is made"
17
+ "Sender","Sender"
18
+ "Name of the sender","Name of the sender"
19
+ "Message","Message"
20
+ "Message Template (160 characters)","Message Template (160 characters)"
21
+ "Notify Admin","Notify Admin"
22
+ "Automatically sends a text message also to the Admin when an order is made","Automatically sends a text message also to the Admin when an order is made"
23
+ "Admin Telephone","Admin Telephone"
24
+ "ex: +40740123456","ex: +40740123456"
25
+ "A new order has been placed: %s","A new order has been placed: %s"
26
+ "Order Hold","Order Hold"
27
+ "Automatically sends a text message to the customer when an order is placed on hold","Automatically sends a text message to the customer when an order is placed on hold"
28
+ "Order Canceled","Order Canceled"
29
+ "Automatically sends a text message to the customer when an order has been canceled","Automatically sends a text message to the customer when an order has been canceled"
30
+ "Order Unhold","Order Unhold"
31
+ "Automatically sends a text message to the customer when an order has been released from holding status","Automatically sends a text message to the customer when an order has been released from holding status"
32
+ "Send Manual SMS","Send Manual SMS"
33
+ "From","From"
34
+ "To (or Order number)", "To (or Order number)"
35
+ "24X Username or password incorrect.","24X Username or password incorrect."
36
+ "SmsTo missing.","SmsTo missing."
37
+ "SmsFrom missing.","SmsFrom missing."
38
+ "SmsMsg missing.","SmsMsg missing."
39
+ "Insufficient credits.","Insufficient credits."
40
+ "Sms successfully sent.","Sms successfully sent."
41
+ "Not sent","Not sent"
42
+ "Sent","Sent"
43
+ "Not able to send the sms. Please contact the developer.","Not able to send the sms. Please contact the developer."
44
+ "Name or Telephone","Name or Telephone"
45
+ "Telephone (ex: +40740123456)","Telephone (ex: +40740123456)"
46
+ "Telephone (ex: +40740123456 or 100000001)","Telephone (ex: +40740123456 or 100000001)"
47
+ "Order","Order"
48
+ "Admin Notification","Admin Notification"
49
+ "Shipment","Shipment"
50
+ "Manual SMS","Manual SMS"
51
+ "Shipments","Shipments"
52
+ "Automatically sends a text message to the customer when the shipment is made","Automatically sends a text message to the customer when the shipment is made"
53
+ "There was an error while getting the 24x interface. Please contact the developer.","There was an error while getting the 24x interface. Please contact the developer."
package.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>MN_Sendsms</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Send text-messages automatically to you and your customers whenever an order is placed, holed, canceled, etc.</summary>
10
+ <description>&lt;p&gt;With SMS Text Messaging add-on you can set your store to automatically send text-messages to your customers whenever they make a purchase. You can also choose to be notified when an order is placed, so you will know the exact moment when someone bought something from you.&lt;/p&gt;&#xD;
11
+ &lt;p&gt;A text-message can be sent:&lt;/p&gt;&#xD;
12
+ &lt;ul&gt;&#xD;
13
+ &lt;li&gt;automatically to the customer when he makes a purchase&lt;/li&gt;&#xD;
14
+ &lt;li&gt;automatically to you when a customer makes a purchase&lt;/li&gt;&#xD;
15
+ &lt;li&gt;automatically to the customer when you put his order on-hold, or you release his order from holding status or when you cancel his order&lt;/li&gt;&#xD;
16
+ &lt;li&gt;automatically to the customer when you ship his order&lt;/li&gt;&#xD;
17
+ &lt;li&gt;manually to whoever and whenever you like using customized sender name&lt;/li&gt;&#xD;
18
+ &lt;/ul&gt;&#xD;
19
+ &lt;p&gt;You can also send text-messages manually to multiple phone-numbers comma separated.&lt;/p&gt;&#xD;
20
+ &lt;p&gt;To use the plugin you need to sign up for a 24x Magento SMS account at &lt;a href="http://www.24x.com/magento"&gt;www.24x.com/magento&lt;/a&gt;. Signing up for an account is totally free and it gives you 5 free credits then the price for a SMS credit is from just 3.8p (GBP) per text message. 24X power the SMS Text Messaging plugin using the fastest and most reliable mobile networks in the world. This means you can deliver text messages to over 400 networks in over 150 countries around the world with high throughput and super fast delivery.&lt;/p&gt;&#xD;
21
+ &lt;p&gt;You will also have access to a full suit of reports. Allowing you complete management of your SMS solution.&lt;/p&gt;</description>
22
+ <notes>First release</notes>
23
+ <authors><author><name>Marius N</name><user>mariusn</user><email>marius.negrusa@yahoo.com</email></author><author><name>24x</name><user>mariusn</user><email>magentosms@24xemail.com</email></author></authors>
24
+ <date>2012-11-14</date>
25
+ <time>21:43:32</time>
26
+ <contents><target name="magecommunity"><dir name="MN"><dir name="Sendsms"><dir name="Block"><dir name="Adminhtml"><dir name="Sendsms"><dir name="Edit"><file name="Form.php" hash="824c94cd5af862893d95ca7a9b399e07"/><dir name="Tab"><file name="Form.php" hash="92e157b0a1f6302bb32eeed9772bf6ff"/></dir><file name="Tabs.php" hash="d027b5bb51ba33a383b027bcfb7a1760"/></dir><file name="Edit.php" hash="9bba441f143d5488638f01601a8213f1"/><file name="Grid.php" hash="5c860da08e9388c9d50958948a503c51"/></dir><file name="Sendsms.php" hash="51a6cb344247bc19f95d756877b7b8d9"/></dir><file name="Buttons.php" hash="8006a2f2e7f6f3f886eb74003e42d153"/><file name="Sendsms.php" hash="d49f2f43acdeeb663aff0a4a5d73beb7"/><dir name="System"><dir name="Config"><file name="Buycredits.php" hash="d5e2364a80ee1b617e4407dec7acf424"/><file name="Info.php" hash="8a282632462c25e7496c7ba6d1798f46"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="39c19619ab59de5e585964f76a883c3b"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Sendsms"><file name="Collection.php" hash="34a308a175c372dd990f7c4200e3679f"/></dir><file name="Sendsms.php" hash="5a01881e1c0abb2de2997917e039b138"/></dir><file name="Observer.php" hash="edc11a9644edc4540b34dd66ed587e59"/><file name="Sendsms.php" hash="6a464d49521bad7d7ca9de9867d7452f"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SendsmsController.php" hash="80e3aaf162c589d08b03bb5cfb2eb372"/></dir><file name="IndexController.php" hash="7ef16e0bf36f3a0f4fdcec348a233266"/></dir><dir name="etc"><file name="config.xml" hash="8e5f7065b2e68aab1e93e84acb5146a3"/><file name="system.xml" hash="2497d50dd957d3702f59174b19f1cfc9"/></dir><dir name="sql"><dir name="sendsms_setup"><file name="mysql4-install-1.0.0.php" hash="cb023dc60556fc7ec4d67cbe21b91cfb"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="sendsms.xml" hash="2c241b79dc4bdc9e45e2b35c572aa90e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MN_Sendsms.xml" hash="7e75f8a6df63e8f09b5cc7193a408c32"/></dir></target><target name="magelocale"><dir name="en_US"><file name="MN_Sendsms.csv" hash="98e870d97634aaf1eaebfe9686af2ac2"/></dir></target></contents>
27
+ <compatible/>
28
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
29
+ </package>