ES_Newssubscribers - Version 1.2.2

Version Notes

Missing shopping cart rule and empty email problem fix

Download this release

Release Info

Developer Edvinas Stulpinas
Extension ES_Newssubscribers
Version 1.2.2
Comparing to
See all releases


Code changes from version 1.2.1 to 1.2.2

app/code/community/ES/Newssubscribers/Helper/Data.php CHANGED
@@ -2,5 +2,34 @@
2
 
3
  class ES_Newssubscribers_Helper_Data extends Mage_Core_Helper_Abstract
4
  {
5
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  }
2
 
3
  class ES_Newssubscribers_Helper_Data extends Mage_Core_Helper_Abstract
4
  {
5
+ public function ismobile() {
6
+ $is_mobile = '0';
7
+
8
+ if(preg_match('/(android|up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {
9
+ $is_mobile=1;
10
+ }
11
+
12
+ if((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml')>0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))) {
13
+ $is_mobile=1;
14
+ }
15
+
16
+ $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'],0,4));
17
+ $mobile_agents = array('w3c ','acs-','alav','alca','amoi','andr','audi','avan','benq','bird','blac','blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno','ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-','maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-','newt','noki','oper','palm','pana','pant','phil','play','port','prox','qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar','sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-','tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp','wapr','webc','winw','winw','xda','xda-');
18
+
19
+ if(in_array($mobile_ua,$mobile_agents)) {
20
+ $is_mobile=1;
21
+ }
22
+
23
+ if (isset($_SERVER['ALL_HTTP'])) {
24
+ if (strpos(strtolower($_SERVER['ALL_HTTP']),'OperaMini')>0) {
25
+ $is_mobile=1;
26
+ }
27
+ }
28
+
29
+ if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows')>0) {
30
+ $is_mobile=0;
31
+ }
32
+
33
+ return $is_mobile;
34
+ }
35
  }
app/code/community/ES/Newssubscribers/Model/Subscriber.php CHANGED
@@ -3,6 +3,8 @@
3
  class ES_Newssubscribers_Model_Subscriber extends Mage_Newsletter_Model_Subscriber
4
  {
5
 
 
 
6
  public function getCouponCode()
7
  {
8
  if (!Mage::getStoreConfig('newsletter/coupon/isactive'))
@@ -12,9 +14,18 @@ class ES_Newssubscribers_Model_Subscriber extends Mage_Newsletter_Model_Subscrib
12
  $model->load(Mage::getStoreConfig('newsletter/coupon/roleid'));
13
  $massGenerator = $model->getCouponMassGenerator();
14
  $session = Mage::getSingleton('core/session');
 
 
 
 
 
 
 
 
 
15
  try {
16
  $massGenerator->setData(array(
17
- 'rule_id' => Mage::getStoreConfig('newsletter/coupon/roleid'),
18
  'qty' => 1,
19
  'length' => Mage::getStoreConfig('newsletter/coupon/length'),
20
  'format' => Mage::getStoreConfig('newsletter/coupon/format'),
@@ -35,4 +46,6 @@ class ES_Newssubscribers_Model_Subscriber extends Mage_Newsletter_Model_Subscrib
35
 
36
  return $latestCuopon->getCode();
37
  }
 
 
38
  }
3
  class ES_Newssubscribers_Model_Subscriber extends Mage_Newsletter_Model_Subscriber
4
  {
5
 
6
+ const ERROR_SHOPPING_CARD_RULE_IS_MISSING = 'ERROR_SHOPPING_CARD_RULE_IS_MISSING';
7
+
8
  public function getCouponCode()
9
  {
10
  if (!Mage::getStoreConfig('newsletter/coupon/isactive'))
14
  $model->load(Mage::getStoreConfig('newsletter/coupon/roleid'));
15
  $massGenerator = $model->getCouponMassGenerator();
16
  $session = Mage::getSingleton('core/session');
17
+ $ruleId = Mage::getStoreConfig('newsletter/coupon/roleid');
18
+ if (!is_numeric($ruleId)) {
19
+ return self::ERROR_SHOPPING_CARD_RULE_IS_MISSING;
20
+ }
21
+ $rule = Mage::getModel('salesrule/rule')->load($ruleId);
22
+ if (!$rule->getId()) {
23
+ return self::ERROR_SHOPPING_CARD_RULE_IS_MISSING;
24
+ }
25
+
26
  try {
27
  $massGenerator->setData(array(
28
+ 'rule_id' => $ruleId,
29
  'qty' => 1,
30
  'length' => Mage::getStoreConfig('newsletter/coupon/length'),
31
  'format' => Mage::getStoreConfig('newsletter/coupon/format'),
46
 
47
  return $latestCuopon->getCode();
48
  }
49
+
50
+
51
  }
app/code/community/ES/Newssubscribers/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <ES_Newssubscribers>
5
- <version>1.2.1</version>
6
  </ES_Newssubscribers>
7
  </modules>
8
 
2
  <config>
3
  <modules>
4
  <ES_Newssubscribers>
5
+ <version>1.2.2</version>
6
  </ES_Newssubscribers>
7
  </modules>
8
 
app/design/frontend/base/default/template/newssubscribers/newssubscribers.phtml CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- if ($this->isActivePopUp()):
3
  ?>
4
  <script type="text/javascript">
5
  <?php if (is_numeric($this->getCookieLifeTime())): ?>
1
  <?php
2
+ if ($this->isActivePopUp() && !Mage::helper('newssubscribers')->isMobile()):
3
  ?>
4
  <script type="text/javascript">
5
  <?php if (is_numeric($this->getCookieLifeTime())): ?>
package.xml CHANGED
@@ -1,19 +1,19 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ES_Newssubscribers</name>
4
- <version>1.2.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/copyleft/gpl.html">GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Newsletter popup 1.2.1</summary>
10
- <description>Newsletter popup 1.2.1&#xD;
11
  </description>
12
- <notes>jQuery was updated to 1.11.2</notes>
13
  <authors><author><name>Edvinas Stulpinas</name><user>edas1</user><email>edvinas.stulpinas@gmail.com</email></author></authors>
14
- <date>2015-01-14</date>
15
- <time>21:55:12</time>
16
- <contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="ES"><dir name="Newssubscribers"><dir><dir name="Block"><dir name="Adminhtml"><dir name="Newsletter"><dir name="Subscriber"><file name="Grid.php" hash="88363f2d011ccd9efee7e7aeb9e3803c"/></dir></dir></dir><file name="Newssubscribers.php" hash="b57d8b949c64a9688bf658de1db9625e"/></dir><dir name="Helper"><file name="Data.php" hash="40940b806b7dcac3eb06444b6f3ed4bc"/></dir><dir name="Model"><file name="Observer.php" hash="149319770cbb2c47ff350a9100fd5e83"/><file name="Subscriber.php" hash="fb8068b841b6b62f4299a4e896542136"/><dir name="System"><dir name="Config"><file name="Coupon.php" hash="077e4cf6e7de7dba4578a85865f1b8a6"/><file name="Couponlist.php" hash="3370b1621319b9736d06c6c678e3c668"/><file name="Template.php" hash="6414318d0784777ddbf4900142b4404e"/></dir></dir></dir><dir name="controllers"><file name="SubscriberController.php" hash="668f5822c20f5cf129b66cb61d5ad602"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2c67ba525665b169b14dba98a72a2e1e"/><file name="config.xml" hash="d6165ef7f33097549e0b86f7927f4eb6"/><file name="system.xml" hash="68f1efa35d682581634f0549e1db05ad"/></dir><dir name="sql"><dir name="newssubscribers_setup"><file name="install-1.2.1.php" hash="c2cfb9319bed8a7a7608b8b1c996ab14"/></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="ES_Newssubscribers.xml" hash="540ad403b7a8de4da0885c2e35149aa0"/></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="newssubscribers.xml" hash="6359a1bb487c6d3e7a28babca23e2aef"/></dir><dir name="template"><dir name="newssubscribers"><file name="newssubscribers.phtml" hash="76493b5541a76c89b2b9d77957664014"/></dir></dir></dir></dir></dir></dir><dir name="locale"><dir name="en_US"><file name="ES_Newssubscribers.csv" hash="174347fbc1407fc3228baf592bc83d75"/></dir></dir></dir><dir name="js"><dir name="newssubscribers"><file name="jquery-1.11.2.min.js" hash="5790ead7ad3ba27397aedfa3d263b867"/><file name="script.js" hash="6caad1e77e345ce14e550700e067d7d7"/></dir></dir><dir name="skin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="style-newssubscribers.css" hash="35c71b2e5a336cf56cfc9f78f1c75bad"/></dir><dir name="images"><dir name="newssubscribers"><file name="esns_box_block1.png" hash="05baf7a905b6feefc25ffbfb517b285e"/><file name="esns_box_button.png" hash="d9f78b3d715a945be5e4aab7dfffbe25"/><file name="esns_box_close.png" hash="3775c6a77c257caca3ec3a21467121ca"/><file name="esns_box_close2.png" hash="4beddb3ce54d094057c444258e5c3c30"/><file name="esns_box_lines.png" hash="a74efb43c267534b40e29c9674b91423"/><file name="esns_dark2.png" hash="bf0b2d62fbdbabefc190fc72f0d0cd1a"/><file name="esns_input.png" hash="47b2be36d7fe662a4999162d5ddc7d1f"/><file name="esns_label.png" hash="e2044ca3aab12b3a8390ade6af05fb2b"/></dir></dir></dir></dir></dir></dir></target></contents>
17
  <compatible/>
18
- <dependencies><required><php><min>5.0.0</min><max>5.6.0</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ES_Newssubscribers</name>
4
+ <version>1.2.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/copyleft/gpl.html">GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Newsletter popup 1.2.3</summary>
10
+ <description>Newsletter popup 1.2.3&#xD;
11
  </description>
12
+ <notes>Missing shopping cart rule and empty email problem fix</notes>
13
  <authors><author><name>Edvinas Stulpinas</name><user>edas1</user><email>edvinas.stulpinas@gmail.com</email></author></authors>
14
+ <date>2015-04-20</date>
15
+ <time>07:14:48</time>
16
+ <contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="ES"><dir name="Newssubscribers"><dir><dir name="Block"><dir name="Adminhtml"><dir name="Newsletter"><dir name="Subscriber"><file name="Grid.php" hash="88363f2d011ccd9efee7e7aeb9e3803c"/></dir></dir></dir><file name="Newssubscribers.php" hash="b57d8b949c64a9688bf658de1db9625e"/></dir><dir name="Helper"><file name="Data.php" hash="f97b0cd986cc4286c99f9a96ed47b44a"/></dir><dir name="Model"><file name="Observer.php" hash="149319770cbb2c47ff350a9100fd5e83"/><file name="Subscriber.php" hash="bad29658b9cf9e903c5629a5acc9a827"/><dir name="System"><dir name="Config"><file name="Coupon.php" hash="077e4cf6e7de7dba4578a85865f1b8a6"/><file name="Couponlist.php" hash="3370b1621319b9736d06c6c678e3c668"/><file name="Template.php" hash="6414318d0784777ddbf4900142b4404e"/></dir></dir></dir><dir name="controllers"><file name="SubscriberController.php" hash="668f5822c20f5cf129b66cb61d5ad602"/></dir><dir name="etc"><file name="adminhtml.xml" hash="2c67ba525665b169b14dba98a72a2e1e"/><file name="config.xml" hash="be1e3387d48e1924e52b6f04c4b88392"/><file name="system.xml" hash="68f1efa35d682581634f0549e1db05ad"/></dir><dir name="sql"><dir name="newssubscribers_setup"><file name="install-1.2.1.php" hash="c2cfb9319bed8a7a7608b8b1c996ab14"/></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="ES_Newssubscribers.xml" hash="540ad403b7a8de4da0885c2e35149aa0"/></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="newssubscribers.xml" hash="6359a1bb487c6d3e7a28babca23e2aef"/></dir><dir name="template"><dir name="newssubscribers"><file name="newssubscribers.phtml" hash="8210da6b7bc59948d6e0c1631a03235b"/></dir></dir></dir></dir></dir></dir><dir name="locale"><dir name="en_US"><file name="ES_Newssubscribers.csv" hash="174347fbc1407fc3228baf592bc83d75"/></dir></dir></dir><dir name="js"><dir name="newssubscribers"><file name="jquery-1.11.2.min.js" hash="5790ead7ad3ba27397aedfa3d263b867"/><file name="script.js" hash="6caad1e77e345ce14e550700e067d7d7"/></dir></dir><dir name="skin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="style-newssubscribers.css" hash="35c71b2e5a336cf56cfc9f78f1c75bad"/></dir><dir name="images"><dir name="newssubscribers"><file name="esns_box_block1.png" hash="05baf7a905b6feefc25ffbfb517b285e"/><file name="esns_box_button.png" hash="d9f78b3d715a945be5e4aab7dfffbe25"/><file name="esns_box_close.png" hash="3775c6a77c257caca3ec3a21467121ca"/><file name="esns_box_close2.png" hash="4beddb3ce54d094057c444258e5c3c30"/><file name="esns_box_lines.png" hash="a74efb43c267534b40e29c9674b91423"/><file name="esns_dark2.png" hash="bf0b2d62fbdbabefc190fc72f0d0cd1a"/><file name="esns_input.png" hash="47b2be36d7fe662a4999162d5ddc7d1f"/><file name="esns_label.png" hash="e2044ca3aab12b3a8390ade6af05fb2b"/></dir></dir></dir></dir></dir></dir></target></contents>
17
  <compatible/>
18
+ <dependencies><required><php><min>5.0.0</min><max>5.7.9</max></php></required></dependencies>
19
  </package>