CSupport_LiveChatPlugin - Version 1.0.2

Version Notes

Adding several new features, and using async script.

Download this release

Release Info

Developer cSupport Team
Extension CSupport_LiveChatPlugin
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/local/CSupport/LiveChatPlugin/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <CSupport_LiveChatPlugin>
5
- <version>1.0.1</version>
6
  </CSupport_LiveChatPlugin>
7
  </modules>
8
  <global>
@@ -60,11 +60,13 @@
60
  <default>
61
  <livechatplugin>
62
  <settings>
63
- <auto_fill>Yes</auto_fill>
64
- <type>chat-float-inline</type>
65
  <website></website>
 
 
 
66
  <position>b-r</position>
67
  <margin></margin>
 
68
  </settings>
69
  </livechatplugin>
70
  </default>
2
  <config>
3
  <modules>
4
  <CSupport_LiveChatPlugin>
5
+ <version>1.0.2</version>
6
  </CSupport_LiveChatPlugin>
7
  </modules>
8
  <global>
60
  <default>
61
  <livechatplugin>
62
  <settings>
 
 
63
  <website></website>
64
+ <type>chat-float-inline</type>
65
+ <auto_fill>Yes</auto_fill>
66
+ <autostart>No</autostart>
67
  <position>b-r</position>
68
  <margin></margin>
69
+ <bgcolor></bgcolor>
70
  </settings>
71
  </livechatplugin>
72
  </default>
app/code/local/CSupport/LiveChatPlugin/etc/system.xml CHANGED
@@ -16,25 +16,25 @@
16
  <show_in_website>1</show_in_website>
17
  <show_in_store>1</show_in_store>
18
  <fields>
19
- <type translate="label comment">
20
- <label>Type</label>
21
- <frontend_type>select</frontend_type>
22
  <sort_order>1</sort_order>
23
- <source_model>livechatplugin/types</source_model>
24
  <show_in_default>1</show_in_default>
25
  <show_in_website>1</show_in_website>
26
  <show_in_store>1</show_in_store>
27
- <comment>Select the type of inline button you wish</comment>
28
- </type>
29
- <website translate="label comment">
30
- <label>Your domain (without http//www.)</label>
31
- <frontend_type>text</frontend_type>
32
  <sort_order>2</sort_order>
 
33
  <show_in_default>1</show_in_default>
34
  <show_in_website>1</show_in_website>
35
  <show_in_store>1</show_in_store>
36
- <comment>Your domain is your unique address, ie. yourdomain.csupporthq.com. Please do not add http://</comment>
37
- </website>
38
  <auto_fill translate="label comment">
39
  <label>Auto-fill</label>
40
  <frontend_type>select</frontend_type>
@@ -43,10 +43,20 @@
43
  <show_in_default>1</show_in_default>
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>1</show_in_store>
46
- <comment>If possible, auto-fill with customer information</comment>
47
  </auto_fill>
 
 
 
 
 
 
 
 
 
 
48
  </fields>
49
- <comment>REMEMBER: You will need a cSupport live chat account. No account? Try a free 14-day trial at https://csupporthq.com/pricing/</comment>
50
  </settings>
51
  <layout translate="label comment" module="livechatplugin">
52
  <label>Layout</label>
@@ -64,16 +74,25 @@
64
  <show_in_default>1</show_in_default>
65
  <show_in_website>1</show_in_website>
66
  <show_in_store>1</show_in_store>
67
- <comment>The position of the live chat button</comment>
68
  </position>
69
- <margin translate="label comment">
70
- <label>Margin</label>
71
  <frontend_type>text</frontend_type>
72
  <sort_order>2</sort_order>
73
  <show_in_default>1</show_in_default>
74
  <show_in_website>1</show_in_website>
75
  <show_in_store>1</show_in_store>
76
- <comment>The margin in pixels from the edge. Only put in numbers!</comment>
 
 
 
 
 
 
 
 
 
77
  </margin>
78
  </fields>
79
  </layout>
16
  <show_in_website>1</show_in_website>
17
  <show_in_store>1</show_in_store>
18
  <fields>
19
+ <website translate="label comment">
20
+ <label>Your cSupport address: http://</label>
21
+ <frontend_type>text</frontend_type>
22
  <sort_order>1</sort_order>
 
23
  <show_in_default>1</show_in_default>
24
  <show_in_website>1</show_in_website>
25
  <show_in_store>1</show_in_store>
26
+ <comment>Your cSupport domain is your unique address that you registered at cSupport, ie. subdomain.csupporthq.com. Please do not add http://</comment>
27
+ </website>
28
+ <type translate="label comment">
29
+ <label>Type</label>
30
+ <frontend_type>select</frontend_type>
31
  <sort_order>2</sort_order>
32
+ <source_model>livechatplugin/types</source_model>
33
  <show_in_default>1</show_in_default>
34
  <show_in_website>1</show_in_website>
35
  <show_in_store>1</show_in_store>
36
+ <comment>How the button should work. Inline means that the chat will stay inside the window. Popup means that the chat will popup in a new window.</comment>
37
+ </type>
38
  <auto_fill translate="label comment">
39
  <label>Auto-fill</label>
40
  <frontend_type>select</frontend_type>
43
  <show_in_default>1</show_in_default>
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>1</show_in_store>
46
+ <comment>If possible, auto-fill with customer information from Magento.</comment>
47
  </auto_fill>
48
+ <autostart translate="label comment">
49
+ <label>Auto start</label>
50
+ <frontend_type>select</frontend_type>
51
+ <sort_order>4</sort_order>
52
+ <source_model>adminhtml/system_config_source_yesno</source_model>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ <comment>Can only be used if auto-fill has been set to Yes.</comment>
57
+ </autostart>
58
  </fields>
59
+ <comment>REMEMBER: You will need a cSupport live chat account. No account? Try a free 30-day trial at http://csupporthq.com/pricing/</comment>
60
  </settings>
61
  <layout translate="label comment" module="livechatplugin">
62
  <label>Layout</label>
74
  <show_in_default>1</show_in_default>
75
  <show_in_website>1</show_in_website>
76
  <show_in_store>1</show_in_store>
77
+ <comment>Select which corner the live chat button should be positioned in.</comment>
78
  </position>
79
+ <bgcolor translate="label comment">
80
+ <label>Color (HEX)</label>
81
  <frontend_type>text</frontend_type>
82
  <sort_order>2</sort_order>
83
  <show_in_default>1</show_in_default>
84
  <show_in_website>1</show_in_website>
85
  <show_in_store>1</show_in_store>
86
+ <comment>The base HEX color to use in the chat. Use a slash (/) with a second HEX color, to add a different color for offline mode.</comment>
87
+ </bgcolor>
88
+ <margin translate="label comment">
89
+ <label>Margin (in pixels)</label>
90
+ <frontend_type>text</frontend_type>
91
+ <sort_order>3</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ <comment>The margin in pixels from the edge of the window to the chat button. Only use a number (without px), range from -10 to 100.</comment>
96
  </margin>
97
  </fields>
98
  </layout>
app/design/frontend/default/default/layout/CSupport_LiveChatPlugin.xml CHANGED
@@ -1,5 +1,5 @@
1
  <?xml version="1.0"?>
2
- <layout version="1.0.1">
3
  <default>
4
  <reference name="before_body_end">
5
  <block type="core/template" name="csupport.livechatplugin" as="CSupportLiveChatPlugin" template="CSupport/LiveChatPlugin/livechat.phtml"/>
1
  <?xml version="1.0"?>
2
+ <layout version="1.0.2">
3
  <default>
4
  <reference name="before_body_end">
5
  <block type="core/template" name="csupport.livechatplugin" as="CSupportLiveChatPlugin" template="CSupport/LiveChatPlugin/livechat.phtml"/>
app/design/frontend/default/default/template/CSupport/LiveChatPlugin/livechat.phtml CHANGED
@@ -1,33 +1,59 @@
1
  <?php
2
- $website = Mage::getStoreConfig('livechatplugin/settings/website',Mage::app()->getStore());
3
- if($website!=""){
4
- $tag = "";
 
 
 
 
 
5
 
6
  $type = Mage::getStoreConfig('livechatplugin/settings/type');
7
- $tag .= "<!-- cSupport Live Chat Plugin --><script type='text/javascript'>(function() { var src = ('https:' == document.location.protocol ? 'https://' : 'http://') + '".$website."/external/".$type.".js';document.write(\"<script src='\"+src+\"' type='text/javascript'><\/script>\");})();";
8
 
9
- $auto_fill = Mage::getStoreConfig('livechatplugin/settings/auto_fill');
10
- if($auto_fill=='1'){
11
- if(Mage::getSingleton('customer/session')->isLoggedIn()){
 
 
12
  $customer = Mage::getSingleton('customer/session');
13
- $name = htmlspecialchars($customer->getCustomer()->getFirstname()." ".$customer->getCustomer()->getLastname());
14
  $email = $customer->getCustomer()->getEmail();
15
- $tag .= "var cs_name=\"".$name."\";var cs_email=\"".$email."\";";
 
 
 
 
 
 
16
  }
17
  }
18
 
19
- $position = Mage::getStoreConfig('livechatplugin/layout/position');
20
- if($position=="t-l" || $position=="t-r" || $position=="b-l" || $position=="b-r"){
21
- $tag .= "var cs_position=\"".$position."\";";
 
 
 
 
 
 
 
 
 
 
 
22
  }
23
 
24
- $margin = intval(Mage::getStoreConfig('livechatplugin/layout/margin'));
25
- if($margin>0 && $margin<101){
26
- $tag .="var cs_margin=\"".$margin."px\";";
 
 
27
  }
28
 
29
- $tag .= "</script><!-- //cSupport Live Chat Plugin -->";
30
 
31
  echo $tag;
32
  }
33
- ?>
1
  <?php
2
+ Mage::log(__FILE__.':'.__LINE__.' - cSupport Live Chat is working');
3
+
4
+ $csupport_domain = Mage::getStoreConfig('livechatplugin/settings/website');
5
+ Mage::log(__FILE__.':'.__LINE__.' - cSupport Domain: '.$website);
6
+
7
+ if (strlen($csupport_domain) > 0)
8
+ {
9
+ $tag = '';
10
 
11
  $type = Mage::getStoreConfig('livechatplugin/settings/type');
12
+ $tag .= '<!-- cSupport Live Chat Plugin --><script type="text/javascript">(function(d,c){var scrs=d.getElementsByTagName("script");var scr=scrs[scrs.length-1];var e=d.createElement("script");e.async=true;e.src=("https:"==document.location.protocol?"https://":"http://")+"' . $csupport_domain . '/external/' . $type . '.js?"+scrs.length;if(typeof c=="function")if(e.addEventListener)e.addEventListener("load",c,false);else if(e.readyState)e.onreadystatechange=function(){if(this.readyState=="loaded")c();};scr.parentNode.insertBefore(e,scr);})(document,null);';
13
 
14
+ $csupport_autofill = Mage::getStoreConfig('livechatplugin/settings/auto_fill');
15
+ if($csupport_autofill=='1')
16
+ {
17
+ if(Mage::getSingleton('customer/session')->isLoggedIn())
18
+ {
19
  $customer = Mage::getSingleton('customer/session');
20
+ $name = htmlspecialchars($customer->getCustomer()->getFirstname().' '.$customer->getCustomer()->getLastname());
21
  $email = $customer->getCustomer()->getEmail();
22
+ $tag .= 'var cs_name="' . $name . '";var cs_email="' . $email . '";';
23
+
24
+ $csupport_autostart = Mage::getStoreConfig('livechatplugin/settings/autostart');
25
+ if ($csupport_autostart=='true' || $csupport_autostart=='1')
26
+ {
27
+ $tag .= 'var cs_autostart=true;';
28
+ }
29
  }
30
  }
31
 
32
+ // Add positioning
33
+ $csupport_position = Mage::getStoreConfig('livechatplugin/layout/position');
34
+ if ($csupport_position == 't-l' || $csupport_position == 't-r' || $csupport_position == 'b-l' || $csupport_position == 'b-r')
35
+ {
36
+ $tag .= 'var cs_position="' . $csupport_position . '";';
37
+ }
38
+
39
+ // Add margin
40
+ $csupport_margin = Mage::getStoreConfig('livechatplugin/layout/margin');
41
+ if (strlen($csupport_margin)>0 && is_numeric($csupport_margin))
42
+ {
43
+ if ($csupport_margin>100) $csupport_margin=100;
44
+ elseif ($csupport_margin<-10) $csupport_margin=-10;
45
+ $tag .='var cs_margin="' . intVal($csupport_margin) . 'px";';
46
  }
47
 
48
+ // Add color
49
+ $csupport_bgcolor = Mage::getStoreConfig('livechatplugin/layout/bgcolor');
50
+ if (preg_match('/^#[a-fA-F0-9]{6}(\/#[a-fA-F0-9]{6})?$/i', $csupport_bgcolor))
51
+ {
52
+ $tag .= 'var cs_bgcolor="' . $csupport_bgcolor . '";';
53
  }
54
 
55
+ $tag .= '</script><!-- //cSupport Live Chat Plugin -->';
56
 
57
  echo $tag;
58
  }
59
+ ?>
package.xml CHANGED
@@ -1,13 +1,13 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>CSupport_LiveChatPlugin</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>This plugin implements the cSupport Inline Floating Live Chat button</summary>
10
- <description>NOTE: This plugin requires a cSupport Live Chat account. You can signup at &lt;a href="https://csupporthq.com/pricing/"&gt;https://csupporthq.com/pricing/&lt;/a&gt;&#xD;
11
  &#xD;
12
  This plugin implements an inline Live Chat button to the bottom right of your Magento site.&#xD;
13
  &#xD;
@@ -21,13 +21,13 @@ cSupport Live Chat features include:&#xD;
21
  * Jabber/Google Talk integration to chat with your website visitors directly from your favorite IM application (on your mobile as well)&#xD;
22
  * Reliable and secure&#xD;
23
  * Complete chat history available for visitors and for the website administrator&#xD;
24
- * Localized into English, Dansk, Espa&#xF1;ol, &#x420;&#x43E;&#x441;&#x441;&#x438;&#x44F;, Portugu&#xE9;s (Brasil), &#x10C;esk&#xFD;, and many more.&#xD;
25
  * The live chat service is provided by csupporthq.com. See &lt;a href="https://www.csupporthq.com/"&gt;https://www.csupporthq.com/&lt;/a&gt; for a full list of features.</description>
26
- <notes>Minor patch release correcting reference names</notes>
27
- <authors><author><name>cSupport Team</name><user>auto-converted</user><email>contact@csupporthq.com</email></author></authors>
28
- <date>2012-05-25</date>
29
- <time>18:02:52</time>
30
- <contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="CSupport"><dir name="LiveChatPlugin"><file name="livechat.phtml" hash="a505cfcab4692db274bdda002e8676e0"/></dir></dir></dir><dir name="layout"><file name="CSupport_LiveChatPlugin.xml" hash="59bde749649bcb69c82f3df4dda5619f"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="CSupport"><dir name="LiveChatPlugin"><dir name="Helper"><file name="Data.php" hash="00957354badb30b551067f8b446da0bc"/></dir><dir name="Model"><file name="Position.php" hash="7336c26c22506618e223a1fb6e971732"/><file name="Types.php" hash="6bc93a9dcf3884fa2a8242a26a59c81c"/></dir><dir name="etc"><file name="config.xml" hash="5f5605d734b7388e0b394d8c79c8a6c8"/><file name="system.xml" hash="f4c52388cf39120b668c89a0d41bbd53"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CSupport_LiveChatPlugin.xml" hash="1d9efc6b2d8db7423611c8baa6cab5a5"/></dir></target></contents>
31
  <compatible/>
32
- <dependencies/>
33
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>CSupport_LiveChatPlugin</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>This plugin implements the cSupport live vhat button</summary>
10
+ <description>NOTE: This plugin requires a cSupport Live Chat account. You can signup for a free 30-day trial at &lt;a href="http://csupporthq.com/pricing/"&gt;http://csupporthq.com/pricing/&lt;/a&gt;&#xD;
11
  &#xD;
12
  This plugin implements an inline Live Chat button to the bottom right of your Magento site.&#xD;
13
  &#xD;
21
  * Jabber/Google Talk integration to chat with your website visitors directly from your favorite IM application (on your mobile as well)&#xD;
22
  * Reliable and secure&#xD;
23
  * Complete chat history available for visitors and for the website administrator&#xD;
24
+ * Localized into English, Espa&#xF1;ol, &#x420;&#x43E;&#x441;&#x441;&#x438;&#x44F;, Portugu&#xE9;s (Brasil), &#x10C;esk&#xFD;, Dansk, and many more.&#xD;
25
  * The live chat service is provided by csupporthq.com. See &lt;a href="https://www.csupporthq.com/"&gt;https://www.csupporthq.com/&lt;/a&gt; for a full list of features.</description>
26
+ <notes>Adding several new features, and using async script.</notes>
27
+ <authors><author><name>cSupport Team</name><user>csupporthq</user><email>contact@csupporthq.com</email></author></authors>
28
+ <date>2013-03-06</date>
29
+ <time>20:28:49</time>
30
+ <contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="CSupport"><dir name="LiveChatPlugin"><file name="livechat.phtml" hash="a8a367ae0a81a04478c2d6ab4ae976bb"/></dir></dir></dir><dir name="layout"><file name="CSupport_LiveChatPlugin.xml" hash="a8cf13d4d01f30f90f02fc997bda7e92"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="CSupport"><dir><dir name="LiveChatPlugin"><dir name="Helper"><file name="Data.php" hash="00957354badb30b551067f8b446da0bc"/></dir><dir name="Model"><file name="Position.php" hash="7336c26c22506618e223a1fb6e971732"/><file name="Types.php" hash="6bc93a9dcf3884fa2a8242a26a59c81c"/></dir><dir name="etc"><file name="config.xml" hash="82685a70258b4e624d1f038fc5ec424e"/><file name="system.xml" hash="1b21fc43f9d0f18d73d744e8b7f128dd"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CSupport_LiveChatPlugin.xml" hash="1d9efc6b2d8db7423611c8baa6cab5a5"/></dir></target></contents>
31
  <compatible/>
32
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
33
  </package>