TEM_EmailSignup - Version 0.2.0

Version Notes

Trigger Email Marketing provides a fully-integrated, sophisticated email sign-up program. Our FREE extension for both Community and Enterprise versions of Magento tracks your performance!

Download this release

Release Info

Developer Magento Core Team
Extension TEM_EmailSignup
Version 0.2.0
Comparing to
See all releases


Code changes from version 0.1.0 to 0.2.0

app/code/community/Tem/EmailSignup/Block/Confirmation.php CHANGED
@@ -28,9 +28,9 @@ class Tem_EmailSignup_Block_Confirmation extends Mage_Core_Block_Text {
28
  protected function _toHtml()
29
  {
30
  $session = Mage::getSingleton('core/session', array('name'=>'frontend'));
31
- $confirmmation = $session->getConfirmation(true);
32
  $tem = Mage::getModel('tem_emailsignup/tem');
33
- if (!$tem->isEnabled() || !$confirmmation) {
34
  return '';
35
  }
36
  $sentUrl = $tem->sentUrl('', false, true);
28
  protected function _toHtml()
29
  {
30
  $session = Mage::getSingleton('core/session', array('name'=>'frontend'));
31
+ $confirmation = $session->getConfirmation(true);
32
  $tem = Mage::getModel('tem_emailsignup/tem');
33
+ if (!$tem->isEnabled() || !$confirmation) {
34
  return '';
35
  }
36
  $sentUrl = $tem->sentUrl('', false, true);
app/code/community/Tem/EmailSignup/Controller/Router.php CHANGED
@@ -22,11 +22,17 @@ class Tem_EmailSignup_Controller_Router extends Mage_Core_Controller_Varien_Rout
22
  {
23
  public function confirmEmailSignup()
24
  {
 
 
 
 
25
  try {
26
  $session = Mage::getSingleton('core/session', array('name'=>'frontend'));
 
27
  $id = isset($_GET['id']) ? $_GET['id'] : false;
28
  $key = isset($_GET['key']) ? $_GET['key'] : false;
29
  $code = isset($_GET['code']) ? $_GET['code'] : false;
 
30
  if ($id && $key) {
31
  // load customer by id
32
  $customer = Mage::getModel('customer/customer')->load($id);
@@ -44,7 +50,29 @@ class Tem_EmailSignup_Controller_Router extends Mage_Core_Controller_Varien_Rout
44
  $session->setData('subscriber_email', $subscriber->getEmail());
45
  $session->setData('confirmation', true);
46
  }
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
  catch (Exception $e) {
50
  Mage::getSingleton('customer/session')->addError($e->getMessage());
22
  {
23
  public function confirmEmailSignup()
24
  {
25
+
26
+ if (preg_match('/success/i',str_replace('/','',$_SERVER['REQUEST_URI']))) {
27
+ return;
28
+ }
29
  try {
30
  $session = Mage::getSingleton('core/session', array('name'=>'frontend'));
31
+ $session->setData('confirmation', false);
32
  $id = isset($_GET['id']) ? $_GET['id'] : false;
33
  $key = isset($_GET['key']) ? $_GET['key'] : false;
34
  $code = isset($_GET['code']) ? $_GET['code'] : false;
35
+
36
  if ($id && $key) {
37
  // load customer by id
38
  $customer = Mage::getModel('customer/customer')->load($id);
50
  $session->setData('subscriber_email', $subscriber->getEmail());
51
  $session->setData('confirmation', true);
52
  }
53
+ } elseif (count($_POST) == 1 && isset($_POST['email'])) {
54
+ $email = $_POST['email'];
55
+ if (!Zend_Validate::is($email, 'EmailAddress')) {
56
+ return;
57
+ }
58
+ $customerSession = Mage::getSingleton('customer/session');
59
+ if (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG) != 1 && !$customerSession->isLoggedIn()) {
60
+ return;
61
+ }
62
+ $ownerId = Mage::getModel('customer/customer')
63
+ ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
64
+ ->loadByEmail($email)
65
+ ->getId();
66
+ if ($ownerId !== null && $ownerId != $customerSession->getId()) {
67
+ return;
68
+ }
69
+ $isConfirmNeed = (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG) == 1) ? true : false;
70
+ if ($isConfirmNeed) {
71
+ return;
72
+ }
73
+ $session->setData('subscriber_email', $email);
74
+ $session->setData('confirmation', true);
75
+ }
76
  }
77
  catch (Exception $e) {
78
  Mage::getSingleton('customer/session')->addError($e->getMessage());
app/code/community/Tem/EmailSignup/Model/Tem.php CHANGED
@@ -78,7 +78,7 @@ class Tem_EmailSignup_Model_Tem extends Varien_Object
78
  if ($customerSession->isLoggedIn()) {
79
  $customer = $customerSession->getCustomer();
80
  $customerInfo = array(
81
- 'e' => $customer->getEmail(),
82
  'f_first_name' => $customer->getFirstname(),
83
  'f_last_name' => $customer->getLastname()
84
  );
@@ -114,16 +114,19 @@ class Tem_EmailSignup_Model_Tem extends Varien_Object
114
  } else {
115
  $order = Mage::getModel('sales/order')->load($orderId);
116
  }
 
117
  $subtotal = $order->getSubtotal();
118
- $couponCode = $order->getCouponCode();
119
  } else {
 
120
  $subtotal = '';
121
  $couponCode = '';
122
  }
123
 
124
  $conversionParams = array(
125
- 'c_web' => $subtotal,
126
- 'c_codes' => $couponCode
 
127
  );
128
 
129
  return $conversionParams;
78
  if ($customerSession->isLoggedIn()) {
79
  $customer = $customerSession->getCustomer();
80
  $customerInfo = array(
81
+ 'e' => ($customerEmail != '') ? $customerEmail : $customer->getEmail(),
82
  'f_first_name' => $customer->getFirstname(),
83
  'f_last_name' => $customer->getLastname()
84
  );
114
  } else {
115
  $order = Mage::getModel('sales/order')->load($orderId);
116
  }
117
+ $customerEmail = $order->getCustomerEmail();
118
  $subtotal = $order->getSubtotal();
119
+ $couponCode = $order->getCouponCode();
120
  } else {
121
+ $customerEmail = '';
122
  $subtotal = '';
123
  $couponCode = '';
124
  }
125
 
126
  $conversionParams = array(
127
+ 'e' => $customerEmail,
128
+ 'c_web' => $subtotal,
129
+ 'c_codes' => $couponCode
130
  );
131
 
132
  return $conversionParams;
app/code/community/Tem/EmailSignup/etc/config.xml CHANGED
@@ -22,7 +22,7 @@
22
  <config>
23
  <modules>
24
  <Tem_EmailSignup>
25
- <version>1.0.6</version>
26
  </Tem_EmailSignup>
27
  </modules>
28
  <global>
22
  <config>
23
  <modules>
24
  <Tem_EmailSignup>
25
+ <version>0.2.0</version>
26
  </Tem_EmailSignup>
27
  </modules>
28
  <global>
app/design/frontend/enterprise/default/layout/tem_emailsignup.xml CHANGED
@@ -19,7 +19,12 @@
19
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
  */
21
  -->
22
- <layout version="0.1.0">
 
 
 
 
 
23
  <checkout_onepage_success>
24
  <reference name="before_body_end">
25
  <block type="tem_emailsignup/onepage" name="emailsignup" as="emailsignup" after="-" />
@@ -30,14 +35,4 @@
30
  <block type="tem_emailsignup/multishipping" name="emailsignup" as="emailsignup" after="-" />
31
  </reference>
32
  </checkout_multishipping_success>
33
- <customer_account>
34
- <reference name="before_body_end">
35
- <block type="tem_emailsignup/confirmation" name="emailsignup" as="emailsignup" after="-" />
36
- </reference>
37
- </customer_account>
38
- <customer_account_index>
39
- <reference name="before_body_end">
40
- <block type="tem_emailsignup/confirmation" name="emailsignup" as="emailsignup" after="-" />
41
- </reference>
42
- </customer_account_index>
43
  </layout>
19
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
  */
21
  -->
22
+ <layout version="0.1.0">
23
+ <default>
24
+ <reference name="before_body_end">
25
+ <block type="tem_emailsignup/confirmation" name="emailsignup" as="emailsignup" after="-" />
26
+ </reference>
27
+ </default>
28
  <checkout_onepage_success>
29
  <reference name="before_body_end">
30
  <block type="tem_emailsignup/onepage" name="emailsignup" as="emailsignup" after="-" />
35
  <block type="tem_emailsignup/multishipping" name="emailsignup" as="emailsignup" after="-" />
36
  </reference>
37
  </checkout_multishipping_success>
 
 
 
 
 
 
 
 
 
 
38
  </layout>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>TEM_EmailSignup</name>
4
- <version>0.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/afl-3.0.php">AFL 3.0</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Trigger Email Marketing provides a fully-integrated, sophisticated email sign-up program. Our FREE extension for both Community and Enterprise versions of Magento tracks your performance!</description>
11
  <notes>Trigger Email Marketing provides a fully-integrated, sophisticated email sign-up program. Our FREE extension for both Community and Enterprise versions of Magento tracks your performance!</notes>
12
  <authors><author><name>Trigger Emails</name><user>auto-converted</user><email>info@triggeremails.com</email></author></authors>
13
- <date>2011-01-28</date>
14
- <time>11:14:19</time>
15
- <contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="tem_emailsignup.xml" hash="66bb49cfb50126960350c8e02f44f4d5"/></dir></dir></dir><dir name="enterprise"><dir name="default"><dir name="layout"><file name="tem_emailsignup.xml" hash="0eebcef6599c85309d9eba5511414b29"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Tem_EmailSignup.xml" hash="2f2ff3777867fd83ef5835ee3894efaf"/></dir></target><target name="magecommunity"><dir name="Tem"><dir name="EmailSignup"><dir name="Block"><file name="Confirmation.php" hash="ec5969e68513b9d5461d9841d61a5999"/><file name="Multishipping.php" hash="1b2f843af6c9ebcec50ec336d621295b"/><file name="Onepage.php" hash="a946511d0347594dc1c12fe428b8c6ae"/><dir name="Multishipping"><file name="Success.php" hash="f22e190472b60df6123465f3a090219b"/></dir></dir><dir name="Controller"><file name="Router.php" hash="02075fcc950452878d4449477962088d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="498a4312b85738de47b232165b948847"/><file name="config.xml" hash="bb1c7468fc1db72b629105660895a9a3"/><file name="system.xml" hash="4230dae4e3d9a585ec2ab02acd87971a"/></dir><dir name="Helper"><file name="Data.php" hash="2a3f3d2c0c523c17ac98a334732737d3"/></dir><dir name="Model"><file name="Tem.php" hash="5f495318c3ee8723df5d7b76410d9708"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>TEM_EmailSignup</name>
4
+ <version>0.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/afl-3.0.php">AFL 3.0</license>
7
  <channel>community</channel>
10
  <description>Trigger Email Marketing provides a fully-integrated, sophisticated email sign-up program. Our FREE extension for both Community and Enterprise versions of Magento tracks your performance!</description>
11
  <notes>Trigger Email Marketing provides a fully-integrated, sophisticated email sign-up program. Our FREE extension for both Community and Enterprise versions of Magento tracks your performance!</notes>
12
  <authors><author><name>Trigger Emails</name><user>auto-converted</user><email>info@triggeremails.com</email></author></authors>
13
+ <date>2011-06-28</date>
14
+ <time>11:59:49</time>
15
+ <contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="tem_emailsignup.xml" hash="66bb49cfb50126960350c8e02f44f4d5"/></dir></dir></dir><dir name="enterprise"><dir name="default"><dir name="layout"><file name="tem_emailsignup.xml" hash="66bb49cfb50126960350c8e02f44f4d5"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Tem_EmailSignup.xml" hash="2f2ff3777867fd83ef5835ee3894efaf"/></dir></target><target name="magecommunity"><dir name="Tem"><dir name="EmailSignup"><dir name="Block"><file name="Confirmation.php" hash="07dc77ab09df117367295463bae82465"/><file name="Multishipping.php" hash="1b2f843af6c9ebcec50ec336d621295b"/><file name="Onepage.php" hash="a946511d0347594dc1c12fe428b8c6ae"/><dir name="Multishipping"><file name="Success.php" hash="f22e190472b60df6123465f3a090219b"/></dir></dir><dir name="Controller"><file name="Router.php" hash="cdc1e1428ed30d3c87b098e166f15da9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="498a4312b85738de47b232165b948847"/><file name="config.xml" hash="c6d4abe8e552674c37855f7044548117"/><file name="system.xml" hash="4230dae4e3d9a585ec2ab02acd87971a"/></dir><dir name="Helper"><file name="Data.php" hash="2a3f3d2c0c523c17ac98a334732737d3"/></dir><dir name="Model"><file name="Tem.php" hash="a05d50023dbdf10d53e8653ea199c25f"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>