Version Notes
Initial Release
Download this release
Release Info
Developer | Eric Witchin |
Extension | LiveHelpNow_Help_Desk_Chat_Button |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
app/code/community/LHN/Chat/Block/Button.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class LHN_Chat_Block_Button extends Mage_Core_Block_Abstract implements Mage_Widget_Block_Interface{
|
3 |
+
protected function _toHtml(){
|
4 |
+
$lhn_account = $this->getData('account_number');
|
5 |
+
$lhn_button = $this->getData('button_number');
|
6 |
+
|
7 |
+
$lhn_account = str_replace("lhn","",strtolower($lhn_account));
|
8 |
+
|
9 |
+
if(substr($lhn_account, -2)=="-1"){
|
10 |
+
$subText = "";
|
11 |
+
}else{
|
12 |
+
$subText = '<div style="font-size:10px;"><a title="Help desk software" href="http://www.LiveHelpNow.net/" style="font-size:10px;" target="_blank">Help desk software</a></div>';
|
13 |
+
}
|
14 |
+
$lhn_account = str_replace("-1","",$lhn_account);
|
15 |
+
|
16 |
+
$lhnEmail = "";
|
17 |
+
$lhnCustomer = "";
|
18 |
+
$lhnCart = "";
|
19 |
+
if(Mage::getSingleton('customer/session')->isLoggedIn()){
|
20 |
+
$customer = Mage::getSingleton('customer/session');
|
21 |
+
$customerData = Mage::getModel('customer/customer')->load($customer->getId())->getData();
|
22 |
+
|
23 |
+
$lhnEmail = urlencode($customerData['email']);
|
24 |
+
$lhnCustomer = urlencode($customerData['firstname']." ".$customerData['lastname']);
|
25 |
+
|
26 |
+
$cart = Mage::helper('checkout')->getQuote()->getData();
|
27 |
+
if($cart['items_qty'] < 1){$cart['items_qty'] = 0;}
|
28 |
+
if($cart['subtotal'] < 1){$cart['subtotal'] = 0.00;}
|
29 |
+
$lhnCart = urlencode("Quantity: ".intval($cart['items_qty'])." total items<br />");
|
30 |
+
$lhnCart .= urlencode("Subtotal: $".$cart['subtotal']);
|
31 |
+
}
|
32 |
+
|
33 |
+
$content = PHP_EOL.'<!--start http://www.livehelpnow.net -->'.PHP_EOL;
|
34 |
+
$content .= '<!--This DIV object will show the live chat button, have it placed in the location on your website where you would like the live chat button to show-->'.PHP_EOL;
|
35 |
+
$content .= '<div id="lhnContainer" style="text-align:center;">'.PHP_EOL;
|
36 |
+
$content .= '<div id="lhnChatButton"></div>'.PHP_EOL;
|
37 |
+
$content .= $subText.PHP_EOL;
|
38 |
+
$content .= '</div>'.PHP_EOL;
|
39 |
+
$content .= '<!--You may install the following code in an external JavaScript file if you like-->'.PHP_EOL;
|
40 |
+
$content .= '<script type="text/javascript">'.PHP_EOL;
|
41 |
+
$content .= 'if(typeof lhnChatButton == "undefined"){'.PHP_EOL;
|
42 |
+
$content .= 'var lhnChatButton = 1;'.PHP_EOL;
|
43 |
+
$content .= 'var lhnAccountN = '. $lhn_account .';'.PHP_EOL;
|
44 |
+
$content .= 'var lhnButtonN = '. $lhn_button .';'.PHP_EOL;
|
45 |
+
$content .= 'var lhnVersion = 5.3; '.PHP_EOL;
|
46 |
+
$content .= 'var lhnJsHost = (("https:" == document.location.protocol) ? "https://" : "http://");'.PHP_EOL;
|
47 |
+
$content .= 'var lhnInviteEnabled = 0;'.PHP_EOL;
|
48 |
+
$content .= 'var lhnInviteChime = 0;'.PHP_EOL;
|
49 |
+
$content .= 'var lhnWindowN = 0;'.PHP_EOL;
|
50 |
+
$content .= 'var lhnDepartmentN = 0;'.PHP_EOL;
|
51 |
+
$content .= 'var lhnCustomInvitation = "";'.PHP_EOL;
|
52 |
+
$content .= 'var lhnCustom1 = "'.$lhnCustomer.'";'.PHP_EOL;
|
53 |
+
$content .= 'var lhnCustom2 = "'.$lhnEmail.'";'.PHP_EOL;
|
54 |
+
$content .= 'var lhnCustom3 = "'.$lhnCart.'";'.PHP_EOL;
|
55 |
+
$content .= 'var lhnTrackingEnabled = "t";'.PHP_EOL;
|
56 |
+
$content .= 'var lhnScriptSrc = lhnJsHost + "www.livehelpnow.net/lhn/scripts/livehelpnow.aspx?lhnid=" + lhnAccountN + "&iv=" + lhnInviteEnabled + "&d=" + lhnDepartmentN + "&ver=" + lhnVersion + "&rnd=" + Math.random();'.PHP_EOL;
|
57 |
+
$content .= 'lhnLoadEvent = addLHNButton(lhnScriptSrc,"append");'.PHP_EOL;
|
58 |
+
$content .= '}else{'.PHP_EOL;
|
59 |
+
$content .= 'lhnLoadEvent = addLHNButton('.$lhn_button.',"insert");'.PHP_EOL;
|
60 |
+
$content .= '}'.PHP_EOL;
|
61 |
+
$content .= 'if (window.addEventListener) {'.PHP_EOL;
|
62 |
+
$content .= 'window.addEventListener("load", function () {'.PHP_EOL;
|
63 |
+
$content .= 'lhnLoadEvent;'.PHP_EOL;
|
64 |
+
$content .= '});'.PHP_EOL;
|
65 |
+
$content .= '}else{'.PHP_EOL;
|
66 |
+
$content .= 'window.attachEvent("onload", function () {'.PHP_EOL;
|
67 |
+
$content .= 'lhnLoadEvent;'.PHP_EOL;
|
68 |
+
$content .= '});'.PHP_EOL;
|
69 |
+
$content .= '}'.PHP_EOL;
|
70 |
+
$content .= 'function addLHNButton(lhnbutton, lhntype){'.PHP_EOL;
|
71 |
+
$content .= 'element = document.getElementById("lhnContainer");'.PHP_EOL;
|
72 |
+
$content .= 'element.id = "lhnContainerDone";'.PHP_EOL;
|
73 |
+
$content .= 'if(lhntype == "insert"){'.PHP_EOL;
|
74 |
+
$content .= 'var lhnScript = document.createElement("a");lhnScript.href = "#";lhnScript.onclick = function(){OpenLHNChat();return false;};'.PHP_EOL;
|
75 |
+
$content .= 'lhnScript.innerHTML = "<img id=\"lhnchatimg\" alt=\"Live Help\" border=\"0\" nocache src=\""+lhnJsHost+"www.livehelpnow.net/lhn/functions/imageserver.ashx?lhnid="+lhnAccountN+"&navname=&java=&referrer=&pagetitle=&pageurl=&t=f&zimg="+lhnbutton+"&d=0&rndstr=999\" />";'.PHP_EOL;
|
76 |
+
$content .= 'element.insertBefore(lhnScript,element.firstChild);'.PHP_EOL;
|
77 |
+
$content .= '}else{'.PHP_EOL;
|
78 |
+
$content .= 'console.log(lhnbutton);var lhnScript = document.createElement("script");lhnScript.type = "text/javascript";lhnScript.src = lhnbutton;'.PHP_EOL;
|
79 |
+
$content .= 'element.appendChild(lhnScript);'.PHP_EOL;
|
80 |
+
$content .= '}'.PHP_EOL;
|
81 |
+
$content .= '}'.PHP_EOL;
|
82 |
+
$content .= '</script>'.PHP_EOL;
|
83 |
+
$content .= '<!--end http://www.livehelpnow.net -->'.PHP_EOL;
|
84 |
+
return $content;
|
85 |
+
}
|
86 |
+
}
|
app/code/community/LHN/Chat/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class LHN_Chat_Helper_Data extends Mage_Core_Helper_Adbstract{
|
3 |
+
|
4 |
+
}
|
app/code/community/LHN/Chat/etc/config.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<LHN_Chat>
|
5 |
+
<version>1.0</version>
|
6 |
+
</LHN_Chat>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<helpers>
|
10 |
+
<chat>
|
11 |
+
<class>LHN_Chat_Helper</class>
|
12 |
+
</chat>
|
13 |
+
</helpers>
|
14 |
+
<blocks>
|
15 |
+
<chat>
|
16 |
+
<class>LHN_Chat_Block</class>
|
17 |
+
</chat>
|
18 |
+
</blocks>
|
19 |
+
</global>
|
20 |
+
</config>
|
app/code/community/LHN/Chat/etc/widget.xml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<widgets>
|
3 |
+
<chat_button type="chat/button">
|
4 |
+
<name>LiveHelpNow Help Desk -- Chat Button</name>
|
5 |
+
<description type="desc">Adds a LiveHelpNow Chat button to your website</description>
|
6 |
+
<parameters>
|
7 |
+
<account_number translate="label">
|
8 |
+
<required>1</required>
|
9 |
+
<visible>1</visible>
|
10 |
+
<label>LiveHelpNow Account Number</label>
|
11 |
+
<type>text</type>
|
12 |
+
</account_number>
|
13 |
+
<button_number translate="label">
|
14 |
+
<required>1</required>
|
15 |
+
<visible>1</visible>
|
16 |
+
<label>LiveHelpNow Button Number</label>
|
17 |
+
<type>text</type>
|
18 |
+
</button_number>
|
19 |
+
</parameters>
|
20 |
+
</chat_button>
|
21 |
+
</widgets>
|
app/etc/modules/LHN_Chat.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<LHN_Chat>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Cms />
|
9 |
+
</depends>
|
10 |
+
</LHN_Chat>
|
11 |
+
</modules>
|
12 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>LiveHelpNow_Help_Desk_Chat_Button</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GNU General Public License (GPL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Chat with customers on your website using the top rated LiveHelpNow Chat System.</summary>
|
10 |
+
<description>LiveHelpNow is a responsive, reliable, and extremely affordable Help Desk Software for your website. The live chat button plugin adds click-to-chat functionality to your website, allowing you to interact directly with website visitors the same way you would in a traditional retail store. You wouldn't ignore customers in your store, so don't ignore the ones visiting your site every day!
|
11 |
+

|
12 |
+
Chat with customers using any computer or mobile device and monitor website visitors in real-time using our Top Rated Chat System. Invite visitors to chat automatically or proactively, help them with product selection, and increase sales! When you're unavailable the chat button plugin switches to an 'offline mode' that allows visitors to leave you messages.
|
13 |
+

|
14 |
+
This plugin is exclusively for the LiveHelpNow Chat System & also integrates seamlessly with:
|
15 |
+

|
16 |
+
- LiveHelpNow Ticket System
|
17 |
+
- LiveHelpNow Callback Request System</description>
|
18 |
+
<notes>Initial Release</notes>
|
19 |
+
<authors><author><name>Eric Witchin</name><user>livehelpnow</user><email>plugins@livehelpnpw.com</email></author></authors>
|
20 |
+
<date>2013-04-04</date>
|
21 |
+
<time>15:57:10</time>
|
22 |
+
<contents><target name="magecommunity"><dir name="LHN"><dir name="Chat"><dir name="Block"><file name="Button.php" hash="d618e5c8ab98f59a43b0c658113da005"/></dir><dir name="Helper"><file name="Data.php" hash="37de04c73ab2798399cc75e87c5217fd"/></dir><dir name="etc"><file name="config.xml" hash="6829a398d8d80b95f44b5da38c4c5ead"/><file name="widget.xml" hash="0cf746414a534abf09a3588d3c5330f8"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="LHN_Chat.xml" hash="a8dafd55068822ec469356e6f8ebb55d"/></dir></target></contents>
|
23 |
+
<compatible/>
|
24 |
+
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
25 |
+
</package>
|