Sostanza_LiveHelp - Version 1.6.3

Version Notes

- Added Magento v 1.9.3.3 compatibility
- Minor fixes

Download this release

Release Info

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


Code changes from version 1.6.2 to 1.6.3

app/code/community/Sostanza/Livehelp/Block/Adminhtml/Config/Source/Buttons.php CHANGED
@@ -1,45 +1,53 @@
1
  <?php
2
- class Sostanza_Livehelp_Block_Adminhtml_Config_Source_Buttons
3
- extends Mage_Adminhtml_Block_Abstract
4
- implements Varien_Data_Form_Element_Renderer_Interface
5
- {
6
- protected $_livehelpID = false;
7
- public function getLivehelpID()
8
- {
9
- if ($this->_livehelpID === false)
10
- $this->_livehelpID = Mage::getStoreConfig('livehelp/widget/lhid');
11
-
12
- return $this->_livehelpID;
13
- }
14
- public function render(Varien_Data_Form_Element_Abstract $element)
15
- {
16
- $id=$this->getLivehelpID();
17
- if($id!=""){
18
- $buttonSignUp = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
19
- 'label' => $this->__('Login as Agent'),
20
- 'onclick' => "window.open('http://server.livehelp.it/mobile/index2.asp?id=".$id."', '_blank');",
21
- 'class' => 'go',
22
- 'type' => 'button',
23
- ))
24
- ->toHtml();}
25
-
26
- $buttonDashboard = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
27
- 'label' => $this->__('Livehelp Dashboard'),
28
- 'onclick' => "window.open('http://server.livehelp.it/', '_blank');",
29
- 'class' => 'go',
30
- 'type' => 'button',
31
-
32
- ))
33
- ->toHtml();
34
- $buttonSite = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array(
35
- 'label' => $this->__('Livehelp Site'),
36
- 'onclick' => "window.open('http://www.livehelp.it?ref=mag_console/', '_blank');",
37
- 'class' => 'go',
38
- 'type' => 'button',
39
-
40
- ))
41
- ->toHtml();
42
- return $html . '<p>' . $buttonSignUp . '&nbsp;' . $buttonDashboard . '&nbsp;' . $buttonSite . '</p>';
43
-
44
- }
45
- }
 
 
 
 
 
 
 
 
1
  <?php
2
+
3
+ class Sostanza_Livehelp_Block_Adminhtml_Config_Source_Buttons
4
+ extends Mage_Adminhtml_Block_Abstract
5
+ implements Varien_Data_Form_Element_Renderer_Interface {
6
+
7
+ protected $_livehelpID = FALSE;
8
+
9
+ public function getLivehelpID () {
10
+ if($this->_livehelpID === FALSE) {
11
+ $this->_livehelpID = Mage::getStoreConfig("livehelp/widget/lhid");
12
+ }
13
+
14
+ return $this->_livehelpID;
15
+ }
16
+
17
+ public function render (Varien_Data_Form_Element_Abstract $element) {
18
+ $block_type = "adminhtml/widget_button";
19
+ $id = $this->getLivehelpID();
20
+ if(!empty($id)) {
21
+
22
+ $signupButtonData = [
23
+ "label" => $this->__("Login as Agent"),
24
+ "onclick" => "window.open(\"http://server.livehelp.it/mobile/index2.asp?id=$id\", \"_blank\");",
25
+ "class" => "go",
26
+ "type" => "button",
27
+ ];
28
+
29
+ $buttonSignUp = $this->getLayout()->createBlock($block_type)->setData($signupButtonData)->toHtml();
30
+ }
31
+
32
+ $dashboardButtonData = [
33
+ "label" => $this->__("Livehelp Dashboard"),
34
+ "onclick" => "window.open(\"http://server.livehelp.it/\", \"_blank\");",
35
+ "class" => "go",
36
+ "type" => "button"
37
+ ];
38
+
39
+ $siteButtonData = [
40
+ "label" => $this->__("Livehelp Site"),
41
+ "onclick" => "window.open(\"http://www.livehelp.it?ref=mag_console/\", \"_blank\");",
42
+ "class" => "go",
43
+ "type" => "button"
44
+ ];
45
+
46
+ $buttonDashboard = $this->getLayout()->createBlock($block_type)->setData($dashboardButtonData)->toHtml();
47
+
48
+ $buttonSite = $this->getLayout()->createBlock($block_type)->setData($siteButtonData)->toHtml();
49
+
50
+ return "<p>$buttonSignUp&nbsp;$buttonDashboard&nbsp;$buttonSite</p>";
51
+
52
+ }
53
+ }
app/code/community/Sostanza/Livehelp/Block/Functions.php CHANGED
@@ -1,100 +1,118 @@
1
  <?php
2
 
3
- class Sostanza_Livehelp_Block_Functions extends Mage_Core_Block_Template
4
- {
5
- //inizializzo tutto a false
6
- protected $_livehelpID = false;
7
- protected $_method = false;
8
- protected $_dynamic = false;
9
- protected $_viewTUTTO = false;
10
- protected $_viewGEN= false;
11
- protected $_viewCAT= false;
12
- protected $_viewPROD= false;
13
- protected $_viewFUNNEL= false;
14
- protected $_cart = false;
15
- protected $_trackorder = false;
16
- protected $LHinfo = false;
17
-
18
-
19
- //controlla se il plugin è stato abilitato dall'utente
20
- public function isActive()
21
- {
22
- return Mage::getStoreConfigFlag('livehelp/widget/active') && $this->getLivehelpID();
23
- }
24
- //recupera l ID Livehelp
25
- public function getLivehelpID()
26
- {
27
- if ($this->_livehelpID === false)
28
- $this->_livehelpID = Mage::getStoreConfig('livehelp/widget/lhid');
29
-
30
- return $this->_livehelpID;
31
- }
32
- //vecchia funzione che recuperava l'id del widget dinamico (forse obsoleta con ultima release)
33
- public function getDynamic()
34
- {
35
- if ($this->_dynamic === false)
36
- $this->_dynamic = Mage::getStoreConfig('livehelp/advancedconfig/filter');
37
- return $this->_dynamic;
38
- }
39
- //recupera ID widget del menu a tendina "all"
40
- public function getGEN()
41
- {
42
- if ($this->_viewGEN === false)
43
- $this->_viewGEN = Mage::getStoreConfig('livehelp/advancedconfig/viewGEN');
44
- return $this->_viewGEN;
45
- }
46
- //recupera ID widget del menu a tendina "categoria"
47
- public function getCAT()
48
- {
49
- if ($this->_viewCAT === false)
50
- $this->_viewCAT = Mage::getStoreConfig('livehelp/advancedconfig/viewCAT');
51
- return $this->_viewCAT;
52
- }
53
- //recupera ID widget del menu a tendina "prodotto"
54
- public function getPROD()
55
- {
56
- if ($this->_viewPROD === false)
57
- $this->_viewPROD = Mage::getStoreConfig('livehelp/advancedconfig/viewPROD');
58
- return $this->_viewPROD;
59
- }
60
- //recupera ID widget del menu a tendina "funnel", quindi carrello e checkout
61
- public function getFUNNEL()
62
- {
63
- if ($this->_viewFUNNEL === false)
64
- $this->_viewFUNNEL = Mage::getStoreConfig('livehelp/advancedconfig/viewFUNNEL');
65
- return $this->_viewFUNNEL;
66
- }
67
- //controlla se è attivata l'opzione di visualizzazione carrello
68
- public function getCart()
69
- {
70
- if ($this->_cart === false)
71
- $this->_cart = Mage::getStoreConfig('livehelp/advancedconfig/cart');
72
- return $this->_cart;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
74
- //controlla se è attivata l'opzione di tracking ordini
75
- public function trackOrder()
76
- {
77
- if ($this->_trackorder === false)
78
- $this->_trackorder = Mage::getStoreConfig('livehelp/advancedconfig/trackorder');
79
- return $this->_trackorder;
80
- }
81
- //creazione dell'iframe livehelp per il tracking ordini se trackorder() è attivato
82
- public function trackCustomerOrder(){
83
- $sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
84
- $oOrder = Mage::getModel('sales/order')->load($sOrderId);
85
- $TOTorder=$oOrder->getGrandTotal();
86
- $TOTorder=number_format((float)$TOTorder, 2, '.', '');
87
- $nordine=$oOrder->getIncrementId();?>
88
- <script>
89
- //track ordine livehelp
90
- totale="<?php echo $TOTorder ?>";
91
- LHamount=totale.replace('.','');
92
- LHamount=LHamount.replace(',','');
93
- LHorderID='<?php echo $nordine ?>';
94
-
95
- 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>');
96
- </script>
97
- <?php
98
- }
99
- }
100
  ?>
1
  <?php
2
 
3
+ //PUBLIC CMS FUNCTIONS SET
4
+
5
+ class Sostanza_Livehelp_Block_Functions extends Mage_Core_Block_Template {
6
+
7
+ protected $_livehelpID = FALSE;
8
+ protected $_method = FALSE;
9
+ protected $_dynamic = FALSE;
10
+ protected $_viewTUTTO = FALSE;
11
+ protected $_viewGEN = FALSE;
12
+ protected $_viewCAT = FALSE;
13
+ protected $_viewPROD = FALSE;
14
+ protected $_viewFUNNEL = FALSE;
15
+ protected $_cart = FALSE;
16
+ protected $_trackorder = FALSE;
17
+ protected $LHinfo = FALSE;
18
+
19
+ public function check_vars ($vars = []) {
20
+ foreach($vars as $var) {
21
+ if($var != "0") {
22
+ return FALSE;
23
+ }
24
+ }
25
+
26
+ return TRUE;
27
+ //$vars["funnel"] == "0" && $vars["prod"] == "0" && $vars["cat"] == "0" && $vars["gen"] == "0"
28
+ }
29
+
30
+
31
+ public function isActive () {
32
+ return Mage::getStoreConfigFlag('livehelp/widget/active') && $this->getLivehelpID();
33
+ }
34
+
35
+ public function getLivehelpID () {
36
+ if($this->_livehelpID === FALSE)
37
+ $this->_livehelpID = Mage::getStoreConfig('livehelp/widget/lhid');
38
+
39
+ return $this->_livehelpID;
40
+ }
41
+
42
+ //vecchia funzione che recuperava l'id del widget dinamico (forse obsoleta con ultima release)
43
+ public function getDynamic () {
44
+ if($this->_dynamic === FALSE)
45
+ $this->_dynamic = Mage::getStoreConfig('livehelp/advancedconfig/filter');
46
+
47
+ return $this->_dynamic;
48
+ }
49
+
50
+ //recupera ID widget del menu a tendina "all"
51
+ public function getGEN () {
52
+ if($this->_viewGEN === FALSE)
53
+ $this->_viewGEN = Mage::getStoreConfig('livehelp/advancedconfig/viewGEN');
54
+
55
+ return $this->_viewGEN;
56
+ }
57
+
58
+ //recupera ID widget del menu a tendina "categoria"
59
+ public function getCAT () {
60
+ if($this->_viewCAT === FALSE)
61
+ $this->_viewCAT = Mage::getStoreConfig('livehelp/advancedconfig/viewCAT');
62
+
63
+ return $this->_viewCAT;
64
+ }
65
+
66
+ //recupera ID widget del menu a tendina "prodotto"
67
+ public function getPROD () {
68
+ if($this->_viewPROD === FALSE)
69
+ $this->_viewPROD = Mage::getStoreConfig('livehelp/advancedconfig/viewPROD');
70
+
71
+ return $this->_viewPROD;
72
+ }
73
+
74
+ //recupera ID widget del menu a tendina "funnel", quindi carrello e checkout
75
+ public function getFUNNEL () {
76
+ if($this->_viewFUNNEL === FALSE)
77
+ $this->_viewFUNNEL = Mage::getStoreConfig('livehelp/advancedconfig/viewFUNNEL');
78
+
79
+ return $this->_viewFUNNEL;
80
+ }
81
+
82
+ //controlla se è attivata l'opzione di visualizzazione carrello
83
+ public function getCart () {
84
+ if($this->_cart === FALSE)
85
+ $this->_cart = Mage::getStoreConfig('livehelp/advancedconfig/cart');
86
+
87
+ return $this->_cart;
88
+ }
89
+
90
+ //controlla se è attivata l'opzione di tracking ordini
91
+ public function trackOrder () {
92
+ if($this->_trackorder === FALSE)
93
+ $this->_trackorder = Mage::getStoreConfig('livehelp/advancedconfig/trackorder');
94
+
95
+ return $this->_trackorder;
96
+ }
97
+
98
+ //creazione dell'iframe livehelp per il tracking ordini se trackorder() è attivato
99
+ public function trackCustomerOrder () {
100
+ $last_order_id = Mage::getSingleton("checkout/session")->getLastOrderId();
101
+ $order_model = Mage::getModel("sales/order")->load($last_order_id);
102
+ $order_total = $order_model->getGrandTotal();
103
+ $order_total = number_format((float)$order_total, 2, ".", "");
104
+ $lh_order_id = $order_model->getIncrementId(); ?>
105
+ <script>
106
+ //track ordine livehelp
107
+ totale = "<?php echo $order_total ?>";
108
+ LHamount = totale.replace(".", "");
109
+ LHamount = LHamount.replace(",", "");
110
+ LHorderID = "<?php echo $lh_order_id ?>";
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
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  ?>
app/code/community/Sostanza/Livehelp/Model/Config/Source/GetCool.php CHANGED
@@ -1,79 +1,101 @@
1
  <?php
 
2
 
3
- class Sostanza_Livehelp_Model_Config_Source_GetCool
4
- {
5
 
6
- protected $_livehelpID = false;
 
 
 
 
 
 
 
 
 
 
7
 
8
- public function getLivehelpID() {
9
 
10
- if($this->_livehelpID === false)
11
 
12
- $this->_livehelpID = Mage::getStoreConfig('livehelp/widget/lhid');
13
 
14
-
15
 
16
- return $this->_livehelpID;
17
 
18
- }
19
- public function getDynamic()
20
- {
21
- if ($this->_dynamic === false)
22
- $this->_dynamic = Mage::getStoreConfig('livehelp/advancedconfig/filter');
23
- return $this->_dynamic;
24
- }
25
- public function getGEN()
26
- {
27
- if ($this->_viewGEN === false)
28
- $this->_viewGEN = Mage::getStoreConfig('livehelp/advancedconfig/viewGEN');
29
- return $this->_viewGEN;
30
- }
31
- public function getCAT()
32
- {
33
- if ($this->_viewCAT === false)
34
- $this->_viewCAT = Mage::getStoreConfig('livehelp/advancedconfig/viewCAT');
35
- return $this->_viewCAT;
36
- }
37
- public function getPROD()
38
- {
39
- if ($this->_viewPROD === false)
40
- $this->_viewPROD = Mage::getStoreConfig('livehelp/advancedconfig/viewPROD');
41
- return $this->_viewPROD;
42
- }
43
- public function getFUNNEL()
44
- {
45
- if ($this->_viewFUNNEL === false)
46
- $this->_viewFUNNEL = Mage::getStoreConfig('livehelp/advancedconfig/viewFUNNEL');
47
- return $this->_viewFUNNEL;
48
- }
49
-
50
- public function toOptionArray()
51
- {
52
- if ($this->getFUNNEL()!="0" || $this->getPROD()!="0" || $this->getGEN()!="0" || $this->getCAT()!="0"){
53
- Mage::getConfig()->saveConfig('livehelp/advancedconfig/filter', '0');
54
- }
55
-
56
- $curl = curl_init();
57
-
58
- $id=$this->getLivehelpID();
59
- curl_setopt_array($curl, array(
60
- CURLOPT_RETURNTRANSFER => 1,
61
- CURLOPT_URL => 'http://server.livehelp.it/admin/widget_elenco_ajax.asp?idgruppo='.$id
62
- ));
63
-
64
- $resp = curl_exec($curl);
65
-
66
- curl_close($curl);
67
- $resp= substr_replace($resp ,"",-1);
68
- $resp=$resp.",0=>Choose a widget...";
69
- $asArr = explode(',', $resp);
70
-
71
- foreach( $asArr as $val ){
72
- $tmp = explode( '=>', $val );
73
- $finalArray[ $tmp[0] ] = $tmp[1];
74
- }
75
- return $finalArray;
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
78
- }
79
  ?>
1
  <?php
2
+ //ADMIN CMS FUNCTIONS SET
3
 
4
+ class Sostanza_Livehelp_Model_Config_Source_GetCool {
 
5
 
6
+ protected $_livehelpID = FALSE;
7
+ protected $_method = FALSE;
8
+ protected $_dynamic = FALSE;
9
+ protected $_viewTUTTO = FALSE;
10
+ protected $_viewGEN = FALSE;
11
+ protected $_viewCAT = FALSE;
12
+ protected $_viewPROD = FALSE;
13
+ protected $_viewFUNNEL = FALSE;
14
+ protected $_cart = FALSE;
15
+ protected $_trackorder = FALSE;
16
+ protected $LHinfo = FALSE;
17
 
18
+ public function getLivehelpID () {
19
 
20
+ if($this->_livehelpID === FALSE)
21
 
22
+ $this->_livehelpID = Mage::getStoreConfig('livehelp/widget/lhid');
23
 
 
24
 
25
+ return $this->_livehelpID;
26
 
27
+ }
28
+
29
+ public function getDynamic () {
30
+ if($this->_dynamic === FALSE){
31
+ $this->_dynamic = Mage::getStoreConfig('livehelp/advancedconfig/filter');
32
+ }
33
+
34
+ return $this->_dynamic;
35
+ }
36
+
37
+ public function getGEN () {
38
+ if($this->_viewGEN === FALSE){
39
+ $this->_viewGEN = Mage::getStoreConfig('livehelp/advancedconfig/viewGEN');
40
+ }
41
+
42
+ return $this->_viewGEN;
43
+ }
44
+
45
+ public function getCAT () {
46
+ if($this->_viewCAT === FALSE){
47
+ $this->_viewCAT = Mage::getStoreConfig('livehelp/advancedconfig/viewCAT');
48
+ }
49
+
50
+ return $this->_viewCAT;
51
+ }
52
+
53
+ public function getPROD () {
54
+ if($this->_viewPROD === FALSE){
55
+ $this->_viewPROD = Mage::getStoreConfig('livehelp/advancedconfig/viewPROD');
56
+ }
57
+
58
+ return $this->_viewPROD;
59
+ }
60
+
61
+ public function getFUNNEL () {
62
+ if($this->_viewFUNNEL === FALSE) {
63
+ $this->_viewFUNNEL = Mage::getStoreConfig('livehelp/advancedconfig/viewFUNNEL');
64
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
+ return $this->_viewFUNNEL;
67
+ }
68
+
69
+ public function toOptionArray () {
70
+ if($this->getFUNNEL() != "0" || $this->getPROD() != "0" || $this->getGEN() != "0" || $this->getCAT() != "0") {
71
+ Mage::getConfig()->saveConfig('livehelp/advancedconfig/filter', '0');
72
+ }
73
+
74
+ $curl = curl_init();
75
+
76
+ $id = $this->getLivehelpID();
77
+ curl_setopt_array($curl, array(
78
+ CURLOPT_RETURNTRANSFER => 1,
79
+ CURLOPT_URL => 'http://server.livehelp.it/admin/widget_elenco_ajax.asp?idgruppo=' . $id
80
+ ));
81
+
82
+ $resp = curl_exec($curl);
83
+
84
+ curl_close($curl);
85
+ $resp = substr_replace($resp, "", -1);
86
+ $resp = $resp . ",0=>Choose a widget...";
87
+ $asArr = explode(',', $resp);
88
+
89
+ $finalArray = [];
90
+
91
+ foreach($asArr as $val) {
92
+ $tmp = explode('=>', $val);
93
+ $finalArray[$tmp[0]] = $tmp[1];
94
+ }
95
+
96
+ return $finalArray;
97
+
98
+ }
99
  }
100
+
101
  ?>
app/code/community/Sostanza/Livehelp/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Sostanza_Livehelp>
5
- <version>1.6.2</version>
6
  </Sostanza_Livehelp>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Sostanza_Livehelp>
5
+ <version>1.6.3</version>
6
  </Sostanza_Livehelp>
7
  </modules>
8
  <global>
app/code/community/Sostanza/Livehelp/etc/system.xml CHANGED
@@ -83,7 +83,7 @@
83
  <label>Track your orders</label>
84
  <frontend_type>select</frontend_type>
85
  <source_model>adminhtml/system_config_source_yesno</source_model>
86
- <comment>
87
  <![CDATA[Only for <b>business account</b>. ]]>
88
  </comment>
89
  <sort_order>3</sort_order>
@@ -91,9 +91,9 @@
91
  <show_in_website>1</show_in_website>
92
  <show_in_store>1</show_in_store>
93
  </trackorder>
94
-
95
  <filter module="livehelp" translate="label">
96
-
97
  <label>All</label>
98
  <frontend_type>select</frontend_type>
99
  <source_model>livehelp/config_source_GetCool</source_model>
@@ -101,7 +101,7 @@
101
  <show_in_default>1</show_in_default>
102
  <show_in_website>1</show_in_website>
103
  <show_in_store>1</show_in_store>
104
- </filter>
105
  <viewGEN module="livehelp" translate="label">
106
  <label>Others</label>
107
  <frontend_type>select</frontend_type>
@@ -110,7 +110,7 @@
110
  <show_in_default>1</show_in_default>
111
  <show_in_website>1</show_in_website>
112
  <show_in_store>1</show_in_store>
113
- </viewGEN>
114
  <viewCAT module="livehelp" translate="label">
115
  <label>Categories</label>
116
  <frontend_type>select</frontend_type>
@@ -119,7 +119,7 @@
119
  <show_in_default>1</show_in_default>
120
  <show_in_website>1</show_in_website>
121
  <show_in_store>1</show_in_store>
122
- </viewCAT>
123
  <viewPROD module="livehelp" translate="label">
124
  <label>Product</label>
125
  <frontend_type>select</frontend_type>
@@ -128,7 +128,7 @@
128
  <show_in_default>1</show_in_default>
129
  <show_in_website>1</show_in_website>
130
  <show_in_store>1</show_in_store>
131
- </viewPROD>
132
  <viewFUNNEL module="livehelp" translate="label">
133
  <label>Funnel</label>
134
  <frontend_type>select</frontend_type>
@@ -137,7 +137,7 @@
137
  <show_in_default>1</show_in_default>
138
  <show_in_website>1</show_in_website>
139
  <show_in_store>1</show_in_store>
140
- </viewFUNNEL>
141
  </fields>
142
  </advancedconfig>
143
  </groups>
83
  <label>Track your orders</label>
84
  <frontend_type>select</frontend_type>
85
  <source_model>adminhtml/system_config_source_yesno</source_model>
86
+ <comment>
87
  <![CDATA[Only for <b>business account</b>. ]]>
88
  </comment>
89
  <sort_order>3</sort_order>
91
  <show_in_website>1</show_in_website>
92
  <show_in_store>1</show_in_store>
93
  </trackorder>
94
+
95
  <filter module="livehelp" translate="label">
96
+
97
  <label>All</label>
98
  <frontend_type>select</frontend_type>
99
  <source_model>livehelp/config_source_GetCool</source_model>
101
  <show_in_default>1</show_in_default>
102
  <show_in_website>1</show_in_website>
103
  <show_in_store>1</show_in_store>
104
+ </filter>
105
  <viewGEN module="livehelp" translate="label">
106
  <label>Others</label>
107
  <frontend_type>select</frontend_type>
110
  <show_in_default>1</show_in_default>
111
  <show_in_website>1</show_in_website>
112
  <show_in_store>1</show_in_store>
113
+ </viewGEN>
114
  <viewCAT module="livehelp" translate="label">
115
  <label>Categories</label>
116
  <frontend_type>select</frontend_type>
119
  <show_in_default>1</show_in_default>
120
  <show_in_website>1</show_in_website>
121
  <show_in_store>1</show_in_store>
122
+ </viewCAT>
123
  <viewPROD module="livehelp" translate="label">
124
  <label>Product</label>
125
  <frontend_type>select</frontend_type>
128
  <show_in_default>1</show_in_default>
129
  <show_in_website>1</show_in_website>
130
  <show_in_store>1</show_in_store>
131
+ </viewPROD>
132
  <viewFUNNEL module="livehelp" translate="label">
133
  <label>Funnel</label>
134
  <frontend_type>select</frontend_type>
137
  <show_in_default>1</show_in_default>
138
  <show_in_website>1</show_in_website>
139
  <show_in_store>1</show_in_store>
140
+ </viewFUNNEL>
141
  </fields>
142
  </advancedconfig>
143
  </groups>
app/design/frontend/base/default/template/livehelp/widget.phtml CHANGED
@@ -1,102 +1,104 @@
1
  <?php
2
- //get the page
3
-
4
- $success= Mage::app()->getRequest()->getActionName();
5
- if ($this->isActive()){
6
- //$view=0;
7
- $confronto=$this->getViewLH();
8
- $view=false;
9
- $tutto=$this->getDynamic();
10
- $gen=$this->getGEN();
11
- $cat=$this->getCAT();
12
- $prod=$this->getPROD();
13
- $funnel=$this->getFUNNEL();
14
- $module ='';
15
- $controller='';
16
- $action='';
17
-
18
- if( ($funnel=="0" && $prod=="0" && $cat=="0" && $gen=="0") && $tutto!="0"){
19
- $view=true;
20
- $idLH=$tutto;
21
- }else{
22
-
23
- if($funnel!="0"){
24
-
25
- $request = $this->getRequest();
26
- $module = $request->getModuleName();
27
- $controller = $request->getControllerName();
28
- $action = $request->getActionName();
29
- if($module == 'checkout' && ($controller == 'cart' || $controller == 'onepage') && $action == 'index' || ($success=="success")){
30
-
31
- $view=true;
32
- $idLH=$funnel;
33
- }
34
- }
35
- if($prod!="0"){
36
- $product=Mage::registry('product');
37
- if ($product && $product->getId()) {
38
- $view=true;
39
-
40
- $idLH=$prod;
41
- }
42
- }
43
- if($cat!="0"){
44
- $category = Mage::registry('current_category');
45
- $product=Mage::registry('product');
46
- if (($category && $category->getId())&&!($product && $product->getId())) {
47
- $view=true;
48
-
49
- $idLH=$cat;
50
- }
51
- }
52
- if($gen!="0"){
53
-
54
- $category = Mage::registry('current_category');
55
- $product=Mage::registry('product');
56
- $request = $this->getRequest();
57
- $module = $request->getModuleName();
58
- $controller = $request->getControllerName();
59
- $action = $request->getActionName();
60
-
61
- if(!($module == 'checkout' && ($controller == 'cart' || $controller == 'onepage') && $action == 'index' || ($success=="success")) && (!($category && $category->getId()) &&!($product && $product->getId()))){
62
-
63
- $view=true;
64
- $idLH=$gen;
65
- }
66
- }
67
- }
68
- //voglio tracciare gli ordini conclusi grazie alla chat
69
- if ($this->trackOrder()!="0")
70
- {
71
- if ($success=="success")
72
- {
73
- echo $this->trackCustomerOrder();
74
- }
75
- }
76
-
77
- if($view==true){
78
-
79
- $MAGENTOcart="";
80
-
81
- //vuole vedere cosa c'� nel carrello o l'id dell'utente se loggato
82
- if ($this->getCart()!="0")
83
- {
84
- $MAGENTOcart=Mage::getUrl()."livehelp/index/getcartlhinfo";
85
- }
86
-
87
- ?>
88
- <!-- Start LiveHelp Magento activation widget - http://www.livehelp.it -->
89
- <script type="text/javascript">
90
- var LHmagento='<?php echo $MAGENTOcart ?>';
91
- var LHinfo='';
92
- function LHready(){if(document.readyState == "complete"){(function(){ var lh=document.createElement("script");
93
- lh.type="text/javascript"; lh.async=true;
94
- lh.src="//server.livehelp.it/widgetjs/<?php echo $this->getLivehelpID(); ?>/<?php echo $idLH; ?>.js?x=" + 1*new Date();
95
- var node=document.getElementsByTagName("script")[0];
96
- node.parentNode.insertBefore(lh,node);
97
- })();} else {setTimeout('LHready()',150);}} LHready();
98
- </script>
99
- <?php
100
- }
101
-
102
- }?>
 
 
1
  <?php
2
+ //get the page
3
+
4
+ $success = Mage::app()->getRequest()->getActionName();
5
+ if($this->isActive()) {
6
+ $confronto = $this->getViewLH();
7
+ $view = FALSE;
8
+ $vars = [];
9
+ $tutto = $this->getDynamic();
10
+ $vars["gen"] = $this->getGEN();
11
+ $vars["cat"] = $this->getCAT();
12
+ $vars["prod"] = $this->getPROD();
13
+ $vars["funnel"] = $this->getFUNNEL();
14
+ $module = "";
15
+ $controller = "";
16
+ $action = "";
17
+
18
+ if($this->check_vars($vars) && $tutto != "0") {
19
+ $view = TRUE;
20
+ $idLH = $tutto;
21
+ }
22
+ else {
23
+
24
+ if($vars["funnel"] != "0") {
25
+
26
+ $request = $this->getRequest();
27
+ $module = $request->getModuleName();
28
+ $controller = $request->getControllerName();
29
+ $action = $request->getActionName();
30
+ if($module == 'checkout' && ($controller == 'cart' || $controller == 'onepage') && $action == 'index' || ($success == "success")) {
31
+
32
+ $view = TRUE;
33
+ $idLH = $vars["funnel"];
34
+ }
35
+ }
36
+ if($vars["prod"] != "0") {
37
+ $product = Mage::registry('product');
38
+ if($product && $product->getId()) {
39
+ $view = TRUE;
40
+
41
+ $idLH = $vars["prod"];
42
+ }
43
+ }
44
+ if($vars["cat"] != "0") {
45
+ $category = Mage::registry('current_category');
46
+ $product = Mage::registry('product');
47
+ if(($category && $category->getId()) && !($product && $product->getId())) {
48
+ $view = TRUE;
49
+
50
+ $idLH = $vars["cat"];
51
+ }
52
+ }
53
+ if($vars["gen"] != "0") {
54
+
55
+ $category = Mage::registry('current_category');
56
+ $product = Mage::registry('product');
57
+ $request = $this->getRequest();
58
+ $module = $request->getModuleName();
59
+ $controller = $request->getControllerName();
60
+ $action = $request->getActionName();
61
+
62
+ if(!($module == 'checkout' && ($controller == 'cart' || $controller == 'onepage') && $action == 'index' || ($success == "success")) && (!($category && $category->getId()) && !($product && $product->getId()))) {
63
+
64
+ $view = TRUE;
65
+ $idLH = $vars["gen"];
66
+ }
67
+ }
68
+ }
69
+ //voglio tracciare gli ordini conclusi grazie alla chat
70
+ if($this->trackOrder() != "0") {
71
+ if($success == "success") {
72
+ echo $this->trackCustomerOrder();
73
+ }
74
+ }
75
+
76
+ if($view == TRUE) {
77
+
78
+ $MAGENTOcart = "";
79
+
80
+ //vuole vedere il contenuto del carrello o l'id dell'utente se loggato
81
+ if($this->getCart() != "0") {
82
+ $MAGENTOcart = Mage::getUrl() . "livehelp/index/getcartlhinfo";
83
+ }
84
+
85
+ ?>
86
+ <!-- Start LiveHelp Magento activation widget - http://www.livehelp.it -->
87
+ <script type="text/javascript">
88
+ var LHmagento = '<?php echo $MAGENTOcart ?>';
89
+ var LHinfo = '';
90
+ function LHready() {
91
+ var lh = document.createElement("script");
92
+ lh.type = "text/javascript";
93
+ lh.async = true;
94
+ lh.src = "//server.livehelp.it/widgetjs/<?php echo $this->getLivehelpID(); ?>/<?php echo $idLH; ?>.js?x=" + 1 * new Date();
95
+ var node = document.getElementsByTagName("script")[0];
96
+ node.parentNode.insertBefore(lh, node);
97
+ }
98
+
99
+ document.addEventListener('DOMContentLoaded', LHready, false);
100
+ </script>
101
+ <?php
102
+ }
103
+
104
+ } ?>
app/etc/modules/Sostanza_Livehelp.xml CHANGED
@@ -1,9 +1,9 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <modules>
4
- <Sostanza_Livehelp>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </Sostanza_Livehelp>
8
- </modules>
9
- </config>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Sostanza_Livehelp>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Sostanza_Livehelp>
8
+ </modules>
9
+ </config>
package.xml CHANGED
@@ -1,23 +1,19 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sostanza_LiveHelp</name>
4
- <version>1.6.2</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Livehelp live 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>Choose the widget that will pop up on each type of your e-commerce pages:&#xD;
12
- - All: the chat widget will pop up on every page of the website&#xD;
13
- - Categories: the chat widget will pop up in the category listing (i.e. apparel, shoes, accessories&#x2026;)&#xD;
14
- - Product: the chat widget will pop up on each product page&#xD;
15
- - Funnel: the chat widget will pop up in the cart and checkout pages&#xD;
16
- - Others: all the pages that aren't products,categories or funnel (like profile, wishlist)</notes>
17
  <authors><author><name>a.laciura@sostanza.it</name><user>alaciura</user><email>a.laciura@sostanza.it</email></author></authors>
18
- <date>2016-08-02</date>
19
- <time>09:25:38</time>
20
- <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="9cf7f675cad8fa2c65bf2e16aa5aa295"/></dir><dir name="Helper"><file name="Data.php" hash="350213592a87639adb3c550335b8bec6"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="GetCool.php" hash="4858dae16b90fb28bf274dca22568ef7"/></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="c529ffdacdc549c46213a2d7c93692f3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="de3981ba2172cc18f178e9e55c71232b"/><file name="config.xml" hash="8ec6e96750cf86b4bc060e60d4e906dc"/><file name="system.xml" hash="1ed781268acf23a15a0129a177fb863e"/></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="8cafadff854e839595496b54f8131d68"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sostanza_Livehelp.xml" hash="e233123489b59007400da8a42e60b0fa"/></dir></target></contents>
21
  <compatible/>
22
- <dependencies><required><php><min>5.1.0</min><max>5.6.0</max></php></required></dependencies>
23
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sostanza_LiveHelp</name>
4
+ <version>1.6.3</version>
5
  <stability>stable</stability>
6
  <license>Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Livehelp live 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 Magento v 1.9.3.3 compatibility&#xD;
12
+ - Minor fixes</notes>
 
 
 
 
13
  <authors><author><name>a.laciura@sostanza.it</name><user>alaciura</user><email>a.laciura@sostanza.it</email></author></authors>
14
+ <date>2017-07-04</date>
15
+ <time>15:09:15</time>
16
+ <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="84cc11a51286c4fe508f0bc98fd38831"/></dir></dir></dir><file name="Functions.php" hash="c1529834c522b11344697036ba1f91fd"/></dir><dir name="Helper"><file name="Data.php" hash="350213592a87639adb3c550335b8bec6"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="GetCool.php" hash="e4a2da5e46e153cd1760aed9722fd9df"/></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="c529ffdacdc549c46213a2d7c93692f3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="de3981ba2172cc18f178e9e55c71232b"/><file name="config.xml" hash="f4b2ca89be79ed309abb329577698d4c"/><file name="system.xml" hash="6e5217672a81db71e1b6a50ea99ec4ad"/></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="2d9186926512b3157e56341a68039db7"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sostanza_Livehelp.xml" hash="9366bdd0be36a663753b5443e4ac96ac"/></dir></target></contents>
17
  <compatible/>
18
+ <dependencies><required><php><min>5.1.0</min><max>5.6.30</max></php></required></dependencies>
19
  </package>