NL2go_Sync - Version 1.0.3

Version Notes

Unsubscribes over Magento user accounts are being synchronized

Download this release

Release Info

Developer Newsletter2Go
Extension NL2go_Sync
Version 1.0.3
Comparing to
See all releases


Code changes from version 1.0.2 to 1.0.3

app/code/local/NL2go/Sync/Model/Newsletter/Api/V2.php CHANGED
@@ -49,6 +49,7 @@ class Nl2go_Sync_Model_Newsletter_Api_V2 extends Mage_Api_Model_Resource_Abstrac
49
 
50
  $res[] = array(
51
  "subscriber_id"=>$v["subscriber_id"],
 
52
  "store_id"=>$subscriber->getData("store_id"),
53
  "change_status_at"=>$subscriber->getData("change_status_at"),
54
  "subscriber_email"=>$subscriber->getData("subscriber_email"),
@@ -57,11 +58,12 @@ class Nl2go_Sync_Model_Newsletter_Api_V2 extends Mage_Api_Model_Resource_Abstrac
57
  "total_orders"=>$customerNumberOfOrders,
58
  "customer_info"=>$customerInfo
59
  );
60
- unset($customerTotals);
61
  if(method_exists($customer, "clearInstance"))
62
  $customer->clearInstance();
63
  if(method_exists($customerTotals, "clearInstance"))
64
  $customerTotals->clearInstance();
 
65
  }
66
 
67
  // get simple subscribers, as unregistered customers
@@ -71,6 +73,7 @@ class Nl2go_Sync_Model_Newsletter_Api_V2 extends Mage_Api_Model_Resource_Abstrac
71
  $subscriber->load($v["subscriber_id"]);
72
  $res[] = array(
73
  "subscriber_id"=>$v["subscriber_id"],
 
74
  "store_id"=>$subscriber->getData("store_id"),
75
  "change_status_at"=>$subscriber->getData("change_status_at"),
76
  "subscriber_email"=>$subscriber->getData("subscriber_email"),
@@ -96,15 +99,16 @@ class Nl2go_Sync_Model_Newsletter_Api_V2 extends Mage_Api_Model_Resource_Abstrac
96
  // get all subscribers
97
 
98
  $query = "SELECT * FROM newsletter_subscriber ".
99
- " WHERE subscriber_status=".Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED.
100
- " AND customer_id=0 AND (change_status_at IS NULL OR change_status_at BETWEEN TIMESTAMP(DATE_SUB(NOW(), INTERVAL ".$hours." HOUR)) AND TIMESTAMP(NOW()))";
 
101
 
102
  /* Execute the query and store the results in $results */
103
  $results = $readConnection->fetchAll($query);
104
 
105
  $res = array();
106
  foreach ($results as $k=>$v){
107
- $res[] = array("subscriber_id"=>$v["subscriber_id"]);
108
  }
109
  return $res;
110
  }
@@ -125,8 +129,10 @@ class Nl2go_Sync_Model_Newsletter_Api_V2 extends Mage_Api_Model_Resource_Abstrac
125
  " AND customer_id!=0";
126
  } else {
127
  $query = "SELECT * FROM newsletter_subscriber ".
128
- " WHERE subscriber_status=".Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED.
129
- " AND customer_id IN(".
 
 
130
  "SELECT entity_id FROM customer_entity ".
131
  " WHERE created_at BETWEEN TIMESTAMP(DATE_SUB(NOW(), INTERVAL ".$hours." HOUR)) AND TIMESTAMP(NOW()) OR ".
132
  " updated_at BETWEEN TIMESTAMP(DATE_SUB(NOW(), INTERVAL ".$hours." HOUR)) AND TIMESTAMP(NOW())".
@@ -138,7 +144,7 @@ class Nl2go_Sync_Model_Newsletter_Api_V2 extends Mage_Api_Model_Resource_Abstrac
138
 
139
  $res = array();
140
  foreach ($results as $k=>$v){
141
- $res[] = array("subscriber_id"=>$v["subscriber_id"], "customer_id"=>$v["customer_id"]);
142
  }
143
  return $res;
144
  }
49
 
50
  $res[] = array(
51
  "subscriber_id"=>$v["subscriber_id"],
52
+ "subscriber_status"=>$v["subscriber_status"],
53
  "store_id"=>$subscriber->getData("store_id"),
54
  "change_status_at"=>$subscriber->getData("change_status_at"),
55
  "subscriber_email"=>$subscriber->getData("subscriber_email"),
58
  "total_orders"=>$customerNumberOfOrders,
59
  "customer_info"=>$customerInfo
60
  );
61
+
62
  if(method_exists($customer, "clearInstance"))
63
  $customer->clearInstance();
64
  if(method_exists($customerTotals, "clearInstance"))
65
  $customerTotals->clearInstance();
66
+ unset($customerTotals);
67
  }
68
 
69
  // get simple subscribers, as unregistered customers
73
  $subscriber->load($v["subscriber_id"]);
74
  $res[] = array(
75
  "subscriber_id"=>$v["subscriber_id"],
76
+ "subscriber_status"=>$v["subscriber_status"],
77
  "store_id"=>$subscriber->getData("store_id"),
78
  "change_status_at"=>$subscriber->getData("change_status_at"),
79
  "subscriber_email"=>$subscriber->getData("subscriber_email"),
99
  // get all subscribers
100
 
101
  $query = "SELECT * FROM newsletter_subscriber ".
102
+ // " WHERE subscriber_status=".Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED.
103
+ // " AND customer_id=0 AND (change_status_at IS NULL OR change_status_at BETWEEN TIMESTAMP(DATE_SUB(NOW(), INTERVAL ".$hours." HOUR)) AND TIMESTAMP(NOW()))";
104
+ " WHERE customer_id=0 AND (change_status_at IS NULL OR change_status_at BETWEEN TIMESTAMP(DATE_SUB(NOW(), INTERVAL ".$hours." HOUR)) AND TIMESTAMP(NOW()))";
105
 
106
  /* Execute the query and store the results in $results */
107
  $results = $readConnection->fetchAll($query);
108
 
109
  $res = array();
110
  foreach ($results as $k=>$v){
111
+ $res[] = array("subscriber_id"=>$v["subscriber_id"], "subscriber_status"=>$v["subscriber_status"]);
112
  }
113
  return $res;
114
  }
129
  " AND customer_id!=0";
130
  } else {
131
  $query = "SELECT * FROM newsletter_subscriber ".
132
+ // " WHERE subscriber_status=".Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED.
133
+ // " AND customer_id IN(".
134
+ // Unsubscribes over Magento user accounts are being synchronized - changes
135
+ " WHERE customer_id IN(".
136
  "SELECT entity_id FROM customer_entity ".
137
  " WHERE created_at BETWEEN TIMESTAMP(DATE_SUB(NOW(), INTERVAL ".$hours." HOUR)) AND TIMESTAMP(NOW()) OR ".
138
  " updated_at BETWEEN TIMESTAMP(DATE_SUB(NOW(), INTERVAL ".$hours." HOUR)) AND TIMESTAMP(NOW())".
144
 
145
  $res = array();
146
  foreach ($results as $k=>$v){
147
+ $res[] = array("subscriber_id"=>$v["subscriber_id"], "subscriber_status"=>$v["subscriber_status"],"customer_id"=>$v["customer_id"]);
148
  }
149
  return $res;
150
  }
app/code/local/NL2go/Sync/etc/wsdl.xml CHANGED
@@ -34,6 +34,7 @@
34
  <complexType name="newsletterSubscriberEntity">
35
  <all>
36
  <element name="subscriber_id" type="xsd:int" minOccurs="0"/>
 
37
  <element name="store_id" type="xsd:int" minOccurs="0"/>
38
  <element name="change_status_at" type="xsd:string" minOccurs="0"/>
39
  <element name="subscriber_email" type="xsd:string" minOccurs="0"/>
34
  <complexType name="newsletterSubscriberEntity">
35
  <all>
36
  <element name="subscriber_id" type="xsd:int" minOccurs="0"/>
37
+ <element name="subscriber_status" type="xsd:int" minOccurs="0"/>
38
  <element name="store_id" type="xsd:int" minOccurs="0"/>
39
  <element name="change_status_at" type="xsd:string" minOccurs="0"/>
40
  <element name="subscriber_email" type="xsd:string" minOccurs="0"/>
package.xml CHANGED
@@ -1,19 +1,25 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>NL2go_Sync</name>
4
- <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Synchronizes your Magento newsletter subscribers, sales figures and shop items with Newsletter2Go.</summary>
10
  <description>&lt;h2&gt;Newsletter2Go Magento Extension&lt;/h2&gt;&#xD;
11
- &lt;p&gt;The Magento Extension for the &lt;a href=https://www.newsletter2go.de&gt;Newsletter2Go email marketing software&lt;/a&gt; automatically synchronizes all newsletter subscribers, including basic data like name and gender as well as the total amount of sales and average sale.</description>
12
- <notes>Added gender value to the returned customer object</notes>
13
- <authors><author><name>Steffen</name><user>auto-converted</user><email>info@newsletter2go.de</email></author></authors>
14
- <date>2013-04-11</date>
15
- <time>09:23:53</time>
16
- <contents><target name="magelocal"><dir name="NL2go"><dir name="Sync"><dir name="Model"><dir name="Newsletter"><dir name="Api"><file name="V2.php" hash="a2f2316b18daa6ec1ad4ad6acf7890d2"/></dir><file name="Api.php" hash="c26ea29af9b050074560193228047842"/></dir></dir><dir name="etc"><file name="api.xml" hash="f1d83f4b3ce370e72285745611ae9aee"/><file name="config.xml" hash="534eb47f4db745e8b5210c1dfb5ca40a"/><file name="wsdl.xml" hash="ca2b3e1b8b1d2d3cdcb6bebc76620b21"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NL2go_Sync.xml" hash="93aca69e7ba45a5664e4bcd277aa775b"/></dir></target></contents>
 
 
 
 
 
 
17
  <compatible/>
18
- <dependencies/>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>NL2go_Sync</name>
4
+ <version>1.0.3</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Synchronizes your Magento newsletter subscribers, sales figures and shop items with Newsletter2Go.</summary>
10
  <description>&lt;h2&gt;Newsletter2Go Magento Extension&lt;/h2&gt;&#xD;
11
+ &lt;p&gt;The Magento Extension for the &lt;a href=https://www.newsletter2go.de&gt;Newsletter2Go email marketing software&lt;/a&gt; automatically synchronizes all newsletter subscribers, including basic data like name and gender as well as the total amount of sales and average sale.&lt;br /&gt;&#xD;
12
+ On top you can easily retrieve all item data including description, price info, product images and product link just by inputting the item id in the Newsletter2Go software.&lt;/p&gt;&#xD;
13
+ &lt;hr&gt;&#xD;
14
+ &lt;h3&gt;How to use?&lt;/h3&gt;&#xD;
15
+ &lt;p&gt;Get the extension key on this site and install the Newsletter2Go Magento Extension in your Magento shop. &lt;br /&gt;&#xD;
16
+ Set up a new API user and insert the information under settings on the Newsletter2Go web site.&#xD;
17
+ &lt;/p&gt;</description>
18
+ <notes>Unsubscribes over Magento user accounts are being synchronized</notes>
19
+ <authors><author><name>Steffen</name><user>Newsletter2Go</user><email>info@newsletter2go.de</email></author></authors>
20
+ <date>2013-08-01</date>
21
+ <time>08:58:14</time>
22
+ <contents><target name="magelocal"><dir name="NL2go"><dir name="Sync"><dir name="Model"><dir name="Newsletter"><dir name="Api"><file name="V2.php" hash="2f07484c9730e0a7f77c14083fc7ec43"/></dir><file name="Api.php" hash="c26ea29af9b050074560193228047842"/></dir></dir><dir name="etc"><file name="api.xml" hash="f1d83f4b3ce370e72285745611ae9aee"/><file name="config.xml" hash="534eb47f4db745e8b5210c1dfb5ca40a"/><file name="wsdl.xml" hash="31e15e210a20be3dcbdbee7de454793e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NL2go_Sync.xml" hash="93aca69e7ba45a5664e4bcd277aa775b"/></dir></target></contents>
23
  <compatible/>
24
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
25
  </package>