Version Notes
Download this release
Release Info
Developer | Tzvi |
Extension | a4269d6e2e81b1c6544b8c29812b8a35 |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Bontact/Widget/Block/Accountconfig.php +231 -0
- app/code/local/Bontact/Widget/Block/Status.php +21 -0
- app/code/local/Bontact/Widget/Model/Bontact.php +33 -0
- app/code/local/Bontact/Widget/Model/Mysql4/Bontact.php +9 -0
- app/code/local/Bontact/Widget/Model/Mysql4/Bontact/Collection.php +10 -0
- app/code/local/Bontact/Widget/controllers/AdminController.php +22 -0
- app/code/local/Bontact/Widget/controllers/IndexController.php +14 -0
- app/code/local/Bontact/Widget/controllers/bontact.phtml +67 -0
- app/code/local/Bontact/Widget/etc/config.xml +122 -0
- app/code/local/Bontact/Widget/sql/bontact_setup/mysql4-install-0.1.0.php +18 -0
- app/design/frontend/base/default/layout/bontact.xml +10 -0
- app/design/frontend/base/default/template/bontact/status.phtml +18 -0
- app/etc/modules/Bontact_Widget.xml +9 -0
- package.xml +48 -0
app/code/local/Bontact/Widget/Block/Accountconfig.php
ADDED
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Bontact_Widget_Block_Accountconfig extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
private $bon;
|
7 |
+
protected function _toHtml()
|
8 |
+
{
|
9 |
+
$this->bon = Mage::getModel('bontact/bontact')->load(1);
|
10 |
+
if ($this->getRequest()->getParam('bont-action')=="disconnect")
|
11 |
+
{
|
12 |
+
$this->saveWidgetId('');
|
13 |
+
|
14 |
+
}
|
15 |
+
if($this->bon->getWidgetId() != "")
|
16 |
+
{
|
17 |
+
$html = '<div class ="logoa">
|
18 |
+
<img calss="logo" src="http://bontact.com/wp-content/uploads/logo.png" alt="bontact">
|
19 |
+
</div>
|
20 |
+
<br/>
|
21 |
+
<br/>
|
22 |
+
<form class="" action="'.$this->curPageURL().'" method="get" id="contact-form">
|
23 |
+
<input type="hidden" name="bont-action" value="disconnect" />
|
24 |
+
|
25 |
+
<button type="submit" id="send" class="btn btn-success">Disconnect</button>
|
26 |
+
</form>';
|
27 |
+
}
|
28 |
+
else
|
29 |
+
{
|
30 |
+
if ($this->getRequest()->getParam('bont-action')=="loginup")
|
31 |
+
{
|
32 |
+
$data_return = json_decode(file_get_contents("https://dashboard.bontact.com/api/bontactapi.aspx?func=signup&username=".$this->getRequest()->getParam('username')."&password=".$this->getRequest()->getParam('password')."&package=free&telephone=".$this->getRequest()->getParam('tel')."&usertype=71"));
|
33 |
+
if($data_return->status==true)
|
34 |
+
{
|
35 |
+
$this->saveWidgetId($data_return->token);
|
36 |
+
}
|
37 |
+
else
|
38 |
+
{
|
39 |
+
$html = '
|
40 |
+
<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">'.$data_return->message.'</div></li></ul></li></ul><br></div>
|
41 |
+
';
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
45 |
+
if ($this->getRequest()->getParam('bont-action')=="login")
|
46 |
+
{
|
47 |
+
|
48 |
+
$data_return = json_decode(file_get_contents("https://dashboard.bontact.com/api/bontactapi.aspx?func=login&username=".$this->getRequest()->getParam('username')."&password=".$this->getRequest()->getParam('password')));
|
49 |
+
if($data_return->code==200)
|
50 |
+
{
|
51 |
+
$this->saveWidgetId($data_return->token);
|
52 |
+
}
|
53 |
+
else
|
54 |
+
{
|
55 |
+
$html = '
|
56 |
+
<div id="messagesbox"><ul class="messages"><li class="error-msg"><ul><li><div id="themessage">'.$data_return->token.'</div></li></ul></li></ul><br></div>
|
57 |
+
';
|
58 |
+
}
|
59 |
+
|
60 |
+
}
|
61 |
+
else
|
62 |
+
{
|
63 |
+
$html .='
|
64 |
+
<style>
|
65 |
+
.wrap {
|
66 |
+
margin: 10px 20px 0 2px;
|
67 |
+
}
|
68 |
+
header {
|
69 |
+
background: #534741;
|
70 |
+
color: #fff;
|
71 |
+
padding-top: 15px;
|
72 |
+
padding-right: 15px;
|
73 |
+
padding-bottom: 15px;
|
74 |
+
padding-left: 15px;
|
75 |
+
}
|
76 |
+
.logoa {
|
77 |
+
padding-top: 15px;
|
78 |
+
padding-right: 15px;
|
79 |
+
padding-bottom: 15px;
|
80 |
+
padding-left: 15px;
|
81 |
+
}
|
82 |
+
.switch-but {
|
83 |
+
line-height: 18px;
|
84 |
+
color: #fff;
|
85 |
+
float: right;
|
86 |
+
}
|
87 |
+
h4 {
|
88 |
+
display: inline;
|
89 |
+
}
|
90 |
+
</style>
|
91 |
+
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" integrity="sha256-MfvZlkHCEqatNoGiOXveE8FIwMzZg4W85qfrfIFBfYc= sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
|
92 |
+
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
|
93 |
+
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
|
94 |
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha256-Sk3nkD6mLTMOF0EOpNtsIry+s1CsaqQC1rVLTAy+0yc= sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>
|
95 |
+
<script type="text/javascript">jQuery.noConflict();</script>
|
96 |
+
<script>
|
97 |
+
jQuery(document).ready(function () {
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
+
|
102 |
+
|
103 |
+
jQuery("#linkup").click( function()
|
104 |
+
{
|
105 |
+
jQuery("#signin").show();
|
106 |
+
jQuery("#signup").hide();
|
107 |
+
|
108 |
+
}
|
109 |
+
);
|
110 |
+
|
111 |
+
jQuery("#linkin").click( function()
|
112 |
+
{
|
113 |
+
jQuery("#signin").hide();
|
114 |
+
jQuery("#signup").show();
|
115 |
+
|
116 |
+
}
|
117 |
+
);
|
118 |
+
|
119 |
+
});
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
+
</script>
|
124 |
+
|
125 |
+
<div id="signup" class="jumbotron col-md-8 ">
|
126 |
+
<h3>
|
127 |
+
You are just a few seconds away from engagement boost ...
|
128 |
+
</h3>
|
129 |
+
<div class ="logoa">
|
130 |
+
<img calss="logo" src="http://bontact.com/wp-content/uploads/logo.png" alt="bontact">
|
131 |
+
</div>
|
132 |
+
|
133 |
+
|
134 |
+
<header >
|
135 |
+
<h4>Create New Account</h4><span class="switch-but"><b>Already registered?</b> <a id="linkup" href="#" class="signin">Sign in</a></span>
|
136 |
+
</header>
|
137 |
+
<div style="display:inline; height:20px ">
|
138 |
+
|
139 |
+
</div>
|
140 |
+
<div id="err" style="display: none" class="alert alert-danger" role="alert"></div>
|
141 |
+
<form class="" action="'.$this->curPageURL().'" method="get" id="contact-form">
|
142 |
+
<input type="hidden" name="bont-action" value="loginup" />
|
143 |
+
<div class="form-group">
|
144 |
+
<div class="controls">
|
145 |
+
<input type="text" name="username" id="emaila" placeholder="Enter your email" class="form-control">
|
146 |
+
</div>
|
147 |
+
</div>
|
148 |
+
<div class="form-group">
|
149 |
+
<input type="password" name="password" id="passa" placeholder="Type a password" class="form-control">
|
150 |
+
</div>
|
151 |
+
<div class="form-group">
|
152 |
+
<input type="text" name="tel" id="tela" placeholder="Enter your phone number" class="form-control">
|
153 |
+
</div>
|
154 |
+
<button type="submit" id="send" class="btn btn-success">SIGN UP</button>
|
155 |
+
</form>
|
156 |
+
</div>
|
157 |
+
|
158 |
+
<div id="signin" style="display: none" class="jumbotron col-md-8 ">
|
159 |
+
<div class ="logoa">
|
160 |
+
<img calss="logo" src="http://eldad.bontact.com/wp-content/uploads/logo.png" alt="bontact">
|
161 |
+
</div>
|
162 |
+
<header >
|
163 |
+
<h4>Sign In</h4><span class="switch-but"><b>Need an Account?</b> <a id = "linkin" href="#" class="signin">Register</a></span>
|
164 |
+
</header>
|
165 |
+
<div style="display:inline; height:20px ">
|
166 |
+
|
167 |
+
</div>
|
168 |
+
<div id="err" style="display: none" class="alert alert-danger" role="alert"></div>
|
169 |
+
|
170 |
+
<form class="" action="'.$this->curPageURL().'" method="get" id="contact-form">
|
171 |
+
<input type="hidden" name="bont-action" value="login" />
|
172 |
+
<div class="form-group">
|
173 |
+
<div class="controls">
|
174 |
+
<input type="text" name="username" id="email" placeholder="Enter your email" class="form-control">
|
175 |
+
</div>
|
176 |
+
</div>
|
177 |
+
<div class="form-group">
|
178 |
+
<input type="password" name="password" id="pass" placeholder="Type a password" class="form-control">
|
179 |
+
</div>
|
180 |
+
<button type="submit" id="sendin" class="btn btn-success">SIGN IN</button>
|
181 |
+
</form>
|
182 |
+
</div>
|
183 |
+
|
184 |
+
|
185 |
+
|
186 |
+
</div>';
|
187 |
+
}
|
188 |
+
|
189 |
+
}
|
190 |
+
return $html;
|
191 |
+
}
|
192 |
+
|
193 |
+
private function curPageURL() {
|
194 |
+
$pageURL = 'http';
|
195 |
+
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
|
196 |
+
$pageURL .= "://";
|
197 |
+
if ($_SERVER["SERVER_PORT"] != "80") {
|
198 |
+
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
199 |
+
} else {
|
200 |
+
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
|
201 |
+
}
|
202 |
+
|
203 |
+
$pageURL = preg_replace("/\?.*$/", "", $pageURL);
|
204 |
+
|
205 |
+
return $pageURL;
|
206 |
+
}
|
207 |
+
|
208 |
+
public function saveWidgetId($wigetid)
|
209 |
+
{
|
210 |
+
|
211 |
+
|
212 |
+
$db = Mage::getSingleton('core/resource')->getConnection('core_read');
|
213 |
+
$tableName = Mage::getSingleton("core/resource")->getTableName("bontact");
|
214 |
+
$result = $db->query("SELECT * FROM ".$tableName." LIMIT 1");
|
215 |
+
if($result) {
|
216 |
+
|
217 |
+
if($row = $result->fetch())
|
218 |
+
{
|
219 |
+
$conn = Mage::getSingleton('core/resource')->getConnection('core_write');
|
220 |
+
$conn->query("update ".$tableName." set widgetid='".addslashes($wigetid)."'");
|
221 |
+
}else
|
222 |
+
{
|
223 |
+
|
224 |
+
$conn = Mage::getSingleton('core/resource')->getConnection('core_write');
|
225 |
+
$conn->query("insert into ".$tableName." values('','".addslashes($wigetid)."')");
|
226 |
+
|
227 |
+
}
|
228 |
+
}
|
229 |
+
|
230 |
+
}
|
231 |
+
}
|
app/code/local/Bontact/Widget/Block/Status.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Bontact_Widget_Block_Status extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
|
7 |
+
protected function _toHtml()
|
8 |
+
{
|
9 |
+
|
10 |
+
$model = Mage::getModel('bontact/bontact');
|
11 |
+
|
12 |
+
$this->setWidgetId($model->getWidgetId());
|
13 |
+
return parent::_toHtml();
|
14 |
+
}
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
}
|
app/code/local/Bontact/Widget/Model/Bontact.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Bontact_Widget_Model_Bontact extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $_widgetid = '';
|
7 |
+
|
8 |
+
public function _construct()
|
9 |
+
{
|
10 |
+
parent::_construct();
|
11 |
+
$this->_init('bontact/bontact');
|
12 |
+
}
|
13 |
+
|
14 |
+
public function getWidgetId()
|
15 |
+
{
|
16 |
+
|
17 |
+
$db = Mage::getSingleton('core/resource')->getConnection('core_read');
|
18 |
+
$tableName = Mage::getSingleton("core/resource")->getTableName("bontact");
|
19 |
+
$result = $db->query("SELECT * FROM ". $tableName ." LIMIT 1");
|
20 |
+
if($result) {
|
21 |
+
|
22 |
+
if($row = $result->fetch())
|
23 |
+
{
|
24 |
+
$this->_widgetid =$row["widgetid"];
|
25 |
+
return $row["widgetid"];
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
}
|
app/code/local/Bontact/Widget/Model/Mysql4/Bontact.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Bontact_Widget_Model_Mysql4_Bontact extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('bontact/bontact', 'clickdesk_id');
|
8 |
+
}
|
9 |
+
}
|
app/code/local/Bontact/Widget/Model/Mysql4/Bontact/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Bontact_Widget_Model_Mysql4_Bontact_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
//parent::__construct();
|
8 |
+
$this->_init('bontact/bontact');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Bontact/Widget/controllers/AdminController.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Bontact_Widget_AdminController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
public function accountconfigAction()
|
5 |
+
{
|
6 |
+
$this->loadLayout()
|
7 |
+
->_addContent($this->getLayout()->createBlock('bontact/accountconfig'))
|
8 |
+
->renderLayout();
|
9 |
+
}
|
10 |
+
|
11 |
+
public function dashboardAction()
|
12 |
+
{
|
13 |
+
$this->_redirectUrl('https://dashboard.bontact.com');
|
14 |
+
}
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
public function indexAction()
|
19 |
+
{
|
20 |
+
accountconfigAction();
|
21 |
+
}
|
22 |
+
}
|
app/code/local/Bontact/Widget/controllers/IndexController.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Zopim_Livechat_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
/* $this->loadLayout();
|
8 |
+
$this->getLayout()
|
9 |
+
->getBlock('content')->append(
|
10 |
+
$this->getLayout()->createBlock('livechat/index')
|
11 |
+
);
|
12 |
+
$this->renderLayout(); */
|
13 |
+
}
|
14 |
+
}
|
app/code/local/Bontact/Widget/controllers/bontact.phtml
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
echo "aaaa";
|
4 |
+
|
5 |
+
|
6 |
+
/*
|
7 |
+
This shows how to load specific fields from a record in the database.
|
8 |
+
1) Note the load(15), this corresponds to saying "select * from table where table_id = 15"
|
9 |
+
2) You can then just use the get(fieldname) to pull specific data from the table.
|
10 |
+
3) If you have a field named news_id, then it becomes getNewsId, etc.
|
11 |
+
*/
|
12 |
+
/*
|
13 |
+
$news = Mage::getModel('livechat/livechat')->load(15);
|
14 |
+
echo $news->getNewsId();
|
15 |
+
echo $news->getTitle();
|
16 |
+
echo $news->getContent();
|
17 |
+
echo $news->getStatus();
|
18 |
+
*/
|
19 |
+
|
20 |
+
/*
|
21 |
+
This shows an alternate way of loading datas from a record using the database the "Magento Way" (using blocks and controller).
|
22 |
+
Uncomment blocks in /app/code/local/Namespace/Module/controllers/IndexController.php if you want to use it.
|
23 |
+
|
24 |
+
*/
|
25 |
+
/*
|
26 |
+
$object = $this->getLivechat();
|
27 |
+
echo 'id: '.$object['test_id'].'<br/>';
|
28 |
+
echo 'title: '.$object['title'].'<br/>';
|
29 |
+
echo 'content: '.$object['content'].'<br/>';
|
30 |
+
echo 'status: '.$object['status'].'<br/>';
|
31 |
+
*/
|
32 |
+
|
33 |
+
|
34 |
+
/*
|
35 |
+
This shows how to load multiple rows in a collection and save a change to them.
|
36 |
+
1) The setPageSize function will load only 5 records per page and you can set the current Page with the setCurPage function.
|
37 |
+
2) The $collection->walk('save') allows you to save everything in the collection after all changes have been made.
|
38 |
+
*/
|
39 |
+
/*
|
40 |
+
$i = 0;
|
41 |
+
|
42 |
+
$collection = Mage::getModel('livechat/livechat')->getCollection();
|
43 |
+
$collection->setPageSize(5);
|
44 |
+
$collection->setCurPage(2);
|
45 |
+
$size = $collection->getSize();
|
46 |
+
$cnt = count($collection);
|
47 |
+
foreach ($collection as $item) {
|
48 |
+
$i = $i+1;
|
49 |
+
$item->setTitle($i);
|
50 |
+
echo $item->getTitle();
|
51 |
+
}
|
52 |
+
|
53 |
+
$collection->walk('save');
|
54 |
+
*/
|
55 |
+
|
56 |
+
/*
|
57 |
+
This shows how to load a single record and save a change.
|
58 |
+
1) Note the setTitle, this corresponds to the table field name, title, and then you pass it the text to change.
|
59 |
+
2) Call the save() function only on a single record.
|
60 |
+
*/
|
61 |
+
/*
|
62 |
+
$object = Mage::getModel('livechat/livechat')->load(1);
|
63 |
+
$object->setTitle('This is a changed title');
|
64 |
+
$object->save();
|
65 |
+
*/
|
66 |
+
|
67 |
+
?>
|
app/code/local/Bontact/Widget/etc/config.xml
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Bontact_Widget>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Bontact_Widget>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<bontact>
|
11 |
+
<class>Bontact_Widget_Block</class>
|
12 |
+
</bontact>
|
13 |
+
</blocks>
|
14 |
+
<models>
|
15 |
+
<bontact>
|
16 |
+
<class>Bontact_Widget_Model</class>
|
17 |
+
<resourceModel>bontact_mysql4</resourceModel>
|
18 |
+
</bontact>
|
19 |
+
<bontact_mysql4>
|
20 |
+
<class>Bontact_Widget_Model_Mysql4</class>
|
21 |
+
<entities>
|
22 |
+
<bontact>
|
23 |
+
<table>bontact</table>
|
24 |
+
</bontact>
|
25 |
+
</entities>
|
26 |
+
</bontact_mysql4>
|
27 |
+
</models>
|
28 |
+
<resources>
|
29 |
+
<bontact_setup>
|
30 |
+
<setup>
|
31 |
+
<module>Bontact_Widget</module>
|
32 |
+
</setup>
|
33 |
+
<connection>
|
34 |
+
<use>core_setup</use>
|
35 |
+
</connection>
|
36 |
+
</bontact_setup>
|
37 |
+
<bontact_write>
|
38 |
+
<connection>
|
39 |
+
<use>core_write</use>
|
40 |
+
</connection>
|
41 |
+
</bontact_write>
|
42 |
+
<bontact_read>
|
43 |
+
<connection>
|
44 |
+
<use>core_read</use>
|
45 |
+
</connection>
|
46 |
+
</bontact_read>
|
47 |
+
</resources>
|
48 |
+
</global>
|
49 |
+
<frontend>
|
50 |
+
<routers>
|
51 |
+
<Bontact_Widget>
|
52 |
+
<use>standard</use>
|
53 |
+
<args>
|
54 |
+
<module>Bontact_Widget</module>
|
55 |
+
<frontName>bontact</frontName>
|
56 |
+
</args>
|
57 |
+
</Bontact_Widget>
|
58 |
+
</routers>
|
59 |
+
<layout>
|
60 |
+
<updates>
|
61 |
+
<Bontact_Widget>
|
62 |
+
<file>bontact.xml</file>
|
63 |
+
</Bontact_Widget>
|
64 |
+
</updates>
|
65 |
+
</layout>
|
66 |
+
</frontend>
|
67 |
+
<admin>
|
68 |
+
<routers>
|
69 |
+
<Bontact_Widget>
|
70 |
+
<use>admin</use>
|
71 |
+
<args>
|
72 |
+
<module>Bontact_Widget</module>
|
73 |
+
<frontName>bontact</frontName>
|
74 |
+
</args>
|
75 |
+
</Bontact_Widget>
|
76 |
+
</routers>
|
77 |
+
</admin>
|
78 |
+
<adminhtml>
|
79 |
+
<menu>
|
80 |
+
<bontact translate="title" module="Widget">
|
81 |
+
<title>Bontact Multi Channel</title>
|
82 |
+
<sort_order>1000</sort_order>
|
83 |
+
<children>
|
84 |
+
<accountconfig translate="title" module="Widget">
|
85 |
+
<title>Account Setup</title>
|
86 |
+
<action>bontact/admin/accountconfig</action>
|
87 |
+
<sort_order>0</sort_order>
|
88 |
+
</accountconfig>
|
89 |
+
<dashboard translate="title" module="Widget">
|
90 |
+
<title>Dashboard</title>
|
91 |
+
<action>bontact/admin/dashboard</action>
|
92 |
+
<sort_order>40</sort_order>
|
93 |
+
</dashboard>
|
94 |
+
</children>
|
95 |
+
</bontact>
|
96 |
+
</menu>
|
97 |
+
<acl>
|
98 |
+
<resources>
|
99 |
+
<admin>
|
100 |
+
<children>
|
101 |
+
<bontact translate="title" module="Widget">
|
102 |
+
<title>Bontact Multi Channel</title>
|
103 |
+
<sort_order>1000</sort_order>
|
104 |
+
<children>
|
105 |
+
<accountconfig translate="title" module="Widget">
|
106 |
+
<title>Account Setup</title>
|
107 |
+
<action>bontact/admin/accountconfig</action>
|
108 |
+
<sort_order>0</sort_order>
|
109 |
+
</accountconfig>
|
110 |
+
<dashboard translate="title" module="Widget">
|
111 |
+
<title>Dashboard</title>
|
112 |
+
<action>bontact/admin/dashboard</action>
|
113 |
+
<sort_order>40</sort_order>
|
114 |
+
</dashboard>
|
115 |
+
</children>
|
116 |
+
</bontact>
|
117 |
+
</children>
|
118 |
+
</admin>
|
119 |
+
</resources>
|
120 |
+
</acl>
|
121 |
+
</adminhtml>
|
122 |
+
</config>
|
app/code/local/Bontact/Widget/sql/bontact_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('bontact')};
|
10 |
+
CREATE TABLE {$this->getTable('bontact')} (
|
11 |
+
`clickdesk_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`widgetid` varchar(255) NOT NULL default '',
|
13 |
+
PRIMARY KEY (`clickdesk_id`)
|
14 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
15 |
+
|
16 |
+
");
|
17 |
+
|
18 |
+
$installer->endSetup();
|
app/design/frontend/base/default/layout/bontact.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="footer">
|
5 |
+
<block type="bontact/status" name="bontact.status" template="bontact/status.phtml"/>
|
6 |
+
</reference>
|
7 |
+
|
8 |
+
</default>
|
9 |
+
|
10 |
+
</layout>
|
app/design/frontend/base/default/template/bontact/status.phtml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div >
|
2 |
+
|
3 |
+
<?php if($this->getWidgetId() != "")
|
4 |
+
{
|
5 |
+
?>
|
6 |
+
<script type='text/javascript'>
|
7 |
+
var bontactCustomer = '<?php echo $this->getWidgetId(); ?>';
|
8 |
+
var locationRoot = (('https:' == document.location.protocol) ? 'https://' : 'http://');
|
9 |
+
var newElem = document.createElement('script');
|
10 |
+
newElem.setAttribute('src', locationRoot+'dashboard.bontact.com/widget/bontact.script.js');
|
11 |
+
newElem.setAttribute('type', 'text/javascript');
|
12 |
+
document.getElementsByTagName('head')[0].appendChild(newElem);
|
13 |
+
</script>
|
14 |
+
<?php
|
15 |
+
}
|
16 |
+
?>
|
17 |
+
|
18 |
+
</div>
|
app/etc/modules/Bontact_Widget.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Bontact_Widget>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Bontact_Widget>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Bontact_Widget_Multichannel</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Engage visitors with a multi-channel communication widget that includes live chat, callback, text messages, and email. Increase their satisfaction and your conversion rates.</summary>
|
10 |
+
<description>Bontact is a smart, multi-channel communication tool that converts your site visitors into paying customers. Our clean and customizable widget hovers neatly over your site and provides visitors with live chat, callback, text, and email options. With our online dashboard, you can manage all of your interactions, as well as monitor where visitors are and how long they’ve been surfing. If you feel that they need assistance at any point, step in and initiate a live chat.
|
11 |
+
|
12 |
+
With Bontact, you’re offering your visitors flexible and accessible support, while transforming them into happy customers.
|
13 |
+
**Widget Options on Your Site**
|
14 |
+
|
15 |
+
* Callback – After visitors enter their phone number (landline or mobile, from anywhere in the world), they’re automatically called back within seconds and connected with you. This call is free for visitors.
|
16 |
+
* Live Chat – Visitors can initiate a chat with with you in real time.
|
17 |
+
* Text Message - Visitors can send a free international text message to your phone. You can reply to them directly, without international fees.
|
18 |
+
* Email – Visitors fill out a form that’s sent directly to your inbox.
|
19 |
+
|
20 |
+
**Live Chat Options in Your Dashboard**
|
21 |
+
|
22 |
+
* Invite visitors to a live chat session
|
23 |
+
* Easily manage all ongoing chats
|
24 |
+
* Reply to visitor-initiated chats
|
25 |
+
* Transfer chats between representatives
|
26 |
+
* Incorporate templates
|
27 |
+
* Print transcripts</description>
|
28 |
+
<notes></notes>
|
29 |
+
<authors><author><name>Tzvi</name><user>Tzvi</user><email>tzvi@bontact.com</email></author><author><name>Support</name><user>Support</user><email>tzvi@bontact.com</email></author></authors>
|
30 |
+
<date>2015-11-20</date>
|
31 |
+
<time>18:10:00</time>
|
32 |
+
<contents><target name="magelocal">
|
33 |
+
<dir name="Bontact">
|
34 |
+
<dir name="Widget">
|
35 |
+
<dir name="Block"><file name="Status.php" hash="869902090c3d30269cb625aaa214f60d"/><file name="Accountconfig.php" hash="d51bb60d8831e381459cc36998a2e327"/></dir>
|
36 |
+
<dir name="Model"><file name="Bontact.php" hash="ccf6bbcd9ea94896ca5a7d6137075c52"/><dir name="Mysql4"><dir name="Bontact"><file name="Collection.php" hash="3ee88b6ddcb22dd5dc2297e0abe0cae6"/></dir><file name="bontact.php" hash="52622d7e492861ab7fdbce1d6c2a78f8"/></dir></dir>
|
37 |
+
<dir name="controllers"><file name="AdminController.php" hash="cef6dac96a6c55eadb6d7d64f6308c82"/><file name="IndexController.php" hash="a518f58e5515481c4eedad459f645818"/><file name="bontact.phtml" hash="5be7ae80d82a13a50d4bb267166ce4cd"/></dir>
|
38 |
+
<dir name="etc"><file name="config.xml" hash="3b11e7336f469f7a34c110c4865cc890"/></dir>
|
39 |
+
<dir name="sql"><dir name="bontact_setup"><file name="mysql4-install-0.1.0.php" hash="1ae4322bb7e5fd13f04bb6669e975153"/></dir></dir>
|
40 |
+
</dir></dir></target>
|
41 |
+
<target name="mageetc"><dir name="modules"><file name="Bontact_Widget.xml" hash="441bbbace9e216eed5c126bc23bfbb69"/></dir></target>
|
42 |
+
<target name="magedesign"><dir name="frontend">
|
43 |
+
<dir name="base"><dir name="default">
|
44 |
+
<dir name="layout"><file name="bontact.xml" hash="837425ee30eacbbca4fb2506805cb5d0"/></dir>
|
45 |
+
<dir name="template"><dir name="bontact"><file name="status.phtml" hash="d0fa95dda0acc1744eed5b20f3bd27dd"/></dir></dir></dir></dir></dir></target></contents>
|
46 |
+
<compatible/>
|
47 |
+
<dependencies><required><php><min>4.0.0</min><max>6.0.0</max></php></required></dependencies>
|
48 |
+
</package>
|