NL2go_Sync - Version 1.2.0

Version Notes

Synchronize all customers to manage unsubscriptions.

Download this release

Release Info

Developer Magento Core Team
Extension NL2go_Sync
Version 1.2.0
Comparing to
See all releases


Code changes from version 1.1.0 to 1.2.0

app/code/local/NL2go/Sync/Model/Newsletter/Api/V2.php CHANGED
@@ -77,7 +77,7 @@ class Nl2go_Sync_Model_Newsletter_Api_V2 extends Mage_Api_Model_Resource_Abstrac
77
  * @param string $file
78
  * @return String
79
  */
80
- public function getSubscribers($for_last_hours=0) {
81
 
82
  $res = array();
83
 
@@ -85,7 +85,7 @@ class Nl2go_Sync_Model_Newsletter_Api_V2 extends Mage_Api_Model_Resource_Abstrac
85
 
86
  $subscriber = Mage::getModel('newsletter/subscriber');
87
 
88
- $customersList = $this->getCustomersList($for_last_hours);
89
 
90
  // get subscribers as registered customer
91
  foreach ($customersList as $k=>$v){
@@ -181,16 +181,17 @@ class Nl2go_Sync_Model_Newsletter_Api_V2 extends Mage_Api_Model_Resource_Abstrac
181
  *
182
  * @param int $hours
183
  */
184
- private function getCustomersList($hours){
185
  $resource = Mage::getSingleton('core/resource');
186
  /* Retrieve the read connection */
187
  $readConnection = $resource->getConnection('core_read');
188
 
189
  /* Retrieve our data for customers */
190
  if($hours==0){
191
- $query = "SELECT * FROM newsletter_subscriber ".
192
- " WHERE subscriber_status=".Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED.
193
- " AND customer_id!=0";
 
194
  } else {
195
  $query = "SELECT * FROM newsletter_subscriber ".
196
  " WHERE customer_id IN(".
77
  * @param string $file
78
  * @return String
79
  */
80
+ public function getSubscribers($for_last_hours=0, $subscribed_only = false) {
81
 
82
  $res = array();
83
 
85
 
86
  $subscriber = Mage::getModel('newsletter/subscriber');
87
 
88
+ $customersList = $this->getCustomersList($for_last_hours, $subscribed_only);
89
 
90
  // get subscribers as registered customer
91
  foreach ($customersList as $k=>$v){
181
  *
182
  * @param int $hours
183
  */
184
+ private function getCustomersList($hours, $subscribed_only){
185
  $resource = Mage::getSingleton('core/resource');
186
  /* Retrieve the read connection */
187
  $readConnection = $resource->getConnection('core_read');
188
 
189
  /* Retrieve our data for customers */
190
  if($hours==0){
191
+ $query = "SELECT * FROM newsletter_subscriber WHERE customer_id!=0";
192
+ if($subscribed_only) {
193
+ $query .= " AND subscriber_status=" . Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED;
194
+ }
195
  } else {
196
  $query = "SELECT * FROM newsletter_subscriber ".
197
  " WHERE customer_id IN(".
app/code/local/NL2go/Sync/etc/wsdl.xml CHANGED
@@ -57,6 +57,7 @@
57
  <message name="syncNewsletterGetSubscribersRequest">
58
  <part name="sessionId" type="xsd:string"/>
59
  <part name="for_hours" type="xsd:int"/>
 
60
  </message>
61
  <message name="syncNewsletterGetSubscribersResponse">
62
  <part name="result" type="typens:ArrayOfNewsletterSubscriberEntity"/>
57
  <message name="syncNewsletterGetSubscribersRequest">
58
  <part name="sessionId" type="xsd:string"/>
59
  <part name="for_hours" type="xsd:int"/>
60
+ <part name="subscribed_only" type="xsd:boolean"/>
61
  </message>
62
  <message name="syncNewsletterGetSubscribersResponse">
63
  <part name="result" type="typens:ArrayOfNewsletterSubscriberEntity"/>
package.xml CHANGED
@@ -1,9 +1,9 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>NL2go_Sync</name>
4
- <version>1.1.0</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>
@@ -15,11 +15,11 @@ On top you can easily retrieve all item data including description, price info,
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>Added support for 2- way synchronisation of unsubscribes over Magento accounts and the Newsletter2Go unsubscribe link</notes>
19
  <authors><author><name>Steffen</name><user>auto-converted</user><email>info@newsletter2go.de</email></author></authors>
20
- <date>2013-08-05</date>
21
- <time>15:59:44</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="1ab6a64a5b115839a1541e3763f89efe"/></dir><file name="Api.php" hash="0139d3b2ef2ed98a10b3d7a14b6f7959"/></dir></dir><dir name="etc"><file name="api.xml" hash="7e11289db23d52088f15c1654b35f3a8"/><file name="config.xml" hash="534eb47f4db745e8b5210c1dfb5ca40a"/><file name="wsdl.xml" hash="20bbaaea37e858a3f07f597f4fae41b2"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NL2go_Sync.xml" hash="93aca69e7ba45a5664e4bcd277aa775b"/></dir></target></contents>
23
  <compatible/>
24
  <dependencies/>
25
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>NL2go_Sync</name>
4
+ <version>1.2.0</version>
5
  <stability>stable</stability>
6
+ <license/>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Synchronizes your Magento newsletter subscribers, sales figures and shop items with Newsletter2Go.</summary>
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>Synchronize all customers to manage unsubscriptions.</notes>
19
  <authors><author><name>Steffen</name><user>auto-converted</user><email>info@newsletter2go.de</email></author></authors>
20
+ <date>2014-03-07</date>
21
+ <time>16:51:49</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="b31295a02abc2152c099257a2e318da1"/></dir><file name="Api.php" hash="0139d3b2ef2ed98a10b3d7a14b6f7959"/></dir></dir><dir name="etc"><file name="api.xml" hash="7e11289db23d52088f15c1654b35f3a8"/><file name="config.xml" hash="534eb47f4db745e8b5210c1dfb5ca40a"/><file name="wsdl.xml" hash="832c7c111c26ec94ee59ccdca064282c"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NL2go_Sync.xml" hash="93aca69e7ba45a5664e4bcd277aa775b"/></dir></target></contents>
23
  <compatible/>
24
  <dependencies/>
25
  </package>