MailUp - Version 1.5.4

Version Notes

Changelog:


  • More bug fixes on configuration settings introduced by versions 1.5.x, please keep upgrading to the latest version of the module

  • Added messages on errors

Download this release

Release Info

Developer Sevenlike
Extension MailUp
Version 1.5.4
Comparing to
See all releases


Code changes from version 1.5.2 to 1.5.4

app/code/local/SevenLike/MailUp/Model/Observer.php CHANGED
@@ -102,16 +102,16 @@ class SevenLike_MailUp_Model_Observer
102
  ));
103
  $result = get_object_vars($result);
104
  $xml = simplexml_load_string($result['ReportByUserResult']);
105
-
106
  $stato_registrazione = (string)$xml->Canali->Email;
107
  if ($stato_registrazione) {
108
- if ($stato_registrazione == "Iscritto") {
109
- Mage::getModel('newsletter/subscriber')->loadByEmail($model->getEmail())->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)->save();
110
- } else {
111
- Mage::getModel('newsletter/subscriber')->loadByEmail($model->getEmail())->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)->save();
112
- }
113
  }
114
-
115
  return $this;
116
  }
117
 
@@ -122,7 +122,7 @@ class SevenLike_MailUp_Model_Observer
122
 
123
  $console = Mage::getStoreConfig('newsletter/mailup/url_console');
124
  $listId = Mage::getStoreConfig('newsletter/mailup/list');
125
-
126
  if(!class_exists(MailUpWsImport)) $MailUpWsImport = Mage::getModel('mailup/ws');
127
  $wsImport = new MailUpWsImport();
128
  $xmlString = $wsImport->GetNlList();
102
  ));
103
  $result = get_object_vars($result);
104
  $xml = simplexml_load_string($result['ReportByUserResult']);
105
+
106
  $stato_registrazione = (string)$xml->Canali->Email;
107
  if ($stato_registrazione) {
108
+ if ($stato_registrazione == "Iscritto") {
109
+ Mage::getModel('newsletter/subscriber')->loadByEmail($model->getEmail())->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)->save();
110
+ } else {
111
+ Mage::getModel('newsletter/subscriber')->loadByEmail($model->getEmail())->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)->save();
112
+ }
113
  }
114
+
115
  return $this;
116
  }
117
 
122
 
123
  $console = Mage::getStoreConfig('newsletter/mailup/url_console');
124
  $listId = Mage::getStoreConfig('newsletter/mailup/list');
125
+
126
  if(!class_exists(MailUpWsImport)) $MailUpWsImport = Mage::getModel('mailup/ws');
127
  $wsImport = new MailUpWsImport();
128
  $xmlString = $wsImport->GetNlList();
app/code/local/SevenLike/MailUp/Model/Wssend.php CHANGED
@@ -39,16 +39,20 @@ class MailUpWsSend {
39
  try {
40
  //login with webservice user
41
  $loginData = array ('user' => Mage::getStoreConfig('newsletter/mailup/username_ws'),
42
- 'pwd' => Mage::getStoreConfig('newsletter/mailup/password_ws'),
43
- 'consoleId' => substr(Mage::getStoreConfig('newsletter/mailup/username_ws'), 1));
44
 
45
  $result = get_object_vars($this->soapClient->LoginFromId($loginData));
46
  $xml = simplexml_load_string($result['LoginFromIdResult']);
 
 
47
  $errorCode = $xml->errorCode->__toString();
48
  $errorDescription = $xml->errorDescription->__toString();
49
  $accessKey = $xml->accessKey->__toString();
50
 
51
- if ($errorCode !== '0') {
 
 
52
  throw new Exception($errorDescription);
53
  }
54
 
@@ -61,7 +65,7 @@ class MailUpWsSend {
61
  Mage::log($e->getMessage(), 0);
62
  return false;
63
  }
64
- }
65
 
66
  public function GetFields($accessKey) {
67
  $fields = null;
@@ -69,10 +73,18 @@ class MailUpWsSend {
69
  try {
70
  $result = get_object_vars($this->soapClient->GetFields(array('accessKey' => $accessKey)));
71
  $xml = simplexml_load_string($result['GetFieldsResult']);
 
 
 
 
 
72
  $fields = $this->_parseGetFieldsXmlResponse($xml);
73
  } catch (SoapFault $soapFault) {
74
  Mage::log('SOAP error', 0);
75
  Mage::log($soapFault, 0);
 
 
 
76
  }
77
 
78
  return $fields;
@@ -81,15 +93,6 @@ class MailUpWsSend {
81
  private function _parseGetFieldsXmlResponse($xmlSimpleElement) {
82
  $fields = $this->_getFieldsDefaultConfiguration();
83
 
84
- //TODO: verificare condizione
85
- if ($xmlSimpleElement->Error) {
86
- Mage::log($xmlSimpleElement->Error, 0);
87
-
88
- //TODO: ritornare messaggio di errore ??
89
- return false;
90
- }
91
-
92
- //TODO: verificare condizione
93
  if ($xmlSimpleElement->Fields && sizeof($xmlSimpleElement->Fields->Field) > 0) {
94
  Mage::log('Fields returned, overwriting default configuration', 0);
95
  foreach ($xmlSimpleElement->Fields->Field as $fieldSimpleElement) {
39
  try {
40
  //login with webservice user
41
  $loginData = array ('user' => Mage::getStoreConfig('newsletter/mailup/username_ws'),
42
+ 'pwd' => Mage::getStoreConfig('newsletter/mailup/password_ws'),
43
+ 'consoleId' => substr(Mage::getStoreConfig('newsletter/mailup/username_ws'), 1));
44
 
45
  $result = get_object_vars($this->soapClient->LoginFromId($loginData));
46
  $xml = simplexml_load_string($result['LoginFromIdResult']);
47
+ Mage::log($xml, 0);
48
+
49
  $errorCode = $xml->errorCode->__toString();
50
  $errorDescription = $xml->errorDescription->__toString();
51
  $accessKey = $xml->accessKey->__toString();
52
 
53
+ if ($errorCode != 0) {
54
+ Mage::log($errorCode, 0);
55
+ Mage::log($errorDescription, 0);
56
  throw new Exception($errorDescription);
57
  }
58
 
65
  Mage::log($e->getMessage(), 0);
66
  return false;
67
  }
68
+ }
69
 
70
  public function GetFields($accessKey) {
71
  $fields = null;
73
  try {
74
  $result = get_object_vars($this->soapClient->GetFields(array('accessKey' => $accessKey)));
75
  $xml = simplexml_load_string($result['GetFieldsResult']);
76
+
77
+ if ($xml->Error) {
78
+ throw new Exception($xml->Error);
79
+ }
80
+
81
  $fields = $this->_parseGetFieldsXmlResponse($xml);
82
  } catch (SoapFault $soapFault) {
83
  Mage::log('SOAP error', 0);
84
  Mage::log($soapFault, 0);
85
+ } catch (Exception $e) {
86
+ Mage::log('Custom exception', 0);
87
+ Mage::log($e->getMessage(), 0);
88
  }
89
 
90
  return $fields;
93
  private function _parseGetFieldsXmlResponse($xmlSimpleElement) {
94
  $fields = $this->_getFieldsDefaultConfiguration();
95
 
 
 
 
 
 
 
 
 
 
96
  if ($xmlSimpleElement->Fields && sizeof($xmlSimpleElement->Fields->Field) > 0) {
97
  Mage::log('Fields returned, overwriting default configuration', 0);
98
  foreach ($xmlSimpleElement->Fields->Field as $fieldSimpleElement) {
app/code/local/SevenLike/MailUp/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
  <config>
4
  <modules>
5
  <SevenLike_MailUp>
6
- <version>1.5.2</version>
7
  </SevenLike_MailUp>
8
  </modules>
9
 
@@ -152,4 +152,4 @@
152
  </sevenlike_mailup>
153
  </jobs>
154
  </crontab>
155
- </config>
3
  <config>
4
  <modules>
5
  <SevenLike_MailUp>
6
+ <version>1.5.4</version>
7
  </SevenLike_MailUp>
8
  </modules>
9
 
152
  </sevenlike_mailup>
153
  </jobs>
154
  </crontab>
155
+ </config>
app/design/adminhtml/default/default/template/sevenlike/mailup/fieldsmapping.phtml CHANGED
@@ -15,6 +15,10 @@ if ($accessKey === false) {
15
  // campi che arrivano da mailup
16
  $wsFields = $wsSend->getFields($accessKey);
17
 
 
 
 
 
18
  //carico i mapping salvati
19
  $fields = $wsImport->getFieldsMapping();
20
  ?>
@@ -39,11 +43,13 @@ if ($accessKey === false) {
39
  <select name="<?php echo $magentofield ?>" id="sl_<?php echo $magentofield ?>">
40
  <option value=""></option>
41
  <?php
42
- foreach ($wsFields as $nome=>$id) {
43
- $selected = ($id == $fields[$magentofield]) ? "selected='selected'" : "";
44
- $nome = htmlspecialchars($nome);
45
- echo "<option value='$id' $selected>$nome</option>";
46
- }
 
 
47
  echo '</select>';
48
  ?>
49
  </div>
15
  // campi che arrivano da mailup
16
  $wsFields = $wsSend->getFields($accessKey);
17
 
18
+ if (! $wsFields) {
19
+ echo '<p>'.$this->__('ERROR: cannot read fields mapping').'</p>';
20
+ }
21
+
22
  //carico i mapping salvati
23
  $fields = $wsImport->getFieldsMapping();
24
  ?>
43
  <select name="<?php echo $magentofield ?>" id="sl_<?php echo $magentofield ?>">
44
  <option value=""></option>
45
  <?php
46
+ if ($wsFields) {
47
+ foreach ($wsFields as $nome=>$id) {
48
+ $selected = ($id == $fields[$magentofield]) ? "selected='selected'" : "";
49
+ $nome = htmlspecialchars($nome);
50
+ echo "<option value='$id' $selected>$nome</option>";
51
+ }
52
+ }
53
  echo '</select>';
54
  ?>
55
  </div>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MailUp</name>
4
- <version>1.5.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
7
  <channel>community</channel>
@@ -47,21 +47,13 @@
47
  &lt;p&gt;&lt;br /&gt;Ad esempio un sito di ecommerce potrebbe alimentare il DB di MailUp con informazioni sugli acquisti e MailUp potr&amp;agrave; quindi inviare, ad esempio dopo 7 giorni dall'acquisto, un messaggio di costumer satisfaction oppure l'invito ad acquistare un prodotto correlato.&lt;/p&gt;</description>
48
  <notes>Changelog:&lt;br /&gt;&#xD;
49
  &lt;ul&gt;&#xD;
50
- &lt;li&gt;"Send all fields to MailUp" configuration was removed&lt;/li&gt;&#xD;
51
- &lt;li&gt;"Web Service Username" configuration was added&lt;/li&gt;&#xD;
52
- &lt;li&gt;Magento&lt;-&gt;MailUp fields mapping feature was added&lt;/li&gt;&#xD;
53
- &lt;li&gt;Users' data uploading (to MailUp) process was rewritten for better performance&lt;/li&gt;&#xD;
54
- &lt;li&gt;When a customer logs in Magento his subscription preference is automatically downloaded from MailUp&lt;/li&gt;&#xD;
55
- &lt;li&gt;When a customer saves his Magento profile his subscription preference is automatically uploaded to MailUp&lt;/li&gt;&#xD;
56
- &lt;li&gt;Italian translation was completed&lt;/li&gt;&#xD;
57
- &lt;/ul&gt;&#xD;
58
- &#xD;
59
- &lt;br /&gt;&lt;br /&gt;&#xD;
60
- Note: you'll have to review your configuration right after updating the extension.</notes>
61
  <authors><author><name>Sevenlike</name><user>sevenlike</user><email>moduli-magento@sevenlike.com</email></author></authors>
62
- <date>2012-05-30</date>
63
- <time>2012-05-30</time>
64
- <contents><target name="magelocal"><dir name="SevenLike"><dir name="MailUp"><dir name="Block"><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Helper"><file name="Data.php" hash="a279a072c9df896abd5153789b500a5d"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Source"><dir name="Cron"><file name="Frequency.php" hash="57c892490ca67de41b2d5d4d043761b9"/><file name="Hours.php" hash="3f9ec0f1233b4468ed86b4eba050602e"/></dir></dir></dir></dir><file name="Cron.php" hash="bfcd480184d8c1f0553cdbcbb7015eb8"/><file name="Lists.php" hash="1032c009989f7050c271a16cb49f74df"/><file name="MailUp.php" hash="2829fb8a8ad6317ce5b2a28a2fe0149d"/><dir name="Mysql14"><dir name="MailUp"><file name="Collection.php" hash="1435c91e677f7b668079373599aae3eb"/></dir><file name="MailUp.php" hash="4e6e23f0eccdfe35776d1e8eab68692a"/></dir><file name="Observer.php" hash="82ca73b91d897659b03032d7a027f9da"/><dir name="System"><dir name="Source"><dir name="Cron"><file name="Frequency.php" hash="0a9ee4aacdcf270eb192f5b32e1e4a26"/><file name="Hours.php" hash="029b0d2d998c7e246333ee7bff64661a"/></dir></dir></dir><file name="Ws.php" hash="c6968947b0950b52f0fbeeddf347ad8c"/><file name="Wssend.php" hash="f8a8f80b3dfef268035f14f94541808c"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FieldsmappingController.php" hash="0e4ef6aca47bbbd1d1881ce02465a688"/><file name="FilterController.php" hash="732a732286d6679c90a49313a8ebb9c4"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="etc"><file name="config.xml" hash="d57cacd55c917769139fd1d2de4d62f2"/><file name="system.xml" hash="c9e10400e27057dacf2e3f9d18f6ed21"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="sql"><dir name="mailup_setup"><file name="mysql4-install-0.1.0.php" hash="46770fc0e2204faeba2b82c975fc6fb8"/><file name="mysql4-upgrade-0.1.0-1.0.0.php" hash="8fb23d8f3c3d38661aa50697f23e98c7"/><file name="mysql4-upgrade-0.3.0-1.0.0.php" hash="89080c835857a5dd135da5608a77ced1"/><file name="mysql4-upgrade-1.0.0-1.5.2.php" hash="d88d151e34f9ddba5bdc7d8c8cc21f97"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="sevenlike"><dir name="mailup"><file name="confirm.phtml" hash="b6e4af2eb21000d218648abc3b2f7caf"/><file name="fieldsmapping.phtml" hash="6d31a300cf8774c94219a38b95635486"/><file name="filter.phtml" hash="8450f9d52e895e9a5171f2b4b4e3bfde"/></dir></dir></dir><dir name="layout"><file name="mailup.xml" hash="37a171055aedfb552cb261dede1e0037"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SevenLike_MailUp.xml" hash="8377b55193e7524ca9572ed4dc2dca62"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sevenlike"><dir name="mailup"><dir name="images"><file name="titoli.png" hash="95a7996cd77d3413fd048018095aec6e"/></dir><file name="mailup.css" hash="37febcfd87a78148d5962da507c62ecc"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="SevenLike_MailUp.csv" hash="7388cfb49cf963f78f59c24633027f67"/></dir><dir name="it_IT"><file name="SevenLike_MailUp.csv" hash="53b451a3b28669f6bebfa8f39e391302"/></dir></target></contents>
65
  <compatible/>
66
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
67
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MailUp</name>
4
+ <version>1.5.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
7
  <channel>community</channel>
47
  &lt;p&gt;&lt;br /&gt;Ad esempio un sito di ecommerce potrebbe alimentare il DB di MailUp con informazioni sugli acquisti e MailUp potr&amp;agrave; quindi inviare, ad esempio dopo 7 giorni dall'acquisto, un messaggio di costumer satisfaction oppure l'invito ad acquistare un prodotto correlato.&lt;/p&gt;</description>
48
  <notes>Changelog:&lt;br /&gt;&#xD;
49
  &lt;ul&gt;&#xD;
50
+ &lt;li&gt;More bug fixes on configuration settings introduced by versions 1.5.x, please keep upgrading to the latest version of the module&lt;/li&gt;&#xD;
51
+ &lt;li&gt;Added messages on errors&lt;/li&gt;&#xD;
52
+ &lt;/ul&gt;</notes>
 
 
 
 
 
 
 
 
53
  <authors><author><name>Sevenlike</name><user>sevenlike</user><email>moduli-magento@sevenlike.com</email></author></authors>
54
+ <date>2012-05-31</date>
55
+ <time>2012-05-31</time>
56
+ <contents><target name="magelocal"><dir name="SevenLike"><dir name="MailUp"><dir name="Block"><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Helper"><file name="Data.php" hash="a279a072c9df896abd5153789b500a5d"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Source"><dir name="Cron"><file name="Frequency.php" hash="57c892490ca67de41b2d5d4d043761b9"/><file name="Hours.php" hash="3f9ec0f1233b4468ed86b4eba050602e"/></dir></dir></dir></dir><file name="Cron.php" hash="bfcd480184d8c1f0553cdbcbb7015eb8"/><file name="Lists.php" hash="1032c009989f7050c271a16cb49f74df"/><file name="MailUp.php" hash="2829fb8a8ad6317ce5b2a28a2fe0149d"/><dir name="Mysql14"><dir name="MailUp"><file name="Collection.php" hash="1435c91e677f7b668079373599aae3eb"/></dir><file name="MailUp.php" hash="4e6e23f0eccdfe35776d1e8eab68692a"/></dir><file name="Observer.php" hash="8882bcd505d163cd96c3e260494d7800"/><dir name="System"><dir name="Source"><dir name="Cron"><file name="Frequency.php" hash="0a9ee4aacdcf270eb192f5b32e1e4a26"/><file name="Hours.php" hash="029b0d2d998c7e246333ee7bff64661a"/></dir></dir></dir><file name="Ws.php" hash="c6968947b0950b52f0fbeeddf347ad8c"/><file name="Wssend.php" hash="839e7a597fe09e047f9150b5bf1608ec"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FieldsmappingController.php" hash="0e4ef6aca47bbbd1d1881ce02465a688"/><file name="FilterController.php" hash="732a732286d6679c90a49313a8ebb9c4"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="etc"><file name="config.xml" hash="20b103d8ccd54631f9768d0dccf9aa5e"/><file name="system.xml" hash="c9e10400e27057dacf2e3f9d18f6ed21"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="sql"><dir name="mailup_setup"><file name="mysql4-install-0.1.0.php" hash="46770fc0e2204faeba2b82c975fc6fb8"/><file name="mysql4-upgrade-0.1.0-1.0.0.php" hash="8fb23d8f3c3d38661aa50697f23e98c7"/><file name="mysql4-upgrade-0.3.0-1.0.0.php" hash="89080c835857a5dd135da5608a77ced1"/><file name="mysql4-upgrade-1.0.0-1.5.2.php" hash="d88d151e34f9ddba5bdc7d8c8cc21f97"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="sevenlike"><dir name="mailup"><file name="confirm.phtml" hash="b6e4af2eb21000d218648abc3b2f7caf"/><file name="fieldsmapping.phtml" hash="55931280c93fb67d63ef395309b8d5d9"/><file name="filter.phtml" hash="8450f9d52e895e9a5171f2b4b4e3bfde"/></dir></dir></dir><dir name="layout"><file name="mailup.xml" hash="37a171055aedfb552cb261dede1e0037"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SevenLike_MailUp.xml" hash="8377b55193e7524ca9572ed4dc2dca62"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sevenlike"><dir name="mailup"><dir name="images"><file name="titoli.png" hash="95a7996cd77d3413fd048018095aec6e"/></dir><file name="mailup.css" hash="37febcfd87a78148d5962da507c62ecc"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="SevenLike_MailUp.csv" hash="7388cfb49cf963f78f59c24633027f67"/></dir><dir name="it_IT"><file name="SevenLike_MailUp.csv" hash="53b451a3b28669f6bebfa8f39e391302"/></dir></target></contents>
57
  <compatible/>
58
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
59
  </package>