Velaro_Chat - Version 1.3.1

Version Notes

-Fix missing files

Download this release

Release Info

Developer Velaro
Extension Velaro_Chat
Version 1.3.1
Comparing to
See all releases


Code changes from version 1.3.0 to 1.3.1

app/code/community/Velaro/Chat/Block/Adminhtml/Chat.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Velaro
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Velaro
13
+ * @package Velaro_Chat
14
+ * @copyright Copyright (c) 2015 Velaro (http://www.velaro.com)
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Velaro_Chat_Block_Adminhtml_Chat extends Mage_Core_Block_Template
18
+ {
19
+ public function __construct(array $args = array())
20
+ {
21
+ parent::__construct($args);
22
+ }
23
+
24
+ protected function _toHtml()
25
+ {
26
+ /* @var $block Mage_Core_Block_Template */
27
+ $block = $this->getLayout()->createBlock(
28
+ 'core/template',
29
+ 'velaro_index',
30
+ array(
31
+ 'template' => 'velaro/settings.phtml'
32
+ )
33
+ );
34
+
35
+ return $block->toHtml();
36
+ }
37
+ }
38
+ ?>
app/code/community/Velaro/Chat/Helper/Data.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Velaro
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Velaro
13
+ * @package Velaro_Chat
14
+ * @copyright Copyright (c) 2015 Velaro (http://www.velaro.com)
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Velaro_Chat_Helper_Data extends Mage_Core_Helper_Abstract
18
+ {
19
+
20
+ }
21
+ ?>
22
+
app/code/community/Velaro/Chat/controllers/VelaroController.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Velaro
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Velaro
13
+ * @package Velaro_Chat
14
+ * @copyright Copyright (c) 2015 Velaro (http://www.velaro.com)
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+ class Velaro_Chat_VelaroController extends Mage_Adminhtml_Controller_Action
18
+ {
19
+
20
+ public function indexAction()
21
+ {
22
+ $this->loadLayout();
23
+ $this->_setActiveMenu('velaro');
24
+ $this->getLayout()->getBlock('velaro_index');
25
+ $this->getLayout()->getBlock('velaro_footer');
26
+ $this->renderLayout();
27
+ }
28
+
29
+ public function saveAction(){
30
+ $form = $this->getRequest()->getPost();
31
+ $configModel = new Mage_Core_Model_Config();
32
+ $previousApiKey = Mage::getStoreConfig('velaro/velaroconfig/velaroapikey', Mage::app()->getStore());
33
+ $siteId = $form['velaro_site_identifier'];
34
+ $configModel->saveConfig('velaro/velaroconfig/siteIdentifier', $form['velaro_site_identifier']);
35
+ $configModel->saveConfig('velaro/velaroconfig/velaroapikey', $form['velaro_api_key']);
36
+ $configModel->saveConfig('velaro/velaroconfig/velaropageassignments', $form['velaro_page_assignments']);
37
+ $configModel->saveConfig('velaro/velaroconfig/username', $form['velaro_username']);
38
+ $configModel->saveConfig('velaro/velaroconfig/password', $form['velaro_password']);
39
+ $configModel->saveConfig('velaro/velaroconfig/accountlinked', $form['velaro_site_identifier'] == '' ? 0 : 1);
40
+ $configModel->saveConfig('velaro/velaroconfig/enabled', $form['velaro_enabled']);
41
+ $configModel->saveConfig('velaro/velaroconfig/visitormonitoring', $form['velaro_visitor_monitoring']);
42
+
43
+ //Api key changed, create the conversion
44
+ if($previousApiKey != $form['velaro_api_key'] && $form['velaro_api_key'] != '')
45
+ {
46
+ $velaro_group_args = array('APIKEY' => $form['velaro_api_key'], 'Content-type' => 'application/json; charset=utf-8');
47
+ $velaro_api_url = Mage::getConfig()->getNode('default/velaro/velaroapimainurl');
48
+ $client = new Zend_Http_Client($velaro_api_url . '/v1/' . $siteId . '/Conversion/AddForPlugin');
49
+ $client->setHeaders($velaro_group_args);
50
+ $conversion = array(
51
+ 'ConversionName' => 'Magento Checkout',
52
+ 'Url' => Mage::helper('checkout/url')->getCheckoutUrl() . 'success/',
53
+ 'DefaultDollarAmount' => '0',
54
+ 'DollarAmountVariable' => 'MagentoCartTotal',
55
+ 'AllowOnce' => 'false',
56
+ );
57
+ $json = Zend_Json::encode($conversion);
58
+ $response = $client->setRawData($json, 'application/json')->request('POST');
59
+ }
60
+ $this->_redirect('*/velaro/index');
61
+ }
62
+
63
+ protected function _isAllowed()
64
+ {
65
+ return Mage::getSingleton('admin/session')->isAllowed('velaro/index');
66
+ }
67
+
68
+ }
69
+
70
+ ?>
71
+
app/code/community/Velaro/Chat/etc/adminhtml.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!-- /**
3
+ * Velaro
4
+ *
5
+ * notice of license
6
+ *
7
+ * this source file is subject to the open software license (osl 3.0)
8
+ * that is bundled with this package in the file license.txt.
9
+ * it is also available through the world-wide-web at this url:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Velaro
13
+ * @package Velaro_chat
14
+ * @copyright copyright (c) 2015 Velaro (http://www.velaro.com)
15
+ * @license http://opensource.org/licenses/osl-3.0.php open software license (osl 3.0)
16
+ */ -->
17
+ <config>
18
+ <menu>
19
+ <velaro translate="title" module="velaro_chat">
20
+ <title>Velaro</title>
21
+ <sort_order>10</sort_order>
22
+ <action>adminhtml/velaro</action>
23
+ </velaro>
24
+ </menu>
25
+ <acl>
26
+ <resources>
27
+ <admin>
28
+ <children>
29
+ <velaro translate="title" module="velaro_chat">
30
+ <title>Velaro</title>
31
+ <sort_order>65</sort_order>
32
+ </velaro>
33
+ </children>
34
+ </admin>
35
+ </resources>
36
+ </acl>
37
+ </config>
app/code/community/Velaro/Chat/etc/config.xml ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!-- /**
3
+ * Velaro
4
+ *
5
+ * notice of license
6
+ *
7
+ * this source file is subject to the open software license (osl 3.0)
8
+ * that is bundled with this package in the file license.txt.
9
+ * it is also available through the world-wide-web at this url:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Velaro
13
+ * @package Velaro_chat
14
+ * @copyright copyright (c) 2015 Velaro (http://www.velaro.com)
15
+ * @license http://opensource.org/licenses/osl-3.0.php open software license (osl 3.0)
16
+ */ -->
17
+ <config>
18
+ <modules>
19
+ <Velaro_Chat>
20
+ <version>1.0.2</version>
21
+ </Velaro_Chat>
22
+ </modules>
23
+ <frontend>
24
+ <layout>
25
+ <updates>
26
+ <velaro_chat>
27
+ <file>velaro.xml</file>
28
+ </velaro_chat>
29
+ </updates>
30
+ </layout>
31
+ </frontend>
32
+ <adminhtml>
33
+ <layout>
34
+ <updates>
35
+ <velaro_chat>
36
+ <file>velaro.xml</file>
37
+ </velaro_chat>
38
+ </updates>
39
+ </layout>
40
+ <acl>
41
+ <resources>
42
+ <admin>
43
+ <children>
44
+ <system>
45
+ <children>
46
+ <config>
47
+ <children>
48
+ <velaro translate="title" module="velaro_chat">
49
+ <title>Velaro Configuration section</title>
50
+ </velaro>
51
+ </children>
52
+ </config>
53
+ </children>
54
+ </system>
55
+ </children>
56
+ </admin>
57
+ </resources>
58
+ </acl>
59
+ </adminhtml>
60
+ <global>
61
+
62
+ <helpers>
63
+ <velaro_chat>
64
+ <class>Velaro_Chat_Helper</class>
65
+ </velaro_chat>
66
+ </helpers>
67
+ <blocks>
68
+ <chat>
69
+ <class>Velaro_Chat_Block</class>
70
+ </chat>
71
+ </blocks>
72
+ </global>
73
+ <admin>
74
+ <routers>
75
+ <adminhtml>
76
+ <args>
77
+ <modules>
78
+ <Velaro_Chat after="Mage_Adminhtml">Velaro_Chat</Velaro_Chat>
79
+ </modules>
80
+ </args>
81
+ </adminhtml>
82
+ </routers>
83
+ </admin>
84
+ <default>
85
+ <velaro>
86
+ <enabled>1</enabled>
87
+ <username></username>
88
+ <password></password>
89
+ <siteIdentifier></siteIdentifier>
90
+ <visitormonitoring>1</visitormonitoring>
91
+ <accountlinked>0</accountlinked>
92
+ <velaroapikey></velaroapikey>
93
+ <!--<velarochatenv>dev</velarochatenv>
94
+ <velarobaseurl>http://consolenew.local.velaro.com</velarobaseurl>
95
+ <velaroapimainurl>http://main.api.local.velaro.com</velaroapimainurl>-->
96
+ <velarochatenv>prd</velarochatenv>
97
+ <velarobaseurl>https://app.velaro.com</velarobaseurl>
98
+ <velaroapimainurl>https://api-main-us-east.velaro.com</velaroapimainurl>
99
+ <velaropageassignments></velaropageassignments>
100
+ </velaro>
101
+ </default>
102
+ </config>
app/code/community/Velaro/Chat/etc/system.xml ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!-- /**
3
+ * Velaro
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Velaro
13
+ * @package Velaro_Chat
14
+ * @copyright Copyright (c) 2015 Velaro (http://www.velaro.com)
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */ -->
17
+ <config>
18
+ <tabs>
19
+ <velaroconfig translate="label" module="velaro_chat">
20
+ <label>Velaro</label>
21
+ <sort_order>99999</sort_order>
22
+ </velaroconfig>
23
+ </tabs>
24
+ <sections>
25
+ <velaro>
26
+ <class>separator-top</class>
27
+ <label>Configuration</label>
28
+ <tab>velaroconfig</tab>
29
+ <frontend_type>text</frontend_type>
30
+ <sort_order>500</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ <groups>
35
+ <velaroconfig translate="label">
36
+ <label>Configure Velaro</label>
37
+ <frontend_type>text</frontend_type>
38
+ <sort_order>10</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
+ <fields>
43
+ <enabled tranlate="label">
44
+ <label>Velaro Chat Active</label>
45
+ <frontend_type>select</frontend_type>
46
+ <source_model>adminhtml/system_config_source_yesno</source_model>
47
+ <sort_order>10</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ </enabled>
52
+ <username translate="label">
53
+ <label>Username</label>
54
+ <comment>(email address)</comment>
55
+ <frontend_type>label</frontend_type>
56
+ <sort_order>30</sort_order>
57
+ <depends><enabled>1</enabled></depends>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ </username>
62
+ <password translate="label">
63
+ <label>Password</label>
64
+ <sort_order>50</sort_order>
65
+ <depends><enabled>1</enabled></depends>
66
+ <show_in_default>0</show_in_default>
67
+ <show_in_website>0</show_in_website>
68
+ <show_in_store>0</show_in_store>
69
+ </password>
70
+ <siteIdentifier translate="label">
71
+ <label>Site Identifier</label>
72
+ <frontend_type>label</frontend_type>
73
+ <sort_order>60</sort_order>
74
+ <depends><enabled>1</enabled></depends>
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
+ </siteIdentifier>
79
+ <visitormonitoring tranlate="label">
80
+ <label>Visitor monitoring enabled</label>
81
+ <frontend_type>select</frontend_type>
82
+ <source_model>adminhtml/system_config_source_yesno</source_model>
83
+ <sort_order>70</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>1</show_in_store>
87
+ </visitormonitoring>
88
+ <accountlinked tranlate="label">
89
+ <label>Account Linked</label>
90
+ <frontend_type>label</frontend_type>
91
+ <depends><enabled>1</enabled></depends>
92
+ <sort_order>90</sort_order>
93
+ <show_in_default>0</show_in_default>
94
+ <show_in_website>0</show_in_website>
95
+ <show_in_store>0</show_in_store>
96
+ </accountlinked>
97
+ <velaroapikey tranlate="label">
98
+ <label></label>
99
+ <frontend_type>label</frontend_type>
100
+ <depends><enabled>1</enabled></depends>
101
+ <sort_order>90</sort_order>
102
+ <show_in_default>0</show_in_default>
103
+ <show_in_website>0</show_in_website>
104
+ <show_in_store>0</show_in_store>
105
+ </velaroapikey>
106
+ <velarobaseurl tranlate="label">
107
+ <label></label>
108
+ <frontend_type>label</frontend_type>
109
+ <sort_order>90</sort_order>
110
+ <show_in_default>0</show_in_default>
111
+ <show_in_website>0</show_in_website>
112
+ <show_in_store>0</show_in_store>
113
+ </velarobaseurl>
114
+ <velaroapimainurl tranlate="label">
115
+ <label></label>
116
+ <frontend_type>label</frontend_type>
117
+ <sort_order>90</sort_order>
118
+ <show_in_default>0</show_in_default>
119
+ <show_in_website>0</show_in_website>
120
+ <show_in_store>0</show_in_store>
121
+ </velaroapimainurl>
122
+ <velaropageassignments tranlate="label">
123
+ <label></label>
124
+ <frontend_type>label</frontend_type>
125
+ <depends><enabled>1</enabled></depends>
126
+ <sort_order>90</sort_order>
127
+ <show_in_default>0</show_in_default>
128
+ <show_in_website>0</show_in_website>
129
+ <show_in_store>0</show_in_store>
130
+ </velaropageassignments>
131
+ </fields>
132
+ </velaroconfig>
133
+ </groups>
134
+ </velaro>
135
+ </sections>
136
+ </config>
app/design/adminhtml/default/default/layout/velaro.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!-- /**
3
+ * Velaro
4
+ *
5
+ * notice of license
6
+ *
7
+ * this source file is subject to the open software license (osl 3.0)
8
+ * that is bundled with this package in the file license.txt.
9
+ * it is also available through the world-wide-web at this url:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Velaro
13
+ * @package Velaro_chat
14
+ * @copyright copyright (c) 2015 Velaro (http://www.velaro.com)
15
+ * @license http://opensource.org/licenses/osl-3.0.php open software license (osl 3.0)
16
+ */ -->
17
+ <layout>
18
+ <adminhtml_velaro_index>
19
+ <reference name="content">
20
+ <block type="adminhtml/template" name="velaro_index" template="velaro/settings.phtml" />
21
+ </reference>
22
+ <reference name="head">
23
+ <action method="addJs"><script>velaro_chat/velaro-admin.js</script></action>
24
+ <action method="addJs"><script>prototype/prototype.js</script></action>
25
+ </reference>
26
+ </adminhtml_velaro_index>
27
+ </layout>
app/design/adminhtml/default/default/template/velaro/footerscripts.phtml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--/**
2
+ * Velaro
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Velaro
12
+ * @package Velaro_Chat
13
+ * @copyright Copyright (c) 2015 Velaro (http://www.velaro.com)
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */-->
16
+ <div>
17
+ <script type="text/javascript">
18
+ // on click link, fire request to velaro to get the site identifier/api key for this login, will be stored in our options
19
+ $('#velaro_attach').off();
20
+ $('#velaro_attach').on('click', function () {
21
+ var userName = $('[name=velaro_username]').val();
22
+ var password = $('[name=velaro_password]').val();
23
+ var model = {
24
+ UserName: userName,
25
+ Password: password
26
+ };
27
+ $.ajax({
28
+ url: velaro_args.velaro_url,
29
+ type: 'POST',
30
+ data: JSON.stringify(model),
31
+ success: function (data) {
32
+ $('[name=velaro_site_identifier]').attr('value', data.Identifier);
33
+ $('[name=velaro_api_key]').attr('value', data.ApiKey);
34
+ $('input[type=submit]').click();
35
+ },
36
+ error: function (data) {
37
+ $('[name=velaro_site_identifier]').attr('value', null);
38
+ $('[name=velaro_api_key]').attr('value', null);
39
+ $('input[type=submit]').click();
40
+ },
41
+ dataType: 'json',
42
+ contentType: 'application/json'
43
+ });
44
+ });
45
+ </script>
46
+ </div>
app/design/adminhtml/default/default/template/velaro/settings.phtml ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--/**
2
+ * Velaro
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Velaro
12
+ * @package Velaro_Chat
13
+ * @copyright Copyright (c) 2015 Velaro (http://www.velaro.com)
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */-->
16
+ <div>
17
+ <style>
18
+ .velaro-form{
19
+ background-color: white;
20
+ border-radius: .5em;
21
+ }
22
+ .velaro-form-header{
23
+ border-bottom: 1px solid rgba(0, 0, 0, 0.05);
24
+ font-weight: bold;
25
+ color: #23282d;
26
+ font-size: 1.3em;
27
+ vertical-align: middle;
28
+ padding: 10px 0 0 10px;
29
+ margin: 0 5px 20px 5px;
30
+ }
31
+ .velaro-label-wrapper{
32
+ width: 250px;
33
+ float: left;
34
+ padding-left: 50px;
35
+ font-weight: bold;
36
+ color: #23282d;
37
+ font-size: 1.1em;
38
+ }
39
+ .velaro-input-group{
40
+ margin-bottom: 15px;
41
+ }
42
+ .thin{
43
+ font-weight: 300;
44
+ }
45
+ .velaro-button{
46
+ margin-left: 360px;
47
+ }
48
+ div.velaro-button input{
49
+ width: 80px;
50
+ }
51
+ </style>
52
+
53
+ <h2>Velaro Live Chat</h2>
54
+ <form name="velaro_form" method="post" action="<?php echo Mage::helper("adminhtml")->getUrl("*/*/save") ?>" class="velaro-form">
55
+ <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
56
+
57
+ <div class="velaro-form-header">Configuration</div>
58
+
59
+ <input type="hidden" name="velaro_site_identifier" value="<?php echo Mage::getStoreConfig('velaro/velaroconfig/siteIdentifier', Mage::app()->getStore()); ?>" />
60
+ <input type="hidden" name="velaro_api_key" value="<?php echo Mage::getStoreConfig('velaro/velaroconfig/velaroapikey', Mage::app()->getStore()); ?>" />
61
+ <input type="hidden" name="velaro_page_assignments" value="<?php echo htmlspecialchars(Mage::getStoreConfig('velaro/velaroconfig/velaropageassignments', Mage::app()->getStore())); ?>" />
62
+ <input type="hidden" name="velaro_enabled" value="<?php echo Mage::getStoreConfig('velaro/velaroconfig/enabled', Mage::app()->getStore()); ?>" />
63
+ <input type="hidden" name="velaro_visitor_monitoring" value="<?php echo Mage::getStoreConfig('velaro/velaroconfig/visitormonitoring', Mage::app()->getStore()); ?>" />
64
+ <input type="hidden" name="velarobaseurl" value="<?php echo Mage::getConfig()->getNode('default/velaro/velarobaseurl'); ?>" />
65
+
66
+ <div class="velaro-input-group">
67
+ <div class="velaro-label-wrapper"><label>Username <span class="thin">(email)</span></label></div>
68
+ <input type="text" name="velaro_username" value="<?php echo Mage::getStoreConfig('velaro/velaroconfig/username', Mage::app()->getStore());?>" />
69
+ </div>
70
+
71
+ <div class="velaro-input-group">
72
+ <div class="velaro-label-wrapper"><label class="velaro-label">Password</label></div>
73
+ <input type="password" name="velaro_password" value="<?php echo Mage::getStoreConfig('velaro/velaroconfig/password', Mage::app()->getStore());?>" />
74
+ </div>
75
+
76
+ <div class="velaro-input-group">
77
+ <div class="velaro-label-wrapper"><label class="velaro-label">Account is linked</label></div>
78
+ <label><?php echo(false != Mage::getStoreConfig('velaro/velaroconfig/accountlinked', Mage::app()->getStore()) ? 'Yes' : 'No <span class="thin">(Account must be linked to recieve chats)</span>') ?></label>
79
+ </div>
80
+
81
+ <div class="velaro-button">
82
+ <p class="submit"><input type="button" name="velaro_attach" id="velaro_attach" class="button button-primary" value="Link"></p>
83
+ </div>
84
+
85
+ <div class="velaro-form-header">Plugin Settings</div>
86
+
87
+ <div class="velaro-input-group">
88
+ <div class="velaro-label-wrapper"><label>Enabled</label></div>
89
+ <select name="velaro-enabled">
90
+ <option value="1">Yes</option>
91
+ <option value="0">No</option>
92
+ </select>
93
+ </div>
94
+
95
+ <div class="velaro-input-group">
96
+ <div class="velaro-label-wrapper"><label>Enable Visitor Monitoring</label></div>
97
+ <select name="velaro-visitor-monitoring">
98
+ <option value="1">Yes</option>
99
+ <option value="0">No</option>
100
+ </select>
101
+ </div>
102
+
103
+ <div class="velaro-form-header">Chat Routing</div>
104
+ <div class="velaro-input-group">
105
+ <div class="velaro-label-wrapper"><label class="velaro-label">When on Page</label></div>
106
+ <select class="velaro-page-select">
107
+ <?php
108
+ // get all pages for pages dropdown
109
+ $velaro_pages = Mage::getModel('cms/page')->getCollection();
110
+ $velaro_page_select = '<select>';
111
+ foreach ( $velaro_pages as $velaro_page ) {
112
+ $option = '<option value="' . $velaro_page->page_id . '">';
113
+ $option .= $velaro_page->title;
114
+ $option .= '</option>';
115
+ echo $option;
116
+ }
117
+ ?>
118
+ </select>
119
+ </div>
120
+ <div class="velaro-input-group">
121
+ <div class="velaro-label-wrapper"><label class="velaro-label">Route chats to group</label></div>
122
+ <?php
123
+ // if we have an api key, get list of groups from velaro, display in dropdown
124
+ $velaro_api_key = Mage::getStoreConfig('velaro/velaroconfig/velaroapikey', Mage::app()->getStore);
125
+ $velaro_base_url = Mage::getConfig()->getNode('default/velaro/velarobaseurl');
126
+ if(!isset($velaro_api_key) || $velaro_api_key == '' ) {
127
+ echo '<select class="velaro-group-select"><option value ="0">Default Group</option></select>';
128
+ }
129
+ else {
130
+ $velaro_group_args = array('APIKEY' => $velaro_api_key);
131
+ $client = new Zend_Http_Client($velaro_base_url . '/api/plugins/groups');
132
+ $client->setHeaders($velaro_group_args);
133
+ $response = $client->request()->getBody();
134
+ $velaro_groups = Zend_Json::decode($response);
135
+ $velaro_group_select = '<select class="velaro-group-select"><option value ="0">Default Group</option>';
136
+ if($velaro_api_key && is_array($velaro_groups)){
137
+ foreach($velaro_groups as $velaro_group){
138
+ $velaro_group_select .= "\
139
+ <option value='$velaro_group[Key]'>$velaro_group[Value]</option>";
140
+ }
141
+ }
142
+ $velaro_group_select .= "\
143
+ </select>";
144
+ echo $velaro_group_select;
145
+ }
146
+ ?>
147
+ </div>
148
+
149
+ <div class="velaro-button">
150
+ <p class="submit"><input type="submit" name="velaro_submit" id="velaro_submit" class="button button-primary" value="Save"></p>
151
+ </div>
152
+
153
+ </form>
154
+ </div>
155
+
156
+
157
+
app/design/frontend/base/default/layout/velaro.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!--/**
3
+ * Velaro
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Velaro
13
+ * @package Velaro_Chat
14
+ * @copyright Copyright (c) 2015 Velaro (http://www.velaro.com)
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */-->
17
+ <layout version="1.0.0">
18
+ <default>
19
+ <reference name="before_body_end">
20
+ <block type="core/template" after="-" template="velaro/chatscript.phtml">
21
+ <action method="setCacheLifetime"><s>0</s></action>
22
+ </block>
23
+ </reference>
24
+ </default>
25
+ </layout>
app/design/frontend/base/default/template/velaro/chatscript.phtml ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--/**
2
+ * Velaro
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * @category Velaro
12
+ * @package Velaro_Chat
13
+ * @copyright Copyright (c) 2015 Velaro (http://www.velaro.com)
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */-->
16
+
17
+ <style>
18
+ #velarochat img {
19
+ display: inline;
20
+ }
21
+ </style>
22
+
23
+ <?php if(!Mage::getStoreConfig('velaro/velaroconfig/enabled', Mage::app()->getStore()) || !Mage::getStoreConfig('velaro/velaroconfig/accountlinked', Mage::app()->getStore()))
24
+ {
25
+ return;
26
+ }
27
+ $velaro_env = Mage::getConfig()->getNode('default/velaro/velarochatenv');
28
+
29
+ if('dev' == $velaro_env){
30
+ echo '<script src="http://azuregallerydev.blob.core.windows.net/velaroscripts/local-globals.js"></script>
31
+ <script src="http://cdn.local.velaro.com/APIVisitor/Lib/Js/dev/velaro.loadscripts.js"></script>';
32
+ }
33
+
34
+ if('prd' == $velaro_env){
35
+ echo '<script src="https://galleryuseastprod.blob.core.windows.net/velaroscripts/' . Mage::getStoreConfig('velaro/velaroconfig/siteIdentifier', Mage::app()->getStore()) . '/globals.js"></script>
36
+ <script src="https://galleryuseastprod.blob.core.windows.net/velaroscripts/velaro.loadscripts.js"></script>';
37
+ }
38
+ ?>
39
+
40
+
41
+
42
+ <script type="text/javascript">
43
+ velaro_args = {};
44
+ velaro_args.velaro_page_assignments = <?php echo (Mage::getStoreConfig('velaro/velaroconfig/velaropageassignments', Mage::app()->getStore())) != null ? Mage::getStoreConfig('velaro/velaroconfig/velaropageassignments', Mage::app()->getStore()): 'null'; ?>;
45
+ velaro_args.velaro_page_id = <?php echo ($this->getRequest()->getParam('page_id') == '' ? 'null' : $this->getRequest()->getParam('page_id'))?>;
46
+
47
+ // parse out our page assingments and see if the current page has an assigned group, if not default to 0
48
+ var pageAssignments = velaro_args.velaro_page_assingments ? JSON.parse(velaro_args.velaro_page_assingments) : {};
49
+ var group = pageAssignments['page_' + velaro_args.velaro_page_id] || 0;
50
+
51
+ // properties needed for velaro chat
52
+ Velaro.Globals.ActiveSite = <?php echo (Mage::getStoreConfig('velaro/velaroconfig/siteIdentifier', Mage::app()->getStore())); ?>;
53
+ Velaro.Globals.ActiveGroup = group;
54
+ Velaro.Globals.InlineEnabled = true;
55
+ Velaro.Globals.VisitorMonitoringEnabled = <?php echo (Mage::getStoreConfig('velaro/velaroconfig/visitormonitoring', Mage::app()->getStore()) == 0 ? 'false': 'true'); ?>;
56
+ Velaro.Globals.InlinePosition = 0;
57
+ Velaro.Globals.CustomChatValues = { <?php $quote = Mage::getModel('checkout/session')->getQuote();
58
+ $quoteData= $quote->getData();
59
+ $sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
60
+ $oOrder = Mage::getModel('sales/order')->load($sOrderId);
61
+ $succesTotal = $oOrder->getGrandTotal();
62
+ // if on checkout success page, total = total of the last order
63
+ if(Mage::app()->getFrontController()->getAction()->getFullActionName()== 'checkout_onepage_success'){
64
+ $total = $succesTotal;
65
+ }
66
+ $total = isset($total) ? $total : $quoteData['grand_total'];
67
+ echo (isset($total) ? ('MagentoCartTotal: ' . $total . ',' ) : 'MagentoCartTotal: 0,');
68
+
69
+ $cart = Mage::getModel('checkout/cart')->getQuote();
70
+ $allItems = $quote->getAllItems();
71
+ if(isset($allItems) && count($allItems) > 0){
72
+ echo 'MagentoCart: [';
73
+ foreach ($allItems as $item) {
74
+ $_product = Mage::getModel('catalog/product')->load($item->getProductId());
75
+ $_product_data = $_product->getData();
76
+ echo '{ Name: "' . $_product_data['name'] .
77
+ '" , Price: ' . $_product_data['price'] .
78
+ ' , Image: "' . $_product_data['image'] .
79
+ '" , Url: "' . $_product->getProductUrl() .
80
+ '", Quantity: ' . $item->getQty() . '},';
81
+ }
82
+ echo '],';
83
+ }
84
+
85
+ $rcv = Mage::getSingleton('Mage_Reports_Block_Product_Viewed')->getItemsCollection();
86
+ echo 'MagentoRecentlyViewedItems:[';
87
+ foreach ($rcv as $item)
88
+ {
89
+ $_product = Mage::getModel('catalog/product')->load($item->getProductId());
90
+ $_product_data = $_product->getData();
91
+ echo '{ Name: "' . $_product_data['name'] . '",' .
92
+ ' Image: "' . $_product_data['image'] . '",' .
93
+ ' Url: "' . $_product->getProductUrl() . '",' .
94
+ ' Sku: "' . $_product_data['sku'] . '",' .
95
+ ' Price: "' . $_product_data['price'] . '",' .
96
+ '},';
97
+ }
98
+ echo '],';
99
+
100
+ echo 'MagentoRelatedItems:[';
101
+
102
+ $allRelatedProductIds = [];
103
+ foreach ($rcv as $item) {
104
+ $_product = Mage::getModel('catalog/product')->load($item->getProductId());
105
+ $relatedProducts = $_product->getRelatedProductIds();
106
+ foreach($relatedProducts as $relatedProduct){
107
+ if(false == in_array($relatedProduct, $allRelatedProductIds)){
108
+ array_push($allRelatedProductIds, $relatedProduct);
109
+ }
110
+ }
111
+ }
112
+
113
+ foreach ($allRelatedProductIds as $id) {
114
+ $relatedProduct = Mage::getModel('catalog/product')->load($id);
115
+ $_product_data = $relatedProduct->getData();
116
+ echo '{ Name: "' . $_product_data['name'] . '",' .
117
+ ' Image: "' . $_product_data['image'] . '",' .
118
+ ' Url: "' . $_product->getProductUrl() . '",' .
119
+ ' Sku: "' . $_product_data['sku'] . '",' .
120
+ ' Price: "' . $_product_data['price'] . '",' .
121
+ '},';
122
+ }
123
+
124
+ echo '],';
125
+
126
+ echo 'MagentoBaseUrl: "' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . '"';
127
+
128
+ ?>
129
+ }
130
+ </script>
131
+ <noscript>
132
+ <a href="https://www.velaro.com" title="Contact us" target="_blank">Questions?</a>
133
+ powered by <a href="http://www.velaro.com" title="Velaro live chat">velaro live chat</a>
134
+ </noscript>
app/etc/modules/Velaro_Chat.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!--/**
3
+ * Velaro
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Velaro
13
+ * @package Velaro_Chat
14
+ * @copyright Copyright (c) 2015 Velaro (http://www.velaro.com)
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */-->
17
+ <config>
18
+ <modules>
19
+ <Velaro_Chat>
20
+ <active>true</active>
21
+ <codePool>community</codePool>
22
+ <depends>
23
+ <Mage_Adminhtml />
24
+ </depends>
25
+ </Velaro_Chat>
26
+ </modules>
27
+ </config>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Velaro_Chat</name>
4
- <version>1.3.0</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/OSL-3.0">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Add Velaro Live Chat into your pages</summary>
10
  <description>Add Velaro Live Chat into your pages</description>
11
- <notes>-Passing related items, and recently viewed items to velaro for integration</notes>
12
  <authors><author><name>Velaro</name><user>jtuttle87</user><email>jonathan@velaro.com</email></author></authors>
13
- <date>2016-03-16</date>
14
- <time>19:31:08</time>
15
- <contents><target name="magedesign"><dir name="."><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="velaro.xml" hash=""/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="velaro.xml" hash=""/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="."><dir name="app"><dir name="etc"><dir name="modules"><file name="Velaro_Chat.xml" hash=""/></dir></dir></dir></dir></target><target name="mageweb"><dir name="."><dir name="js"><dir name="velaro_chat"><file name="velaro-admin.js" hash="514733cc14c15496180a79b504481fb5"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>5.5.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Velaro_Chat</name>
4
+ <version>1.3.1</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/OSL-3.0">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Add Velaro Live Chat into your pages</summary>
10
  <description>Add Velaro Live Chat into your pages</description>
11
+ <notes>-Fix missing files</notes>
12
  <authors><author><name>Velaro</name><user>jtuttle87</user><email>jonathan@velaro.com</email></author></authors>
13
+ <date>2016-03-21</date>
14
+ <time>19:13:25</time>
15
+ <contents><target name="magecommunity"><dir name="Velaro"><dir name="Chat"><dir name="Block"><dir name="Adminhtml"><file name="Chat.php" hash="b19da118e22d718aade5a5aa153b50d1"/></dir></dir><dir name="Helper"><file name="Data.php" hash="7f21fbcbf6d766b3a68c4383557448f6"/></dir><dir name="controllers"><file name="VelaroController.php" hash="2ec3c920fef51ce164c9e9db6f8c96a9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="e8492df651174367d07f9e2fded6076f"/><file name="config.xml" hash="34b0a1540bf02e7062b0305b8bee1c03"/><file name="system.xml" hash="f3684613501f217433b5d9b6c59444f9"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="velaro.xml" hash="b20d10f8f8e04c4817286ffd5b8a54b6"/></dir><dir name="template"><dir name="velaro"><file name="footerscripts.phtml" hash="333a3627721477f055b86827494df68b"/><file name="settings.phtml" hash="436bd6cbf31c31de24f4d22266b913fa"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="velaro.xml" hash="64adfbe3e88c67d94f16f2b880ff2842"/></dir><dir name="template"><dir name="velaro"><file name="chatscript.phtml" hash="08f4c212f841ac4f3d97ef33c0e11a3e"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Velaro_Chat.xml" hash="6b35a002ff559e0c99e1764dab21d641"/></dir></target><target name="mageweb"><dir name="js"><dir name="velaro_chat"><file name="velaro-admin.js" hash="514733cc14c15496180a79b504481fb5"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>5.5.0</max></php></required></dependencies>
18
  </package>