Proonto_Chat - Version 1.0.0

Version Notes

First version which includes:
- chat code intergration;
- conversion tracking code;
- signup capabilities against the platform.

Download this release

Release Info

Developer Proonto
Extension Proonto_Chat
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Proonto/Chat/Block/Abstract.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Proonto_Chat_Block_Abstract extends Mage_Core_Block_Template
4
+ {
5
+ /**
6
+ * @return Proonto_Chat_Helper_Data
7
+ */
8
+ public function getChatHelper()
9
+ {
10
+ return $this->helper('proonto_chat');
11
+ }
12
+
13
+ /**
14
+ * @return string
15
+ */
16
+ public function getTestMode()
17
+ {
18
+ return $this->getChatHelper()->getTestMode();
19
+ }
20
+
21
+ /**
22
+ * @return string
23
+ */
24
+ public function getCompanyId()
25
+ {
26
+ return $this->getChatHelper()->getCompanyId();
27
+ }
28
+
29
+ /**
30
+ * @return string
31
+ */
32
+ public function getScriptDomain()
33
+ {
34
+ return $this->getTestMode() ?
35
+ 'chatstg.proonto.com' : 'chat.proonto.com';
36
+ }
37
+
38
+ /**
39
+ * @return string
40
+ */
41
+ protected function _toHtml()
42
+ {
43
+ $helper = $this->getChatHelper();
44
+ if (!$helper->getCompanyId() || !$helper->getEnabled() || !$helper->getVerified()) {
45
+ return '';
46
+ }
47
+ return parent::_toHtml();
48
+ }
49
+ }
app/code/community/Proonto/Chat/Block/Adminhtml/System/Config/Form/Fieldset/General.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Proonto_Chat_Block_Adminhtml_System_Config_Form_Fieldset_General
4
+ extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
5
+ {
6
+ /**
7
+ * Render fieldset html
8
+ *
9
+ * @param Varien_Data_Form_Element_Abstract $element
10
+ * @return string
11
+ */
12
+ public function render(Varien_Data_Form_Element_Abstract $element)
13
+ {
14
+ $html = $this->_getHeaderHtml($element);
15
+ $html .= $this->_getGeneralHtml($element);
16
+ $html .= $this->_getFooterHtml($element);
17
+ return $html;
18
+ }
19
+
20
+ /**
21
+ * Get html of general fieldset
22
+ *
23
+ * @param Varien_Data_Form_Element_Abstract $element
24
+ * @return string
25
+ */
26
+ protected function _getGeneralHtml(Varien_Data_Form_Element_Abstract $element)
27
+ {
28
+ /**
29
+ * @var $fieldsBlock Proonto_Chat_Block_Adminhtml_System_Config_Form_Fieldset_General_Fields
30
+ */
31
+ $fieldsBlock = $this->getLayout()->createBlock('proonto_chat/adminhtml_system_config_form_fieldset_general_fields');
32
+ $fieldsBlock->setElements($element->getSortedElements());
33
+ return $fieldsBlock->toHtml();
34
+ }
35
+ }
app/code/community/Proonto/Chat/Block/Adminhtml/System/Config/Form/Fieldset/General/Fields.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Proonto_Chat_Block_Adminhtml_System_Config_Form_Fieldset_General_Fields
4
+ extends Mage_Adminhtml_Block_Template
5
+ {
6
+ /**
7
+ * Internal constructor, that is called from real constructor
8
+ *
9
+ */
10
+ protected function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->setTemplate('proonto/chat/general.phtml');
14
+ }
15
+
16
+ /**
17
+ * @param array $elements
18
+ * @return $this
19
+ */
20
+ public function setElements(array $elements)
21
+ {
22
+ $this->setData('elements', $elements);
23
+ return $this;
24
+ }
25
+
26
+ /**
27
+ * @return $this
28
+ */
29
+ public function getElements()
30
+ {
31
+ return $this->_getData('elements');
32
+ }
33
+
34
+ /**
35
+ * @return Proonto_Chat_Helper_Data
36
+ */
37
+ public function getChatHelper()
38
+ {
39
+ return $this->helper('proonto_chat');
40
+ }
41
+
42
+ public function getVerified()
43
+ {
44
+ $request = $this->getRequest();
45
+
46
+ $website = $request->getParam('website');
47
+ $store = $request->getParam('store');
48
+
49
+ if (!$website && !$store) {
50
+ $value = $this->getChatHelper()->getVerified(Mage_Core_Model_App::ADMIN_STORE_ID);
51
+ } elseif (!$store) {
52
+ $value = $this->getChatHelper()->getWebsiteConfigValue($website, Proonto_Chat_Helper_Data::XML_PATH_VERIFIED);
53
+ } else {
54
+ $value = $this->getChatHelper()->getVerified($store);
55
+ }
56
+
57
+ return $value;
58
+ }
59
+ }
app/code/community/Proonto/Chat/Block/Chat.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Proonto_Chat_Block_Chat extends Proonto_Chat_Block_Abstract
4
+ {
5
+
6
+ }
app/code/community/Proonto/Chat/Block/Conversion/Tracking/Order.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Proonto_Chat_Block_Conversion_Tracking_Order extends Proonto_Chat_Block_Abstract
4
+ {
5
+
6
+ /**
7
+ * @return Mage_Sales_Model_Order
8
+ */
9
+ public function getOrders()
10
+ {
11
+ if (!$this->hasData('orders')) {
12
+ $orderIds = Mage::registry('proonto_chat_tracking_conversion_order_ids');
13
+ /**
14
+ * @var $collection Mage_Sales_Model_Resource_Order_Collection
15
+ */
16
+ $collection = Mage::getResourceModel('sales/order_collection');
17
+ $collection->addFieldToFilter($collection->getResource()->getIdFieldName(), array('in' => $orderIds));
18
+ $this->setData('orders', $collection->getItems());
19
+ }
20
+ return $this->_getData('orders');
21
+ }
22
+
23
+ /**
24
+ * return empty string if orders not found
25
+ *
26
+ * @return string
27
+ */
28
+ protected function _toHtml()
29
+ {
30
+ if (!$this->getOrders()) {
31
+ return '';
32
+ }
33
+
34
+ return parent::_toHtml();
35
+ }
36
+ }
app/code/community/Proonto/Chat/Helper/Data.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Proonto_Chat_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ const XML_PATH_USERNAME = 'proonto_chat/general/username';
6
+ const XML_PATH_PASSWORD = 'proonto_chat/general/password';
7
+ const XML_PATH_COMPANY_ID = 'proonto_chat/general/company_id';
8
+ const XML_PATH_ENABLED = 'proonto_chat/general/enabled';
9
+ const XML_PATH_VERIFIED = 'proonto_chat/general/verified';
10
+
11
+ /**
12
+ * @return bool
13
+ */
14
+ public function getTestMode()
15
+ {
16
+ return isset($_SERVER['PROONTO_CHAT_IS_DEVELOPER_MODE']);
17
+ }
18
+
19
+ /**
20
+ * @param mixed $store
21
+ * @return string
22
+ */
23
+ public function getUsername($store = null)
24
+ {
25
+ return Mage::getStoreConfig(self::XML_PATH_USERNAME, $store);
26
+ }
27
+
28
+ /**
29
+ * @param mixed $store
30
+ * @return string
31
+ */
32
+ public function getPassword($store = null)
33
+ {
34
+ return Mage::getStoreConfig(self::XML_PATH_PASSWORD, $store);
35
+ }
36
+
37
+ /**
38
+ * @param mixed $store
39
+ * @return string
40
+ */
41
+ public function getCompanyId($store = null)
42
+ {
43
+ return Mage::getStoreConfig(self::XML_PATH_COMPANY_ID, $store);
44
+ }
45
+
46
+ /**
47
+ * @param mixed $store
48
+ * @return bool
49
+ */
50
+ public function getEnabled($store = null)
51
+ {
52
+ return Mage::getStoreConfigFlag(self::XML_PATH_ENABLED, $store);
53
+ }
54
+
55
+ /**
56
+ * @param mixed $store
57
+ * @return bool
58
+ */
59
+ public function getVerified($store = null)
60
+ {
61
+ return Mage::getStoreConfigFlag(self::XML_PATH_VERIFIED, $store);
62
+ }
63
+
64
+ /**
65
+ * @param mixed $website
66
+ * @param string $path
67
+ * @return mixed|string
68
+ */
69
+ public function getWebsiteConfigValue($website, $path)
70
+ {
71
+ /**
72
+ * @var $configDataCollection Mage_Core_Model_Resource_Config_Data_Collection
73
+ * @var $configData Mage_Core_Model_Config_Data
74
+ */
75
+
76
+ $configDataCollection = Mage::getResourceModel('core/config_data_collection');
77
+ $configDataCollection
78
+ ->addFieldToFilter('scope', 'websites')
79
+ ->addFieldToFilter('scope_id', (int) Mage::app()->getWebsite($website)->getId())
80
+ ->addFieldToFilter('path', $path);
81
+
82
+ if (count($configDataCollection)) {
83
+ $configData = $configDataCollection->getFirstItem();
84
+ return $configData->getValue();
85
+ }
86
+
87
+ return Mage::getStoreConfig($path, Mage_Core_Model_App::ADMIN_STORE_ID);
88
+ }
89
+ }
app/code/community/Proonto/Chat/Model/Observer.php ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Proonto_Chat_Model_Observer
4
+ {
5
+ const TEST_SERVICE_URL = 'http://platformstg.proonto.com/platform/rest/magento/company';
6
+ const PRODUCTION_SERVICE_URL = 'http://platform.proonto.com/platform/rest/magento/company';
7
+
8
+ /**
9
+ * @return Proonto_Chat_Helper_Data
10
+ */
11
+ public function getChatHelper()
12
+ {
13
+ return Mage::helper('proonto_chat');
14
+ }
15
+
16
+ /**
17
+ * @param $username
18
+ * @param $password
19
+ * @return mixed
20
+ * @throws Mage_Core_Exception
21
+ */
22
+ protected function _signUp($username, $password)
23
+ {
24
+ $serviceUrl = $this->getChatHelper()->getTestMode() ?
25
+ self::TEST_SERVICE_URL : self::PRODUCTION_SERVICE_URL;
26
+
27
+ $params = array(
28
+ 'username' => $username,
29
+ 'password' => $password,
30
+ );
31
+
32
+ $ch = curl_init();
33
+ curl_setopt($ch, CURLOPT_URL, $serviceUrl . '?' . http_build_query($params));
34
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
35
+ $result = curl_exec($ch);
36
+
37
+ if (curl_errno($ch)) {
38
+ throw new Mage_Core_Exception(
39
+ $this->getChatHelper()->__('Sign up request failed.')
40
+ );
41
+ }
42
+
43
+ /**
44
+ * @var $coreHelper Mage_Core_Helper_Data
45
+ */
46
+ $coreHelper = Mage::helper('core');
47
+ $result = $coreHelper->jsonDecode($result);
48
+ if (empty($result)) {
49
+ throw new Mage_Core_Exception(
50
+ $this->getChatHelper()->__('Sign up request failed.')
51
+ );
52
+ }
53
+
54
+ if (array_key_exists('code', $result)) {
55
+ throw new Mage_Core_Exception(
56
+ $this->getChatHelper()->__(!empty($result['code']) ? $result['code'] : 'Sign up request failed.')
57
+ );
58
+ }
59
+
60
+ if (empty($result['id'])) {
61
+ throw new Mage_Core_Exception(
62
+ $this->getChatHelper()->__('Sign up request failed.')
63
+ );
64
+ }
65
+
66
+ curl_close($ch);
67
+
68
+ return $result['id'];
69
+ }
70
+
71
+ /**
72
+ * @param $username
73
+ * @param $password
74
+ * @param $companyId
75
+ * @return bool
76
+ * @throws Mage_Core_Exception
77
+ */
78
+ protected function _verifyAccount($username, $password, $companyId)
79
+ {
80
+ $serviceUrl = $this->getChatHelper()->getTestMode() ?
81
+ self::TEST_SERVICE_URL : self::PRODUCTION_SERVICE_URL;
82
+
83
+ $params = array(
84
+ 'username' => $username,
85
+ 'password' => $password,
86
+ 'companyId' => $companyId,
87
+ );
88
+
89
+ $ch = curl_init();
90
+ curl_setopt($ch, CURLOPT_URL, $serviceUrl . '?' . http_build_query($params));
91
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
92
+ $result = curl_exec($ch);
93
+
94
+ if (curl_errno($ch)) {
95
+ throw new Mage_Core_Exception(
96
+ $this->getChatHelper()->__('Verify account request failed.')
97
+ );
98
+ }
99
+
100
+ /**
101
+ * @var $coreHelper Mage_Core_Helper_Data
102
+ */
103
+ $coreHelper = Mage::helper('core');
104
+ $result = $coreHelper->jsonDecode($result);
105
+ if (empty($result)) {
106
+ throw new Mage_Core_Exception(
107
+ $this->getChatHelper()->__('Verify account request failed.')
108
+ );
109
+ }
110
+
111
+ if (array_key_exists('code', $result)) {
112
+ throw new Mage_Core_Exception(
113
+ $this->getChatHelper()->__(!empty($result['code']) ? $result['code'] : 'Verify account request failed.')
114
+ );
115
+ }
116
+
117
+ curl_close($ch);
118
+
119
+ return true;
120
+ }
121
+
122
+ /**
123
+ * event: admin_system_config_changed_section_proonto_chat
124
+ *
125
+ * @param Varien_Event_Observer $observer
126
+ * @return $this
127
+ */
128
+ public function configChanged(Varien_Event_Observer $observer)
129
+ {
130
+ /**
131
+ * @var $configDataCollection Mage_Core_Model_Resource_Config_Data_Collection
132
+ * @var $configData Mage_Core_Model_Config_Data
133
+ */
134
+
135
+ $section = 'proonto_chat';
136
+
137
+ $website = $observer->getEvent()->getData('website');
138
+ $store = $observer->getEvent()->getData('store');
139
+
140
+ if (!$website && !$store) {
141
+ $scope = 'default';
142
+ $scopeId = 0;
143
+ } elseif (!$store) {
144
+ $scope = 'websites';
145
+ $scopeId = (int) Mage::app()->getWebsite($website)->getId();
146
+ } else {
147
+ $scope = 'stores';
148
+ $scopeId = (int) Mage::app()->getStore($store)->getId();
149
+ }
150
+
151
+ $configDataCollection = Mage::getResourceModel('core/config_data_collection');
152
+ $configDataCollection->addScopeFilter($scope, $scopeId, $section);
153
+
154
+ $usedParentValues = false;
155
+
156
+ if ($scope != 'default') {
157
+
158
+ $paths = array(
159
+ Proonto_Chat_Helper_Data::XML_PATH_USERNAME,
160
+ Proonto_Chat_Helper_Data::XML_PATH_PASSWORD,
161
+ Proonto_Chat_Helper_Data::XML_PATH_COMPANY_ID,
162
+ );
163
+
164
+ $usedParentValues = true;
165
+ foreach ($paths as $path) {
166
+ $configData = $configDataCollection->getItemByColumnValue('path', $path);
167
+ if ($configData instanceof Mage_Core_Model_Config_Data) {
168
+ $usedParentValues = false;
169
+ break;
170
+ }
171
+ }
172
+
173
+ if ($usedParentValues) {
174
+ $configData = $configDataCollection->getItemByColumnValue('path', Proonto_Chat_Helper_Data::XML_PATH_VERIFIED);
175
+ if ($configData instanceof Mage_Core_Model_Config_Data) {
176
+ $configData->delete();
177
+ }
178
+ }
179
+ }
180
+
181
+ if (!$usedParentValues) {
182
+
183
+ $configData = $configDataCollection->getItemByColumnValue('path', Proonto_Chat_Helper_Data::XML_PATH_USERNAME);
184
+ $username = $configData instanceof Mage_Core_Model_Config_Data ? $configData->getValue() : '';
185
+ $configData = $configDataCollection->getItemByColumnValue('path', Proonto_Chat_Helper_Data::XML_PATH_PASSWORD);
186
+ $password = $configData instanceof Mage_Core_Model_Config_Data ? $configData->getValue() : '';
187
+ $configData = $configDataCollection->getItemByColumnValue('path', Proonto_Chat_Helper_Data::XML_PATH_COMPANY_ID);
188
+ $companyId = $configData instanceof Mage_Core_Model_Config_Data ? $configData->getValue() : '';
189
+
190
+ $verified = 0;
191
+
192
+ /**
193
+ * @var $session Mage_Adminhtml_Model_Session
194
+ */
195
+ $session = Mage::getSingleton('adminhtml/session');
196
+ try {
197
+ if ($companyId) {
198
+ $verified = $this->_verifyAccount($username, $password, $companyId);
199
+ $session->addSuccess('Your account was successfully verified.');
200
+ } else {
201
+ $companyId = $this->_signUp($username, $password);
202
+ $configData = $configDataCollection->getItemByColumnValue('path', Proonto_Chat_Helper_Data::XML_PATH_COMPANY_ID);
203
+ if (!($configData instanceof Mage_Core_Model_Config_Data)) {
204
+ $configData = Mage::getModel('core/config_data');
205
+ }
206
+ $configData
207
+ ->setScope($scope)
208
+ ->setScopeId($scopeId)
209
+ ->setPath(Proonto_Chat_Helper_Data::XML_PATH_COMPANY_ID)
210
+ ->setValue($companyId)
211
+ ->save();
212
+ $verified = 1;
213
+ $session->addSuccess($this->getChatHelper()->__('You was successfully signed up.'));
214
+ }
215
+ } catch (Mage_Core_Exception $e) {
216
+ $session->addError($e->getMessage());
217
+ if ($companyId) {
218
+ $configData = $configDataCollection->getItemByColumnValue('path', Proonto_Chat_Helper_Data::XML_PATH_COMPANY_ID);
219
+ $configData->setValue('')->save();
220
+ }
221
+ } catch (Exception $e) {
222
+ $session->addError($this->getChatHelper()->__($companyId ? 'Verify account request failed.' : 'Sign up request failed.'));
223
+ if ($companyId) {
224
+ $configData = $configDataCollection->getItemByColumnValue('path', Proonto_Chat_Helper_Data::XML_PATH_COMPANY_ID);
225
+ $configData->setValue('')->save();
226
+ }
227
+ }
228
+
229
+ $configData = $configDataCollection->getItemByColumnValue('path', Proonto_Chat_Helper_Data::XML_PATH_VERIFIED);
230
+ if (!($configData instanceof Mage_Core_Model_Config_Data)) {
231
+ $configData = Mage::getModel('core/config_data');
232
+ }
233
+
234
+ $configData
235
+ ->setScope($scope)
236
+ ->setScopeId($scopeId)
237
+ ->setPath(Proonto_Chat_Helper_Data::XML_PATH_VERIFIED)
238
+ ->setValue($verified)
239
+ ->save();
240
+ ;
241
+ }
242
+
243
+ return $this;
244
+ }
245
+
246
+
247
+ /**
248
+ * event: model_config_data_save_before
249
+ *
250
+ * @param Varien_Event_Observer $observer
251
+ * @return $this
252
+ */
253
+ public function configDataSaveBefore(Varien_Event_Observer $observer)
254
+ {
255
+ /**
256
+ * @var $configData Mage_Adminhtml_Model_Config_Data
257
+ */
258
+ $configData = $observer->getEvent()->getData('object');
259
+
260
+ if ($configData->getSection() == 'proonto_chat') {
261
+ $groups = $configData->getGroups();
262
+
263
+ $inherit = true;
264
+
265
+ $fields = array(
266
+ 'username',
267
+ 'password',
268
+ 'company_id',
269
+ );
270
+
271
+ foreach ($fields as $field) {
272
+ if (empty($groups['general']['fields'][$field]['inherit'])) {
273
+ $inherit = false;
274
+ break;
275
+ }
276
+ }
277
+
278
+ if (!$inherit) {
279
+ foreach ($fields as $field) {
280
+ if (array_key_exists('inherit', $groups['general']['fields'][$field])) {
281
+ unset($groups['general']['fields'][$field]['inherit']);
282
+ }
283
+ $groups['general']['fields'][$field]['value'] = isset($groups['general']['fields'][$field]['value']) ? $groups['general']['fields'][$field]['value'] : '';
284
+ }
285
+ }
286
+
287
+ $configData->setGroups($groups);
288
+ }
289
+
290
+ return $this;
291
+ }
292
+
293
+ /**
294
+ * event: checkout_onepage_controller_success_action
295
+ *
296
+ * @param Varien_Event_Observer $observer
297
+ * @return $this
298
+ */
299
+ public function checkoutOnepageSuccess(Varien_Event_Observer $observer)
300
+ {
301
+ $orderIds = $observer->getEvent()->getData('order_ids');
302
+ Mage::register('proonto_chat_tracking_conversion_order_ids', $orderIds);
303
+ return $this;
304
+ }
305
+
306
+ /**
307
+ * event: checkout_multishipping_controller_success_action
308
+ *
309
+ * @param Varien_Event_Observer $observer
310
+ * @return $this
311
+ */
312
+ public function checkoutMultishippingSuccess(Varien_Event_Observer $observer)
313
+ {
314
+ $orderIds = $observer->getEvent()->getData('order_ids');
315
+ Mage::register('proonto_chat_tracking_conversion_order_ids', $orderIds);
316
+ return $this;
317
+ }
318
+ }
app/code/community/Proonto/Chat/etc/adminhtml.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <proonto_chat translate="title" module="proonto_chat">
12
+ <title>Proonto Chat</title>
13
+ <sort_order>10</sort_order>
14
+ </proonto_chat>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/community/Proonto/Chat/etc/config.xml ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Proonto_Chat>
5
+ <version>1.0.0</version>
6
+ </Proonto_Chat>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <proonto_chat>
11
+ <class>Proonto_Chat_Block</class>
12
+ </proonto_chat>
13
+ </blocks>
14
+ <helpers>
15
+ <proonto_chat>
16
+ <class>Proonto_Chat_Helper</class>
17
+ </proonto_chat>
18
+ </helpers>
19
+ <models>
20
+ <proonto_chat>
21
+ <class>Proonto_Chat_Model</class>
22
+ </proonto_chat>
23
+ </models>
24
+ </global>
25
+
26
+ <adminhtml>
27
+ <translate>
28
+ <modules>
29
+ <Proonto_Chat>
30
+ <files>
31
+ <default>Proonto_Chat.csv</default>
32
+ </files>
33
+ </Proonto_Chat>
34
+ </modules>
35
+ </translate>
36
+ <events>
37
+ <admin_system_config_changed_section_proonto_chat>
38
+ <observers>
39
+ <proonto_chat>
40
+ <type>singleton</type>
41
+ <class>proonto_chat/observer</class>
42
+ <method>configChanged</method>
43
+ </proonto_chat>
44
+ </observers>
45
+ </admin_system_config_changed_section_proonto_chat>
46
+ <model_config_data_save_before>
47
+ <observers>
48
+ <proonto_chat>
49
+ <type>singleton</type>
50
+ <class>proonto_chat/observer</class>
51
+ <method>configDataSaveBefore</method>
52
+ </proonto_chat>
53
+ </observers>
54
+ </model_config_data_save_before>
55
+ </events>
56
+ </adminhtml>
57
+
58
+ <frontend>
59
+ <layout>
60
+ <updates>
61
+ <proonto_chat>
62
+ <file>proonto_chat.xml</file>
63
+ </proonto_chat>
64
+ </updates>
65
+ </layout>
66
+ <translate>
67
+ <modules>
68
+ <Proonto_Chat>
69
+ <files>
70
+ <default>Proonto_Chat.csv</default>
71
+ </files>
72
+ </Proonto_Chat>
73
+ </modules>
74
+ </translate>
75
+ <events>
76
+ <checkout_onepage_controller_success_action>
77
+ <observers>
78
+ <proonto_chat>
79
+ <type>singleton</type>
80
+ <class>proonto_chat/observer</class>
81
+ <method>checkoutOnepageSuccess</method>
82
+ </proonto_chat>
83
+ </observers>
84
+ </checkout_onepage_controller_success_action>
85
+ <checkout_multishipping_controller_success_action>
86
+ <observers>
87
+ <proonto_chat>
88
+ <type>singleton</type>
89
+ <class>proonto_chat/observer</class>
90
+ <method>checkoutMultishippingSuccess</method>
91
+ </proonto_chat>
92
+ </observers>
93
+ </checkout_multishipping_controller_success_action>
94
+ </events>
95
+ </frontend>
96
+
97
+ <default>
98
+ <proonto_chat>
99
+ <general>
100
+ <enabled>0</enabled>
101
+ <verified>0</verified>
102
+ </general>
103
+ </proonto_chat>
104
+ </default>
105
+ </config>
app/code/community/Proonto/Chat/etc/system.xml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <proonto_all translate="label" module="proonto_chat">
5
+ <label><![CDATA[
6
+ <div style="position: absolute;"><img id="proonto_chat_tab_header" src="" alt="" border="0" /></div>&nbsp;
7
+ <script>
8
+ $('proonto_chat_tab_header').src = SKIN_URL.substring(0, SKIN_URL.indexOf("/skin/adminhtml/")) + '/skin/adminhtml/default/default/proonto/chat/images/logo_green_blue_small.png';
9
+ </script>
10
+ ]]></label>
11
+ <sort_order>0</sort_order>
12
+ </proonto_all>
13
+ </tabs>
14
+ <sections>
15
+ <proonto_chat translate="label" module="proonto_chat">
16
+ <label>Proonto Chat</label>
17
+ <tab>proonto_all</tab>
18
+ <class>proonto-all-tab</class>
19
+ <frontend_type>text</frontend_type>
20
+ <sort_order>1</sort_order>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>1</show_in_website>
23
+ <show_in_store>1</show_in_store>
24
+ <groups>
25
+ <general translate="label" module="proonto_chat">
26
+ <label>General</label>
27
+ <frontend_type>text</frontend_type>
28
+ <sort_order>10</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>1</show_in_website>
31
+ <show_in_store>1</show_in_store>
32
+ <frontend_model>proonto_chat/adminhtml_system_config_form_fieldset_general</frontend_model>
33
+ <fields>
34
+ <username translate="label comment" module="proonto_chat">
35
+ <label>Username</label>
36
+ <frontend_type>text</frontend_type>
37
+ <sort_order>20</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>1</show_in_store>
41
+ <validate>required-entry validate-email</validate>
42
+ </username>
43
+ <password translate="label" module="proonto_chat">
44
+ <label>Password</label>
45
+ <frontend_type>password</frontend_type>
46
+ <sort_order>30</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ <validate>required-entry validate-length minimum-length-6</validate>
51
+ </password>
52
+ <company_id translate="label comment" module="proonto_chat">
53
+ <label>Company ID</label>
54
+ <frontend_type>text</frontend_type>
55
+ <sort_order>40</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>1</show_in_store>
59
+ <validate>validate-proonto-company-id</validate>
60
+ <comment><![CDATA[Your Company ID is the unique identifier for your account. You can find your company ID under `company settings` in Proonto dashboard.]]></comment>
61
+ </company_id>
62
+ <enabled translate="label comment" module="proonto_chat">
63
+ <label>Enabled</label>
64
+ <frontend_type>select</frontend_type>
65
+ <source_model>adminhtml/system_config_source_yesno</source_model>
66
+ <sort_order>50</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ <comment><![CDATA[Enable/disable Proonto in your Magento store.]]></comment>
71
+ </enabled>
72
+ </fields>
73
+ </general>
74
+ </groups>
75
+ </proonto_chat>
76
+ </sections>
77
+ </config>
app/design/adminhtml/default/default/template/proonto/chat/general.phtml ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @var $this Proonto_Chat_Block_Adminhtml_System_Config_Form_Fieldset_General_Fields
4
+ * @var $_helper Proonto_Chat_Helper_Data
5
+ * @var $_field Varien_Data_Form_Element_Abstract
6
+ */
7
+ $_helper = $this->helper('proonto_chat');
8
+ $_elements = $this->getElements();
9
+
10
+ $verified = $this->getVerified();
11
+ $stepClass = $verified ? 'step-verified' : 'step-sign-up';
12
+
13
+ $_usernameFieldId = str_replace('/', '_', Proonto_Chat_Helper_Data::XML_PATH_USERNAME);
14
+ $_passwordFieldId = str_replace('/', '_', Proonto_Chat_Helper_Data::XML_PATH_PASSWORD);
15
+ $_companyFieldId = str_replace('/', '_', Proonto_Chat_Helper_Data::XML_PATH_COMPANY_ID);
16
+ $_enabledFieldId = str_replace('/', '_', Proonto_Chat_Helper_Data::XML_PATH_ENABLED);
17
+ ?>
18
+
19
+ <style type="text/css">
20
+ .step-sign-up .hide-step-sign-up {
21
+ display: none;
22
+ }
23
+ .step-verify .hide-step-verify {
24
+ display: none;
25
+ }
26
+ .step-verified .hide-step-verified {
27
+ display: none;
28
+ }
29
+ #save-config-button-row.hide {
30
+ display: none;
31
+ }
32
+ </style>
33
+
34
+
35
+ <tr class="hide-step-verify hide-step-verified">
36
+ <td colspan="4">
37
+ <p><?php echo $this->__('To start using Proonto in your online store please create your free account.') ?></p>
38
+ <p><?php echo $this->__('Already have your account?') ?> <a href="javascript:void(0)" class="change-step-button" data-button-title="Verify Your Account" data-step="verify"><?php echo $this->__('Login.') ?></a></p>
39
+ <br/>
40
+ </td>
41
+ </tr>
42
+ <?php foreach ($_elements as $_field): ?>
43
+
44
+ <?php
45
+ $_fieldId = $_field->getId();
46
+ $_fieldHtml = $_field->toHtml();
47
+
48
+ switch ($_fieldId) {
49
+ case $_usernameFieldId:
50
+ $_fieldHtml = str_replace('id="row_' . $_fieldId . '"', 'id="row_' . $_fieldId . '" class="hide-step-verified"', $_fieldHtml);
51
+ break;
52
+ case $_passwordFieldId:
53
+ $_fieldHtml = str_replace('id="row_' . $_fieldId . '"', 'id="row_' . $_fieldId . '" class="hide-step-verified"', $_fieldHtml);
54
+ break;
55
+ case $_companyFieldId:
56
+ $_fieldHtml = str_replace('id="row_' . $_fieldId . '"', 'id="row_' . $_fieldId . '" class="hide-step-sign-up hide-step-verified"', $_fieldHtml);
57
+ break;
58
+ case $_enabledFieldId:
59
+ $_fieldHtml = str_replace('id="row_' . $_fieldId . '"', 'id="row_' . $_fieldId . '" class="hide-step-sign-up hide-step-verify"', $_fieldHtml);
60
+ break;
61
+ }
62
+
63
+ echo $_fieldHtml;
64
+ ?>
65
+
66
+
67
+ <?php if ($_fieldId == $_companyFieldId): ?>
68
+ <tr class="hide-step-sign-up hide-step-verify">
69
+ <td class="label">
70
+ <?php echo $_field->getLabelHtml() ?>
71
+ </td>
72
+ <td class="value">
73
+ <?php echo $_field->getEscapedValue() ?>
74
+ </td>
75
+ <td class="scope-label">&nbsp;</td>
76
+ <td>&nbsp;</td>
77
+ </tr>
78
+ <tr class="hide-step-sign-up hide-step-verify">
79
+ <td class="label"></td>
80
+ <td class="value">
81
+ <button type="button" class="change-step-button" data-step="verify"><span><span><?php echo $this->__('Edit Company ID') ?></span></span></button>
82
+ </td>
83
+ <td class="scope-label">&nbsp;</td>
84
+ <td>&nbsp;</td>
85
+ </tr>
86
+ <?php endif ?>
87
+
88
+ <?php endforeach ?>
89
+
90
+ <tr id="save-config-button-row" class="<?php echo $stepClass == 'step-verified' ? 'hide' : ''; ?>" >
91
+ <td class="label"></td>
92
+ <td class="value">
93
+ <button type="button" onclick="configForm.submit()">
94
+ <span>
95
+ <span id="multilabel-button"><?php echo ($stepClass == 'step-sign-up') ? $this->__('Create Free Account') : $this->__('Verify Your Account') ?>
96
+ </span>
97
+ </span>
98
+ </button>
99
+ </td>
100
+ <td class="scope-label">&nbsp;</td>
101
+ <td>&nbsp;</td>
102
+ </tr>
103
+
104
+ <?php if ($stepClass == 'step-sign-up'): ?>
105
+ <tr class="hide-step-verify hide-step-verified">
106
+ <td class="label">&nbsp;</td>
107
+ <td class="value" style="text-align: left">
108
+ <p><?php echo $this->__('By signing up, I agree to the <a href="%s" target="_blank">terms of service</a>', Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'proonto_chat_terms_of_use.pdf') ?></p>
109
+ </td>
110
+ <td class="scope-label">&nbsp;</td>
111
+ <td>&nbsp;</td>
112
+ </tr>
113
+ <?php endif ?>
114
+
115
+ <tr class="hide-step-sign-up">
116
+ <td colspan="4">
117
+ <br/>
118
+ <p><?php echo $this->__('Login <a href="%s" target="_blank">here</a> to set your configurations and start using the app.', 'http://platform.proonto.com') ?></p>
119
+ <p><?php echo $this->__('Feel free to contact Proonto support at <a href="%1$s">%2$s</a> with any questions.', 'mailto:support@proonto.com', 'support@proonto.com') ?></p>
120
+ </td>
121
+ </tr>
122
+
123
+ <script type="text/javascript">
124
+ //<![CDATA[
125
+
126
+ Validation.addAllThese(
127
+ [
128
+ ['validate-proonto-company-id', '<?php echo $this->jsQuoteEscape($this->__('Please, enter valid company id')) ?>', function(v) {
129
+ if (Validation.get('IsEmpty').test(v)) {
130
+ return true;
131
+ }
132
+
133
+ if (/[^\d]/.test(v)) {
134
+ return false;
135
+ }
136
+
137
+ var numValue = parseInt(v);
138
+
139
+ return numValue > 8500000;
140
+ }]
141
+ ]
142
+ );
143
+
144
+ $(document).observe('dom:loaded', function() {
145
+ var i,
146
+ j,
147
+ insertImageBefore = $$('.content-header').first(),
148
+ chatGeneral = $('proonto_chat_general'),
149
+ relatedFieldIds = [
150
+ '<?php echo $_usernameFieldId ?>',
151
+ '<?php echo $_passwordFieldId ?>',
152
+ '<?php echo $_companyFieldId ?>'
153
+ ],
154
+ currentRelatedFieldInheritCheckbox
155
+ ;
156
+
157
+ insertImageBefore.insert({
158
+ before: '<div style="margin: 10px 0;"><img src="' + SKIN_URL.substring(0, SKIN_URL.indexOf("/skin/adminhtml/")) + '/skin/adminhtml/default/default/proonto/chat/images/logo_green_blue_big.png" alt="" width="300" style="display: block;"/></div>'
159
+ });
160
+
161
+ chatGeneral.addClassName('<?php echo $stepClass ?>');
162
+
163
+ $$('.change-step-button').each(function(element, index) {
164
+ element.observe('click', function(e) {
165
+ e.preventDefault();
166
+ chatGeneral.removeClassName('step-sign-up');
167
+ chatGeneral.removeClassName('step-verify');
168
+ chatGeneral.removeClassName('step-verified');
169
+ chatGeneral.addClassName('step-' + element.readAttribute('data-step'));
170
+
171
+ if (element.readAttribute('data-button-title')) {
172
+ $('multilabel-button').update(element.readAttribute('data-button-title'));
173
+ }
174
+ $('save-config-button-row').removeClassName('hide');
175
+ });
176
+ });
177
+
178
+ for (i = 0; i < relatedFieldIds.length; i++) {
179
+ currentRelatedFieldInheritCheckbox = $(relatedFieldIds[i] + '_inherit');
180
+ if (!currentRelatedFieldInheritCheckbox) {
181
+ break;
182
+ }
183
+
184
+ currentRelatedFieldInheritCheckbox.observe('change', function(e) {
185
+ var inheritCheckbox;
186
+ var input;
187
+ for (j = 0; j < relatedFieldIds.length; j++) {
188
+ if (i == j) {
189
+ continue;
190
+ }
191
+ inheritCheckbox = $(relatedFieldIds[j] + '_inherit');
192
+ input = $(relatedFieldIds[j]);
193
+
194
+ inheritCheckbox.checked = this.checked;
195
+ input.disabled = this.checked;
196
+
197
+ if (this.checked) {
198
+ input.addClassName('disabled');
199
+ } else {
200
+ input.removeClassName('disabled');
201
+ }
202
+ }
203
+ });
204
+ }
205
+ });
206
+
207
+ //]]>
208
+ </script>
app/design/frontend/base/default/layout/proonto_chat.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="before_body_end">
5
+ <block type="proonto_chat/chat" name="proonto.chat" template="proonto/chat/chat.phtml"/>
6
+ </reference>
7
+ </default>
8
+
9
+ <checkout_onepage_success>
10
+ <reference name="before_body_end">
11
+ <block type="proonto_chat/conversion_tracking_order" name="proonto.chat.conversion.tracking.order" template="proonto/chat/conversion/tracking/order.phtml"/>
12
+ </reference>
13
+ </checkout_onepage_success>
14
+
15
+ <checkout_multishipping_success>
16
+ <reference name="before_body_end">
17
+ <block type="proonto_chat/conversion_tracking_order" name="proonto.chat.conversion.tracking.order" template="proonto/chat/conversion/tracking/order.phtml"/>
18
+ </reference>
19
+ </checkout_multishipping_success>
20
+ </layout>
app/design/frontend/base/default/template/proonto/chat/chat.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @var $this Proonto_Chat_Block_Chat
4
+ */
5
+ ?>
6
+ <script type="text/javascript">
7
+ //<![CDATA[
8
+ var prefix = ('https:' == document.location.protocol ? 'https://' : 'http://');
9
+ var proonto = document.createElement('script');
10
+ proonto.type = 'text/javascript'; proonto.src = prefix + '<?php echo $this->getScriptDomain() ?>/chat/widget.min.js';
11
+ <?php if ($this->getTestMode()): ?>
12
+ proonto.setAttribute('proonto-env', 'stg');
13
+ <?php endif ?>
14
+ proonto.setAttribute('data-company-id', '<?php echo $this->getCompanyId() ?>');
15
+ var s = document.getElementsByTagName('script');
16
+ var lastScriptTag = s[s.length - 1];
17
+ lastScriptTag.parentNode.insertBefore(proonto, lastScriptTag);
18
+ //]]>
19
+ </script>
app/design/frontend/base/default/template/proonto/chat/conversion/tracking/order.phtml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @var $this Proonto_Chat_Block_Conversion_Tracking_Order
4
+ * @var $_order Mage_Sales_Model_Order
5
+ * @var $_orderItem Mage_Sales_Model_Order_Item
6
+ */
7
+ $_orders = $this->getOrders();
8
+ ?>
9
+ <script type="text/javascript">
10
+ //<![CDATA[
11
+ var proontoChatConversionTracking = function() {
12
+ var companyId = <?php echo $this->getCompanyId() ?>,
13
+ OID,
14
+ DB_OID,
15
+ CURRENCY,
16
+ TOTAL,
17
+ DISCOUNT,
18
+ SHIPPING,
19
+ TAX,
20
+ PAYMENT_METHOD,
21
+ SHIPPING_METHOD,
22
+ COUPON,
23
+ ORDER_STATUS,
24
+ ITEMS_PARAMS,
25
+ myImage
26
+ ;
27
+ <?php foreach ($_orders as $_order): ?>
28
+ <?php
29
+ $_itemsParams = '';
30
+ $i = 1;
31
+ $_orderItems = $_order->getAllVisibleItems();
32
+ foreach ($_orderItems as $_orderItem) {
33
+ $_itemsParams .= '&itemId' . $i . '=' . $_orderItem->getProductId();
34
+ $_itemsParams .= '&quanity' . $i . '=' . $_orderItem->getQtyOrdered() * 1;
35
+ $_itemsParams .= '&sku' . $i . '=' . rawurlencode($_orderItem->getSku());
36
+ $i++;
37
+ }
38
+ ?>
39
+
40
+ OID = '<?php echo $_order->getIncrementId() ?>';
41
+ DB_OID = '<?php echo $_order->getId() ?>';
42
+ CURRENCY = '<?php echo $_order->getOrderCurrencyCode() ?>';
43
+ TOTAL = <?php echo round($_order->getGrandTotal(), 2) ?>;
44
+ DISCOUNT = <?php echo round($_order->getDiscountAmount(), 2) ?>;
45
+ SHIPPING = <?php echo round($_order->getShippingAmount(), 2) ?>;
46
+ TAX = <?php echo round($_order->getTaxAmount(), 2) ?>;
47
+ PAYMENT_METHOD = '<?php echo $_order->getPayment()->getMethod() ?>';
48
+ SHIPPING_METHOD = '<?php echo $_order->getIsNotVirtual() ? $_order->getShippingMethod() : '' ?>';
49
+ COUPON = '<?php echo rawurlencode($_order->getCouponCode()) ?>';
50
+ ORDER_STATUS = '<?php echo $_order->getStatus() ?>';
51
+ ITEMS_PARAMS = '<?php echo $_itemsParams ?>';
52
+ myImage = new Image(1, 2);
53
+ myImage.src = 'https://<?php echo $this->getScriptDomain() ?>/chat/rest/orders/api?source=Magento&' + 'clientId='+((a=document.cookie.match('(^|; )prt_clientId=([^;]*)')) ? a[2]:'') + '&uniqueId='+((b=document.cookie.match('(^|; )prt_uniqueId=([^;]*)')) ? b[2]:'')+ '&CURRENCY=' + CURRENCY +'&OID=' + OID + '&DB_OID=' + DB_OID + '&companyId=' + companyId + '&TOTAL=' + TOTAL + '&DISCOUNT=' + DISCOUNT + '&SHIPPING=' + SHIPPING + '&TAX=' + TAX + '&PAYMENT_METHOD=' + PAYMENT_METHOD + '&SHIPPING_METHOD=' + SHIPPING_METHOD + '&COUPON=' + COUPON + '&ORDER_STATUS=' + ORDER_STATUS + ITEMS_PARAMS + '&url=' + encodeURIComponent(document.location.href)+ '&pageTitle=' + encodeURIComponent(document.title) + '&cookiesEnabled=' + navigator.cookieEnabled;
54
+ <?php endforeach ?>
55
+ };
56
+ proontoChatConversionTracking();
57
+ //]]>
58
+ </script>
app/etc/modules/Proonto_Chat.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Proonto_Chat>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Proonto_Chat>
8
+ </modules>
9
+ </config>
app/locale/en_US/Proonto_Chat.csv ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Proonto Chat","Proonto Chat"
2
+ "Chat","Chat"
3
+ "General","General"
4
+ "Test Mode","Test Mode"
5
+ "Username","Username"
6
+ "Password","Password"
7
+ "Company ID","Company ID"
8
+ "Enabled","Enabled"
9
+ "Your Company ID is the unique identifier for your account. You can find your company ID under `company settings` in Proonto dashboard.","Your Company ID is the unique identifier for your account. You can find your company ID under `company settings` in Proonto dashboard."
10
+ "Enable/disable Proonto in your Magento store.","Enable/disable Proonto in your Magento store."
11
+ "To start using Proonto in your online store please create your free account.","To start using Proonto in your online store please create your free account."
12
+ "Already have your account?","Already have your account?"
13
+ "Login.","Login."
14
+ "Create Free Account","Create Free Account"
15
+ "Verify Your Account","Verify Your Account"
16
+ "Edit Company ID","Edit Company ID"
17
+ "By signing up, I agree to the <a href=""%s"" target=""_blank"">terms of service</a>","By signing up, I agree to the <a href=""%s"" target=""_blank"">terms of service</a>"
18
+ "Login <a href=""%s"" target=""_blank"">here</a> to set your configurations and start using the app.","Login <a href=""%s"" target=""_blank"">here</a> to set your configurations and start using the app."
19
+ "Feel free to contact Proonto support at <a href=""%1$s"">%2$s</a> with any questions.","Feel free to contact Proonto support at <a href=""%1$s"">%2$s</a> with any questions."
20
+ "Please, enter valid company id","Please, enter valid company id"
21
+ "Verify Account","Verify Account"
22
+ "Sign Up","Sign Up"
23
+ "Sign up request failed.","Sign up request failed."
24
+ "Verify account request failed.","Verify account request failed."
25
+ "Required String parameter 'username' is not present","Required String parameter 'username' is not present"
26
+ "Required String parameter 'password' is not present","Required String parameter 'password' is not present"
27
+ "Username must be in a valid email format","Username must be in a valid email format"
28
+ "Invalid username or password","Invalid username or password"
29
+ "Username already exist, try a different username","Username already exist, try a different username"
30
+ "Your account was successfully verified.","Your account was successfully verified."
31
+ "You was successfully signed up.","You was successfully signed up."
media/proonto_chat_terms_of_use.pdf ADDED
Binary file
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Proonto_Chat</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Proonto is an end to end live support solution which includes an advanced live chat software and qualified sales associates to staff it.</summary>
10
+ <description>Proonto is an online marketplace that allows online retailers and brands to outsource a complete live support solution which includes an advanced live support software and the qualified sales associates to staff it. Proonto&#x2019;s platform provides online store owners with a constantly expanding pool of product experts from which they can hand pick the associate who will staff their live support platform. The platform eliminates geographical, lingual and cultural borders, making it easy for online retailers to find the right agent for their online store.The Proonto marketplace enables the top sales and customer support associates to work with growing e-commerce brands, regardless of where they happen to be. &#xD;
11
+ The associates are recruited from all over the world and are divided into niche verticals, which makes the certification process much easier, both for the agent and the store owner.</description>
12
+ <notes>First version which includes:&#xD;
13
+ - chat code intergration;&#xD;
14
+ - conversion tracking code;&#xD;
15
+ - signup capabilities against the platform.</notes>
16
+ <authors><author><name>Proonto</name><user>Proonto</user><email>support@proonto.com</email></author></authors>
17
+ <date>2015-09-11</date>
18
+ <time>09:20:05</time>
19
+ <contents><target name="magecommunity"><dir name="Proonto"><dir name="Chat"><dir name="Block"><file name="Abstract.php" hash="6cee9b31f195ead28894e6c27071fb92"/><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="General"><file name="Fields.php" hash="a531d87703f885f7bd963d0b5a6bc2ec"/></dir><file name="General.php" hash="3e1f17d500f28aada4ed8effef80e04e"/></dir></dir></dir></dir></dir><file name="Chat.php" hash="02bfdb5cde5c9dcd55ace331216bf990"/><dir name="Conversion"><dir name="Tracking"><file name="Order.php" hash="8b23394b45435b7b94b44718712e6ade"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="a41518de09767ba09473f480a44d3e1f"/></dir><dir name="Model"><file name="Observer.php" hash="2e9597c82a523b0bdb2a253ff7bdb70b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="d98f0816a92a145c5499700ef72d931b"/><file name="config.xml" hash="fadf0c21f6301aa78ca64b5d6e350975"/><file name="system.xml" hash="c44770f27d9e86e9f08e4259779b4f95"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Proonto_Chat.xml" hash="88fc0d8137b38073ece2399c2fff14e1"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="proonto"><dir name="chat"><file name="general.phtml" hash="191d744ddf0efd52429556feea4ef704"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="proonto"><dir name="chat"><file name="chat.phtml" hash="2f53a26fedb4f1a5173c2a8feea72097"/><dir name="conversion"><dir name="tracking"><file name="order.phtml" hash="1188fccc45b765f20ecad732f48ffff4"/></dir></dir></dir></dir></dir><dir name="layout"><file name="proonto_chat.xml" hash="557b9306e7a33beb17a1c3437f8e57b0"/></dir></dir></dir></dir></target><target name="magemedia"><dir name="."><file name="proonto_chat_terms_of_use.pdf" hash="9ebd76dcf681d166b9a314807a70da7e"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="proonto"><dir name="chat"><dir name="images"><file name="logo_green_blue_big.png" hash="0b03957ee49dd3ee67e60d3551f1bef6"/><file name="logo_green_blue_small.png" hash="8aa6ae76764c1206adc0cf23294be957"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Proonto_Chat.csv" hash="a73f74909442b1c0e67fee03a8e4df4e"/></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
22
+ </package>
skin/adminhtml/default/default/proonto/chat/images/logo_green_blue_big.png ADDED
Binary file
skin/adminhtml/default/default/proonto/chat/images/logo_green_blue_small.png ADDED
Binary file