Interakt_App - Version 1.0.6

Version Notes

For any queries, please contact support@interakt.co

Download this release

Release Info

Developer Peeyush Singhla
Extension Interakt_App
Version 1.0.6
Comparing to
See all releases


Code changes from version 1.0.5 to 1.0.6

app/code/community/Interakt/App/Block/Display.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Interakt_App_Block_Display extends Mage_Core_Block_Template
3
+ {
4
+ private $interakt_app_id;
5
+ private $interakt_api_key;
6
+ public function getInteraktApp()
7
+ {
8
+ return Mage::helper('interakt_app')->getAppId();
9
+ }
10
+
11
+ public function getProtocol()
12
+ {
13
+ return isset($_SERVER['HTTPS'])?'https:':'http:';
14
+ }
15
+
16
+ public function getLogedInCustomerDetails()
17
+ {
18
+ $data = array();
19
+ if(Mage::getSingleton('customer/session')->isLoggedIn()){
20
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
21
+ $data['user_name']=$customer->getName();
22
+ $data['email']=$customer->getEmail();
23
+ $data['created_at']=$customer->getCreatedAt();
24
+ return $data;
25
+ }
26
+ else
27
+ {
28
+ return false;
29
+ }
30
+ }
31
+
32
+ protected function _toHtml()
33
+ {
34
+ $this->interakt_app_id=Mage::helper('interakt_app')->getAppId();
35
+ $block = $this->getLayout()->createBlock(
36
+ 'core/template',
37
+ 'interakt_app',
38
+ array(
39
+ 'template' => 'interakt_app/widget.phtml',
40
+ 'id'=>$this->getInteraktApp(),
41
+ 'protocol'=>$this->getProtocol(),
42
+ 'customer'=>$this->getLogedInCustomerDetails()
43
+ )
44
+ );
45
+ return $block->toHtml();
46
+ }
47
+ }
app/code/community/Interakt/App/Model/Observer.php CHANGED
@@ -1,11 +1,6 @@
1
  <?php
2
  class Interakt_App_Model_Observer
3
  {
4
- public function addInteraktJs($observer)
5
- {
6
- $product=Mage::getModel('Interakt_App_Model_SyncUserData');
7
- $product->getInteraktJs();
8
- }
9
  public function addCustomJs($observer)
10
  {
11
  $controller = $observer->getAction();
1
  <?php
2
  class Interakt_App_Model_Observer
3
  {
 
 
 
 
 
4
  public function addCustomJs($observer)
5
  {
6
  $controller = $observer->getAction();
app/code/community/Interakt/App/Model/SyncUserData.php CHANGED
@@ -6,37 +6,8 @@ class Interakt_App_Model_SyncUserData
6
  {
7
  private $interakt_app_id;
8
  private $interakt_api_key;
9
- private $user_data=array();
10
  private $total_synced=0;
11
- public function getInteraktJs()
12
- {
13
- $this->interakt_app_id=Mage::helper('interakt_app')->getAppId();
14
- $protocol=isset($_SERVER['HTTPS'])?'https:':'http:';
15
- echo "<script>
16
- (function() {
17
- var interakt = document.createElement('script');
18
- interakt.type = 'text/javascript'; interakt.async = true;
19
- interakt.src = '$protocol//cdn.interakt.co/interakt/$this->interakt_app_id.js'
20
- var scrpt = document.getElementsByTagName('script')[0];
21
- scrpt.parentNode.insertBefore(interakt, scrpt);
22
- })()
23
- </script>";
24
- //verify if the user is logged in to the backend
25
- if(Mage::getSingleton('customer/session')->isLoggedIn()){
26
- $customer = Mage::getSingleton('customer/session')->getCustomer();
27
- $user_name=$customer->getName();
28
- $email=$customer->getEmail();
29
- $created_at=$customer->getCreatedAt();
30
- echo "<script>
31
- window.mySettings = {
32
- email: '$email',
33
- name: '$user_name',
34
- created_at: '$created_at',
35
- app_id: '$this->interakt_app_id'
36
- };
37
- </script>";
38
- }
39
- }
40
  public function syncData($offset=1)
41
  {
42
  $customerData = mage::getResourceModel('customer/customer_collection')->addAttributeToSelect('firstname')
@@ -47,7 +18,7 @@ class Interakt_App_Model_SyncUserData
47
  $email=$data->getEmail();
48
  $createdAt=$data->getCreatedAt();
49
  $name=$data->getName();
50
- $this->user_data[]=array('email'=>$email,'name'=>$name,'created_at'=>$createdAt);
51
  $response=$this->sendData();
52
  if(isset($response)&& $response['status']=='failure')
53
  {
6
  {
7
  private $interakt_app_id;
8
  private $interakt_api_key;
9
+ private $user_data;
10
  private $total_synced=0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  public function syncData($offset=1)
12
  {
13
  $customerData = mage::getResourceModel('customer/customer_collection')->addAttributeToSelect('firstname')
18
  $email=$data->getEmail();
19
  $createdAt=$data->getCreatedAt();
20
  $name=$data->getName();
21
+ $this->user_data=array('email'=>$email,'name'=>$name,'created_at'=>$createdAt);
22
  $response=$this->sendData();
23
  if(isset($response)&& $response['status']=='failure')
24
  {
app/code/community/Interakt/App/etc/config.xml CHANGED
@@ -49,6 +49,13 @@
49
  </observers>
50
  </controller_action_layout_generate_blocks_after>
51
  </events>
 
 
 
 
 
 
 
52
  </frontend>
53
  <adminhtml>
54
  <events>
49
  </observers>
50
  </controller_action_layout_generate_blocks_after>
51
  </events>
52
+ <layout>
53
+ <updates>
54
+ <interakt_app>
55
+ <file>interakt_app.xml</file>
56
+ </interakt_app>
57
+ </updates>
58
+ </layout>
59
  </frontend>
60
  <adminhtml>
61
  <events>
app/design/frontend/base/default/layout/interakt_app.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="before_body_end">
5
+ <block type="interakt_app/display" name="chat_zopim_default">
6
+ <!-- <action method="setForceButtonDisplay"><value>1</value></action>-->
7
+ <!-- <action method="setForceBubbleDisplay"><value>1</value></action>-->
8
+ </block>
9
+ </reference>
10
+ </default>
11
+
12
+ <!-- Sample to disable the chat on the Index CMS page -->
13
+ <!--<cms_index_index>-->
14
+ <!--<remove name="chat_zopim_default"/>-->
15
+ <!--</cms_index_index>-->
16
+ </layout>
app/design/frontend/base/default/template/interakt_app/widget.phtml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script>
2
+ (function() {
3
+ var interakt = document.createElement('script');
4
+ interakt.type = 'text/javascript'; interakt.async = true;
5
+ interakt.src = "https://cdn.interakt.co/interakt/<?php echo $this->getId().'.js';?>"
6
+ var scrpt = document.getElementsByTagName('script')[0];
7
+ scrpt.parentNode.insertBefore(interakt, scrpt);
8
+ })()
9
+ </script>
10
+ <?php if($this->getCustomer())
11
+ {?>
12
+ <script>
13
+ window.mySettings = {
14
+ email: "<?php echo $this->getCustomer('email');?>",
15
+ name: "<?php echo $this->getCustomer('user_name');?>",
16
+ created_at: "<?php echo $this->getCustomer('created_at');?>",
17
+ app_id: '<?php echo $this->getId();?>'
18
+ };
19
+ </script>
20
+
21
+ <?php } ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Interakt_App</name>
4
- <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license>Massachusetts Institute of Technology License (MITL)</license>
7
  <channel>community</channel>
@@ -41,9 +41,9 @@ Route customer queries to our simplified helpdesk and collect valuable feedback
41
  &lt;/ol&gt;</description>
42
  <notes>For any queries, please contact support@interakt.co</notes>
43
  <authors><author><name>Peeyush Singhla</name><user>peeyush</user><email>peeyush@interakt.co</email></author></authors>
44
- <date>2016-01-21</date>
45
- <time>10:33:18</time>
46
- <contents><target name="magecommunity"><dir><dir name="Interakt"><dir name="App"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="ab44aad61b65b29bf8e7643d6f2cc57c"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="49d4d9414b044b21cadefb0130b02cd1"/></dir><dir name="Model"><file name="Observer.php" hash="4feb24532a5f1a421e27f33cac20ed0b"/><file name="SyncUserData.php" hash="914fa6ac2d8bd054ca4e725aee02ab28"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AppController.php" hash="caf8aec8403946617d218d28369ae8bc"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="1302c629c2abfc004cf2654b19082b7e"/><file name="config.xml" hash="51f4fa966cf64016113580fc6339d7f8"/><file name="system.xml" hash="d711a0961c143b132fe4e9a116d7eeaf"/></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="interakt_app"><file name="button.phtml" hash="dc55f6c225aa555ece20d044f9c406f0"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Interakt_App.xml" hash="c4bdf884ff2016bc6e319309f3b773ba"/></dir></dir></target></contents>
47
  <compatible/>
48
- <dependencies><required><php><min>5.3.0</min><max>5.6.4</max></php></required></dependencies>
49
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Interakt_App</name>
4
+ <version>1.0.6</version>
5
  <stability>stable</stability>
6
  <license>Massachusetts Institute of Technology License (MITL)</license>
7
  <channel>community</channel>
41
  &lt;/ol&gt;</description>
42
  <notes>For any queries, please contact support@interakt.co</notes>
43
  <authors><author><name>Peeyush Singhla</name><user>peeyush</user><email>peeyush@interakt.co</email></author></authors>
44
+ <date>2016-06-02</date>
45
+ <time>10:04:25</time>
46
+ <contents><target name="magecommunity"><dir><dir name="Interakt"><dir name="App"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="ab44aad61b65b29bf8e7643d6f2cc57c"/></dir></dir></dir></dir><file name="Display.php" hash="505ae01bd863b8b1097547acb7be15ef"/></dir><dir name="Helper"><file name="Data.php" hash="49d4d9414b044b21cadefb0130b02cd1"/></dir><dir name="Model"><file name="Observer.php" hash="73fddf01b8eadda66ed4fdab69dcc6e2"/><file name="SyncUserData.php" hash="c57900b640a12f04249f5d9ac31fd4c1"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AppController.php" hash="caf8aec8403946617d218d28369ae8bc"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="1302c629c2abfc004cf2654b19082b7e"/><file name="config.xml" hash="877cddb71695af98b9412adf00818bc0"/><file name="system.xml" hash="d711a0961c143b132fe4e9a116d7eeaf"/></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="interakt_app"><file name="button.phtml" hash="dc55f6c225aa555ece20d044f9c406f0"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="interakt_app.xml" hash="406da94d119db564e0e30528806abe8e"/></dir><dir name="template"><dir name="interakt_app"><file name="widget.phtml" hash="f532867d0e88f506085578f1b8a76ade"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Interakt_App.xml" hash="c4bdf884ff2016bc6e319309f3b773ba"/></dir></dir></target></contents>
47
  <compatible/>
48
+ <dependencies><required><php><min>5.3.0</min><max>5.6.19</max></php></required></dependencies>
49
  </package>