Interakt_App - Version 1.0.3

Version Notes

For any queries, please contact support@interakt.co

Download this release

Release Info

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


Code changes from version 1.0.2 to 1.0.3

app/code/community/Interakt/App/Model/SyncUserData.php CHANGED
@@ -39,23 +39,23 @@ class Interakt_App_Model_SyncUserData
39
  public function syncData($offset=1)
40
  {
41
  $customerData = mage::getResourceModel('customer/customer_collection')->addAttributeToSelect('firstname')
42
- ->addAttributeToSelect('lastname')
43
- ->addAttributeToSelect('email')->setPage($offset,30);
44
- foreach($customerData as $data)
45
- {
46
- $email=$data->getEmail();
47
- $createdAt=$data->getCreatedAt();
48
- $name=$data->getName();
49
- $this->user_data=array('email'=>$email,'name'=>$name,'created_at'=>$createdAt);
50
- $response=$this->sendData();
51
- if($response=='error')
52
  {
53
- return 'error';
 
 
 
 
 
 
 
 
 
54
  }
55
- $this->total_synced++;
56
- }
57
- unset($customerData);
58
- return $this->total_synced;
59
  }
60
  public function userCount()
61
  {
@@ -67,7 +67,7 @@ class Interakt_App_Model_SyncUserData
67
  $this->interakt_app_id=Mage::helper('interakt_app')->getAppId();
68
  $this->interakt_api_key=Mage::helper('interakt_app')->getApiKey();
69
  $this->user_data=json_encode($this->user_data);
70
- $url='http://4c6978af.ngrok.io/api/v1/members';
71
  $curl = curl_init();
72
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
73
  curl_setopt($curl, CURLOPT_POST, true);
39
  public function syncData($offset=1)
40
  {
41
  $customerData = mage::getResourceModel('customer/customer_collection')->addAttributeToSelect('firstname')
42
+ ->addAttributeToSelect('lastname')
43
+ ->addAttributeToSelect('email')->setPage($offset,30);
44
+ foreach($customerData as $data)
 
 
 
 
 
 
 
45
  {
46
+ $email=$data->getEmail();
47
+ $createdAt=$data->getCreatedAt();
48
+ $name=$data->getName();
49
+ $this->user_data=array('email'=>$email,'name'=>$name,'created_at'=>$createdAt);
50
+ $response=$this->sendData();
51
+ if(isset($response)&& $response['status']=='failure')
52
+ {
53
+ return 'error';
54
+ }
55
+ $this->total_synced++;
56
  }
57
+ unset($customerData);
58
+ return $this->total_synced;
 
 
59
  }
60
  public function userCount()
61
  {
67
  $this->interakt_app_id=Mage::helper('interakt_app')->getAppId();
68
  $this->interakt_api_key=Mage::helper('interakt_app')->getApiKey();
69
  $this->user_data=json_encode($this->user_data);
70
+ $url='http://api.interakt.co/api/v1/members';
71
  $curl = curl_init();
72
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
73
  curl_setopt($curl, CURLOPT_POST, true);
app/design/adminhtml/default/default/template/interakt_app/button.phtml ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
2
+
3
+ <script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.3.0/prototype.js"></script>
4
+ <script src="https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js"></script>
5
+ <script type="text/javascript">
6
+ ( function($) {
7
+ // we can now rely on $ within the safety of our "bodyguard" function
8
+ $(document).ready( function() {
9
+ var offset=0;
10
+ var totalUsers=0;
11
+ var syncUser=0;
12
+ var from=1;
13
+ var to=0;
14
+ $('#sync_btn').on('click',function(){
15
+ count();
16
+ })
17
+ function sync()
18
+ {
19
+ if(parseInt(syncUser)<parseInt(totalUsers))
20
+ {
21
+
22
+ new Ajax.Request("<?php echo $this->getUrl('interakt_app/adminhtml_app/syncdata');?>",{
23
+ method:'get',
24
+ parameters:"count="+count+"&offset="+offset,
25
+ onSuccess: function(transport){
26
+ if(transport.responseText)
27
+ {
28
+ if(transport.responseText=='error')
29
+ {
30
+ $('#total_users').html('Invalid app key or api key, please check your app key or api key, further you have any problem please <a href="mailto:support@interakt.co?Subject=Need help for Interakt Integration with WordPress site" target="_top">Drop us an Email');
31
+ }
32
+
33
+ else
34
+ {
35
+ to=from+29;
36
+ $('#total_users').text('Users synced from'+from+' to '+to);
37
+ from+=29;
38
+ offset=offset+29;
39
+ syncUser=syncUser+30;
40
+ sync();
41
+ }
42
+
43
+ }
44
+ }
45
+ });
46
+ }
47
+ else
48
+ {
49
+ $('#total_users').text('All data has been sent.');
50
+ }
51
+ }
52
+ function count() {
53
+ if(parseInt(syncUser)>=parseInt(totalUsers))
54
+ {
55
+ alert('Users already synced');
56
+ }
57
+ else if($('#interakt_app_settings_app_id').val()=="" || $('#interakt_app_settings_api_key').val()=="")
58
+ {
59
+ alert("Please insert app id and api key");
60
+ }
61
+ else
62
+ {
63
+ offset=1;
64
+ new Ajax.Request("<?php echo $this->getUrl('interakt_app/adminhtml_app/');?>",{
65
+ method:'get',
66
+ onSuccess: function(transport){
67
+ if (transport.responseText){
68
+ //alert(transport.responseText);
69
+ totalUsers=transport.responseText;
70
+ if(parseInt(totalUsers)==0)
71
+ {
72
+ alert("No users to send");
73
+ }
74
+ else
75
+ {
76
+ $('#interakt_app_settings').append('<span id="total_users" style="text-align:center;font-size:14px;">Total no. of users = '+totalUsers+'</br>Syncing User Data.</span>')
77
+ $('#row_interakt_app_settings_app_id').closest('table').before('<span style="text-align:center;font-size:20px;fon-weight:bold;">Please do not reload page, it will take some time, have patience.</span>');
78
+ sync();
79
+ }
80
+ }
81
+ }
82
+ });
83
+ }
84
+ }
85
+
86
+ } );
87
+ } ) ( jQuery );
88
+ </script>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Interakt_App</name>
4
- <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license>Massachusetts Institute of Technology License (MITL)</license>
7
  <channel>community</channel>
@@ -42,8 +42,8 @@ Route customer queries to our simplified helpdesk and collect valuable feedback
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>2015-11-20</date>
45
- <time>08:01:15</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="ba370bf6389e84d495ea28daaf5893e7"/><file name="SyncUserData.php" hash="30dff0ea6bd23da30e50884306ba1420"/></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=""/></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.3</version>
5
  <stability>stable</stability>
6
  <license>Massachusetts Institute of Technology License (MITL)</license>
7
  <channel>community</channel>
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>2015-11-20</date>
45
+ <time>10:42:24</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="ba370bf6389e84d495ea28daaf5893e7"/><file name="SyncUserData.php" hash="03501b434bf6fdb5eda154e85cc67df4"/></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="9c70663aeba6ddc9d7ab266dfb37b997"/></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>