Sostanza_LiveHelp - Version 1.5.5

Version Notes

Added:
- orders tracking to measure your ROI
- real time user's cart

Download this release

Release Info

Developer a.laciura@sostanza.it
Extension Sostanza_LiveHelp
Version 1.5.5
Comparing to
See all releases


Code changes from version 1.5.0 to 1.5.5

app/code/community/Sostanza/Livehelp/Block/Functions.php CHANGED
@@ -7,6 +7,9 @@ class Sostanza_Livehelp_Block_Functions extends Mage_Core_Block_Template
7
  protected $_dynamic = false;
8
  protected $_button = false;
9
  protected $_position = false;
 
 
 
10
 
11
  public function isActive()
12
  {
@@ -48,5 +51,67 @@ class Sostanza_Livehelp_Block_Functions extends Mage_Core_Block_Template
48
  $this->_dynamic = Mage::getStoreConfig('livehelp/advancedconfig/filter');
49
  return $this->_dynamic;
50
  }
51
-
52
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  protected $_dynamic = false;
8
  protected $_button = false;
9
  protected $_position = false;
10
+ protected $_cart = false;
11
+ protected $_trackorder = false;
12
+ protected $LHinfo = false;
13
 
14
  public function isActive()
15
  {
51
  $this->_dynamic = Mage::getStoreConfig('livehelp/advancedconfig/filter');
52
  return $this->_dynamic;
53
  }
54
+ public function getCart()
55
+ {
56
+ if ($this->_cart === false)
57
+ $this->_cart = Mage::getStoreConfig('livehelp/advancedconfig/cart');
58
+ return $this->_cart;
59
+ }
60
+ public function trackOrder()
61
+ {
62
+ if ($this->_trackorder === false)
63
+ $this->_trackorder = Mage::getStoreConfig('livehelp/advancedconfig/trackorder');
64
+ return $this->_trackorder;
65
+ }
66
+
67
+ public function getCartLHInfo()
68
+ {
69
+ $cliente=Mage::getSingleton('customer/session')->getCustomer()->getId();
70
+
71
+ //se � guest mostro i prodotti nel carrello
72
+ if (!isset($cliente)){
73
+
74
+ //se non si vuole passare il carrello all'operatore cambiare la riga sopra in:
75
+ //$LHinfo="Guest";
76
+ $session_id = Mage::getSingleton("core/session")->getEncryptedSessionId(); // get our session
77
+ $MAGENTOcart=Mage::getUrl( 'checkout/cart/', array(
78
+ '_query' => array('SID' => $session_id ), //make sure we append our session
79
+ '_store_to_url' => true ) ); // lastly add store to our url if needed
80
+ }
81
+ //altrimenti passo id utente
82
+ else{
83
+ $session_id = Mage::getSingleton("core/session")->getEncryptedSessionId(); // get our session
84
+ $MAGENTOcart=Mage::getUrl( 'customer/account/', array(
85
+ '_query' => array('SID' => $session_id ), //make sure we append our session
86
+ '_store_to_url' => true ) ); // lastly add store to our url if needed
87
+
88
+ }
89
+
90
+ $count = $this->helper('checkout/cart')->getSummaryCount();
91
+ $total = $this->helper('checkout/cart')->getQuote()->getGrandTotal();
92
+
93
+ if($count!=0){
94
+ return "Totale:".$total." "."Item:".$count." ".$MAGENTOcart;
95
+ }else{
96
+ return $MAGENTOcart;
97
+ }
98
+ }
99
+ public function trackCustomerOrder(){
100
+ $sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
101
+ $oOrder = Mage::getModel('sales/order')->load($sOrderId);
102
+ $TOTorder=$oOrder->getGrandTotal();
103
+ $TOTorder=number_format((float)$TOTorder, 2, '.', '');
104
+ $nordine=$oOrder->getIncrementId();?>
105
+ <script>
106
+ //track ordine livehelp
107
+ totale="<?php echo $TOTorder ?>";
108
+ LHamount=totale.replace('.','');
109
+ LHamount=LHamount.replace(',','');
110
+ LHorderID='<?php echo $nordine ?>';
111
+
112
+ document.write('<iframe src="//server.livehelp.it/admin/resa_livehelp.asp?gruppo=<?php echo $this->getLivehelpID(); ?>&amount=' + LHamount + '&orderID=' + LHorderID + '" height="0" width="0" style="display:none;visibility:hidden"></iframe>');
113
+ </script>
114
+ <?php
115
+ }
116
+ }
117
+ ?>
app/code/community/Sostanza/Livehelp/etc/system.xml CHANGED
@@ -54,7 +54,7 @@
54
  </depends>
55
  </lhid>
56
  <method module="livehelp" translate="label">
57
- <label>I want to use the easy way configuration</label>
58
  <frontend_type>select</frontend_type>
59
  <source_model>adminhtml/system_config_source_yesno</source_model>
60
  <sort_order>3</sort_order>
@@ -74,19 +74,36 @@
74
  <depends>
75
  <widget_method>2</widget_method>
76
  </depends>
77
- <comment><![CDATA[If you have set a list of dinamic widget in <a href="http://server.livehelp.it" target=blank>Livehelp® dashboard</a>, you can select one below]]></comment>
78
  <fields>
79
  <filter module="livehelp" translate="label comment">
80
  <label>Choose a dynamic js widget</label>
81
  <frontend_type>select</frontend_type>
82
  <source_model>livehelp/config_source_GetCool</source_model>
83
  <comment><![CDATA[The list of your widgets. <b>Click "Save Config"</b> if you don't see any widget.]]></comment>
84
- <sort_order>3</sort_order>
85
  <show_in_default>2</show_in_default>
86
  <show_in_website>1</show_in_website>
87
  <show_in_store>1</show_in_store>
88
  </filter>
89
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  </fields>
91
  </advancedconfig>
92
  <classicconfig module="livehelp" translate="label comment">
54
  </depends>
55
  </lhid>
56
  <method module="livehelp" translate="label">
57
+ <label>I want to use the old easy way configuration</label>
58
  <frontend_type>select</frontend_type>
59
  <source_model>adminhtml/system_config_source_yesno</source_model>
60
  <sort_order>3</sort_order>
74
  <depends>
75
  <widget_method>2</widget_method>
76
  </depends>
77
+ <comment><![CDATA[If you have set a list of dynamic widget in <a href="http://server.livehelp.it" target=blank>Livehelp® dashboard</a>, you can select one below]]></comment>
78
  <fields>
79
  <filter module="livehelp" translate="label comment">
80
  <label>Choose a dynamic js widget</label>
81
  <frontend_type>select</frontend_type>
82
  <source_model>livehelp/config_source_GetCool</source_model>
83
  <comment><![CDATA[The list of your widgets. <b>Click "Save Config"</b> if you don't see any widget.]]></comment>
84
+ <sort_order>1</sort_order>
85
  <show_in_default>2</show_in_default>
86
  <show_in_website>1</show_in_website>
87
  <show_in_store>1</show_in_store>
88
  </filter>
89
+ <cart module="livehelp" translate="label">
90
+ <label>Let agents view/edit cart details</label>
91
+ <frontend_type>select</frontend_type>
92
+ <source_model>adminhtml/system_config_source_yesno</source_model>
93
+ <sort_order>2</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ </cart>
98
+ <trackorder module="livehelp" translate="label">
99
+ <label>Track your orders</label>
100
+ <frontend_type>select</frontend_type>
101
+ <source_model>adminhtml/system_config_source_yesno</source_model>
102
+ <sort_order>3</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ </trackorder>
107
  </fields>
108
  </advancedconfig>
109
  <classicconfig module="livehelp" translate="label comment">
app/design/frontend/base/default/template/livehelp/widget.phtml CHANGED
@@ -1,12 +1,15 @@
1
  <?php
2
- if ($this->isActive()){
3
- if ($this->isCool()){
4
 
5
- ?>
 
 
 
6
 
7
  <!-- Start LiveHelp Code Copyright 1997 - 2015 www.livehelp.it Sostanza srl -->
8
- <SCRIPT language=javascript> function apri_livehelp() {var d=new Date(); nuovo_LiveHelp_<?php echo $this->getLivehelpID(); ?>=window.open('http://server.livehelp.it/client_user_resp/?provenienza='+ escape(document.location.href) +'&info=&template=10314&stanza=&ID=<?php echo $this->getLivehelpID(); ?>&gruppo=Assistenza&nick=&x=' + d.valueOf(),'LiveHelpwin1_<?php echo $this->getLivehelpID(); ?>', 'status=no,location=no,toolbar=no,width=600,height=465,resizable=yes'); nuovo_LiveHelp_<?php echo $this->getLivehelpID(); ?>.focus();} </SCRIPT>
9
- <?php
10
  if ($this->getPosition() != "0"){
11
  if ($this->getPosition() == "1"){
12
  $span = "<span id='LH2013'>";
@@ -20,22 +23,34 @@ if ($this->isActive()){
20
  echo $span;?>
21
  <A HREF="#" OnClick="apri_livehelp(); return(false);"><img border="0" src="http://server.livehelp.it/admin/logo_livehelp.asp?bottone=<?php echo $this->getButton(); ?>&gruppo=<?php echo $this->getLivehelpID(); ?>&stanza="></A></span>
22
  <!-- End LiveHelp code -->
23
- <?php }?>
24
- <?php
25
  }else{
26
-
27
  if ($this->getDynamic()!="0"){
28
- ?>
29
- <!-- Start LiveHelp activation widget - http://www.livehelp.it -->
30
- <script type="text/javascript">
31
- function LHready(){if(document.readyState == "complete"){(function(){ var lh=document.createElement("script");
32
- lh.type="text/javascript"; lh.async=true;
33
- lh.src="//server.livehelp.it/widgetjs/<?php echo $this->getLivehelpID(); ?>/<?php echo $this->getDynamic(); ?>.js?x=" + 1*new Date();
34
- var node=document.getElementsByTagName("script")[0];
35
- node.parentNode.insertBefore(lh,node);
36
- })();} else {setTimeout('LHready()',150);}} LHready();
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  </script>
38
- <?php
39
  }
40
- }
41
  }?>
1
  <?php
2
+ //get the page
3
+ $success= Mage::app()->getRequest()->getActionName();
4
 
5
+ //se � attivo
6
+ if ($this->isActive()){
7
+ //se uso il vecchio metodo
8
+ if ($this->isCool()){?>
9
 
10
  <!-- Start LiveHelp Code Copyright 1997 - 2015 www.livehelp.it Sostanza srl -->
11
+ <SCRIPT language=javascript> function apri_livehelp() {var d=new Date(); nuovo_LiveHelp_<?php echo $this->getLivehelpID(); ?>=window.open('http://server.livehelp.it/client_user_http/?provenienza='+ escape(document.location.href) +'&info=&template=10281&stanza=&ID=<?php echo $this->getLivehelpID(); ?>&gruppo=Assistenza&nick=&x=' + d.valueOf(),'LiveHelpwin1_<?php echo $this->getLivehelpID(); ?>', 'status=no,location=no,toolbar=no,width=600,height=465,resizable=yes'); nuovo_LiveHelp_<?php echo $this->getLivehelpID(); ?>.focus();} </SCRIPT>
12
+ <?php
13
  if ($this->getPosition() != "0"){
14
  if ($this->getPosition() == "1"){
15
  $span = "<span id='LH2013'>";
23
  echo $span;?>
24
  <A HREF="#" OnClick="apri_livehelp(); return(false);"><img border="0" src="http://server.livehelp.it/admin/logo_livehelp.asp?bottone=<?php echo $this->getButton(); ?>&gruppo=<?php echo $this->getLivehelpID(); ?>&stanza="></A></span>
25
  <!-- End LiveHelp code -->
26
+ <?php }
 
27
  }else{
28
+ //uso il nuovo metodo
29
  if ($this->getDynamic()!="0"){
30
+ $MAGENTOcart="";
31
+
32
+ //vuole vedere cosa c'� nel carrello o l'id dell'utente se loggato
33
+ if ($this->getCart()!="0"){
34
+ $MAGENTOcart=$this->getCartLHInfo();
35
+ }
36
+
37
+ //voglio tracciare gli ordini conclusi grazie alla chat
38
+ if ($this->trackOrder()!="0"){
39
+ if ($success=="success"){
40
+ echo $this->trackCustomerOrder();
41
+ }
42
+ }?>
43
+ <!-- Start LiveHelp activation widget - http://www.livehelp.it -->
44
+ <script type="text/javascript">
45
+ var LHinfo='<?php echo $MAGENTOcart ?>';
46
+ function LHready(){if(document.readyState == "complete"){(function(){ var lh=document.createElement("script");
47
+ lh.type="text/javascript"; lh.async=true;
48
+ lh.src="//server.livehelp.it/widgetjs/<?php echo $this->getLivehelpID(); ?>/<?php echo $this->getDynamic(); ?>.js?x=" + 1*new Date();
49
+ var node=document.getElementsByTagName("script")[0];
50
+ node.parentNode.insertBefore(lh,node);
51
+ })();} else {setTimeout('LHready()',150);}} LHready();
52
  </script>
53
+ <?php
54
  }
55
+ }
56
  }?>
package.xml CHANGED
@@ -1,18 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sostanza_LiveHelp</name>
4
- <version>1.5.0</version>
5
  <stability>stable</stability>
6
  <license>OSL-3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Livehelp for chat support.</summary>
10
- <description>LiveHelp&amp;amp; is the customer care service in which the company operator answers to customers' and prospects' questions directly in a real-time chat.</description>
11
- <notes>Security patches support Added. New plugin configuration with dynamic js button.</notes>
 
 
12
  <authors><author><name>Alessandro La Ciura</name><user>alaciura</user><email>a.laciura@sostanza.it</email></author></authors>
13
- <date>2015-12-02</date>
14
- <time>16:31:32</time>
15
- <contents><target name="magecommunity"><dir name="Sostanza"><dir name="Livehelp"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Source"><file name="Buttons.php" hash="f451d7bd1d3407bde94d62e883e4ff03"/></dir></dir></dir><file name="Functions.php" hash="eee18361d5885bca72e9a5ca0df123a2"/></dir><dir name="Helper"><file name="Data.php" hash="02dcb95a2e4f313a6441f1c0778bdbf1"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="GetCool.php" hash="6c5a81784a9850032c70877fd017dd42"/><file name="GetLivehelpButton.php" hash="51baf3c4be6be8e4e424325ab93313ba"/><file name="GetLivehelpPosition.php" hash="59393c3e30f5f94565eb581844f922d2"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="f25d6bb4d60701e09a46780311123964"/><file name="config.xml" hash="e9c538003755e5d3aca16d66d7a516b3"/><file name="system.xml" hash="b7f9b516f0fa5e80a70330a1a36c0339"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="livehelp.xml" hash="4cada04c2d968e0721a69c5287678889"/></dir><dir name="template"><dir name="livehelp"><file name="widget.phtml" hash="d679cd3a4dbc5302b7db09ee56009add"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sostanza_Livehelp.xml" hash="e233123489b59007400da8a42e60b0fa"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sostanza_LiveHelp</name>
4
+ <version>1.5.5</version>
5
  <stability>stable</stability>
6
  <license>OSL-3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Livehelp for chat support.</summary>
10
+ <description>LiveHelp&#xAE; is the customer care service in which the company operator answers to customers' and prospects' questions directly in a real-time chat.</description>
11
+ <notes>Added:&#xD;
12
+ - orders tracking to measure your ROI&#xD;
13
+ - real time user's cart</notes>
14
  <authors><author><name>Alessandro La Ciura</name><user>alaciura</user><email>a.laciura@sostanza.it</email></author></authors>
15
+ <date>2015-12-21</date>
16
+ <time>17:18:05</time>
17
+ <contents><target name="magecommunity"><dir name="Sostanza"><dir name="Livehelp"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Source"><file name="Buttons.php" hash="f451d7bd1d3407bde94d62e883e4ff03"/></dir></dir></dir><file name="Functions.php" hash="fd74d2fb46d84c5590e7e19ea1b7d6f0"/></dir><dir name="Helper"><file name="Data.php" hash="02dcb95a2e4f313a6441f1c0778bdbf1"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="GetCool.php" hash="6c5a81784a9850032c70877fd017dd42"/><file name="GetLivehelpButton.php" hash="51baf3c4be6be8e4e424325ab93313ba"/><file name="GetLivehelpPosition.php" hash="59393c3e30f5f94565eb581844f922d2"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="f25d6bb4d60701e09a46780311123964"/><file name="config.xml" hash="e9c538003755e5d3aca16d66d7a516b3"/><file name="system.xml" hash="55e9cb6ae8cca1abd98ab131e56e1d29"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="livehelp"><file name="widget.phtml" hash="b1f6ee12f116787703c95ea4c47544fc"/></dir></dir><dir name="layout"><file name="livehelp.xml" hash="4cada04c2d968e0721a69c5287678889"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sostanza_Livehelp.xml" hash="e233123489b59007400da8a42e60b0fa"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>