ajax_out_of_stock_notification - Version 1.0.2

Version Notes

Third Release.

Download this release

Release Info

Developer Bikash Kaushik
Extension ajax_out_of_stock_notification
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/Kaushik/Outofstock/Model/Observer.php CHANGED
@@ -19,7 +19,7 @@ class Kaushik_Outofstock_Model_Observer {
19
  $email = $data->getEmail();
20
  $outofstock_id = $data->getOutofstockId();
21
  try {
22
- $_customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getWebsite()->getId());
23
  $_customer->loadByEmail($email);
24
  $recepientName = $email;
25
  $recepientemail = $email;
@@ -40,6 +40,7 @@ class Kaushik_Outofstock_Model_Observer {
40
  $email_template->setSenderEmail($senderemail);
41
  $email_template->setSenderName($sendername);
42
  $email_template->send($recepientemail, $recepientName, $vars, $storeId);
 
43
 
44
  $deleteInfo = Mage::getModel('outofstock/outofstock');
45
  $deleteInfo->setOutofstockId($outofstock_id)->delete();
19
  $email = $data->getEmail();
20
  $outofstock_id = $data->getOutofstockId();
21
  try {
22
+ $_customer = Mage::getModel('customer/customer')->setWebsiteId(1);
23
  $_customer->loadByEmail($email);
24
  $recepientName = $email;
25
  $recepientemail = $email;
40
  $email_template->setSenderEmail($senderemail);
41
  $email_template->setSenderName($sendername);
42
  $email_template->send($recepientemail, $recepientName, $vars, $storeId);
43
+ $translate->setTranslateInline(true);
44
 
45
  $deleteInfo = Mage::getModel('outofstock/outofstock');
46
  $deleteInfo->setOutofstockId($outofstock_id)->delete();
app/code/community/Kaushik/Outofstock/controllers/IndexController.php CHANGED
@@ -67,7 +67,8 @@ class Kaushik_Outofstock_IndexController extends Mage_Core_Controller_Front_Acti
67
  $response['status'] = 'failure';
68
  }
69
  }
70
- echo json_encode($response);
 
71
  }
72
  }
73
 
@@ -78,7 +79,6 @@ class Kaushik_Outofstock_IndexController extends Mage_Core_Controller_Front_Acti
78
  $model = Mage::getModel('outofstock/outofstock')->getCollection();
79
  $model->addFieldToFilter('email', $data['email']);
80
  $model->addFieldToFilter('product_id', $data['product_id']);
81
- //print_r($model->getData());
82
  try {
83
  $model->walk('delete');
84
  $response['msg'] = 'Unsubscribed successfully.';
@@ -111,7 +111,8 @@ class Kaushik_Outofstock_IndexController extends Mage_Core_Controller_Front_Acti
111
  $response['msg'] = $e->getMessage();
112
  $response['status'] = 'failure';
113
  }
114
- echo json_encode($response);
 
115
  }
116
  }
117
 
67
  $response['status'] = 'failure';
68
  }
69
  }
70
+ $this->getResponse()->setHeader('Content-type', 'application/json',true);
71
+ $this->getResponse()->setBody(json_encode($response));
72
  }
73
  }
74
 
79
  $model = Mage::getModel('outofstock/outofstock')->getCollection();
80
  $model->addFieldToFilter('email', $data['email']);
81
  $model->addFieldToFilter('product_id', $data['product_id']);
 
82
  try {
83
  $model->walk('delete');
84
  $response['msg'] = 'Unsubscribed successfully.';
111
  $response['msg'] = $e->getMessage();
112
  $response['status'] = 'failure';
113
  }
114
+ $this->getResponse()->setHeader('Content-type', 'application/json',true);
115
+ $this->getResponse()->setBody(json_encode($response));
116
  }
117
  }
118
 
app/code/community/Kaushik/Outofstock/etc/config.xml CHANGED
@@ -9,7 +9,7 @@
9
  <config>
10
  <modules>
11
  <Kaushik_Outofstock>
12
- <version>1.0.1</version>
13
  </Kaushik_Outofstock>
14
  </modules>
15
  <frontend>
9
  <config>
10
  <modules>
11
  <Kaushik_Outofstock>
12
+ <version>1.0.2</version>
13
  </Kaushik_Outofstock>
14
  </modules>
15
  <frontend>
app/code/community/Kaushik/Outofstock/sql/outofstock_setup/{mysql4-install-1.0.1.php → mysql4-install-1.0.2.php} RENAMED
File without changes
app/design/frontend/base/default/template/outofstock/outofstock.phtml CHANGED
@@ -38,17 +38,16 @@
38
  var product_id = jQuery("#product_id").val();
39
  var postUrl = '<?php echo $this->getUrl() ?>outofstock/index/subscribe';
40
  jQuery.post(postUrl, {email:email,product_id:product_id}, function( data ) {
41
- var obj = jQuery.parseJSON(data);
42
- if(obj.status == "success") {
43
- jQuery( ".login-message" ).html('<ul class="messages"><li class="success-msg"><ul><li style="color:#14595c"><span>'+obj.msg+'</span></li></ul></li></ul>');
44
  jQuery( ".login-message" ).fadeIn();
45
  jQuery(".outofstock-notify").hide();
46
- } else if(obj.status == "failure"){
47
- jQuery( ".login-message" ).html('<ul class="messages"><li class="error-msg"><ul><li style="color:#14595c"><span>'+obj.msg+'</span></li></ul></li></ul>');
48
  jQuery( ".login-message" ).fadeIn();
49
  jQuery("#subscribe").removeClass('disabled');
50
- } else if(obj.status == "warning"){
51
- jQuery( ".login-message" ).html('<ul class="messages"><li class="error-msg"><ul><li style="color:#14595c"><span>'+obj.msg+'</span></li></ul></li></ul>');
52
  jQuery( ".login-message" ).fadeIn();
53
  jQuery("#subscribe").removeClass('disabled');
54
  }
@@ -58,4 +57,4 @@
58
  });
59
  });
60
  </script>
61
- <?php endif; ?>
38
  var product_id = jQuery("#product_id").val();
39
  var postUrl = '<?php echo $this->getUrl() ?>outofstock/index/subscribe';
40
  jQuery.post(postUrl, {email:email,product_id:product_id}, function( data ) {
41
+ if(data.status == "success") {
42
+ jQuery( ".login-message" ).html('<ul class="messages"><li class="success-msg"><ul><li style="color:#14595c"><span>'+data.msg+'</span></li></ul></li></ul>');
 
43
  jQuery( ".login-message" ).fadeIn();
44
  jQuery(".outofstock-notify").hide();
45
+ } else if(data.status == "failure"){
46
+ jQuery( ".login-message" ).html('<ul class="messages"><li class="error-msg"><ul><li style="color:#14595c"><span>'+data.msg+'</span></li></ul></li></ul>');
47
  jQuery( ".login-message" ).fadeIn();
48
  jQuery("#subscribe").removeClass('disabled');
49
+ } else if(data.status == "warning"){
50
+ jQuery( ".login-message" ).html('<ul class="messages"><li class="error-msg"><ul><li style="color:#14595c"><span>'+data.msg+'</span></li></ul></li></ul>');
51
  jQuery( ".login-message" ).fadeIn();
52
  jQuery("#subscribe").removeClass('disabled');
53
  }
57
  });
58
  });
59
  </script>
60
+ <?php endif; ?>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ajax_out_of_stock_notification</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/osl-3.0.php">Open Software License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>This extension allows both customers and guest to sign up for alerts once out of stock products are available.</summary>
10
- <description>This extension adds a Notify button into product detail page for out of stock products. By clicking on this button, registered members &amp;amp; guests can enter their email to receive notifications when products are in stock. When admin adds new inventory for a product and it becomes in stock, the system will send an email notification to customers who subscribed to that product. This extension helps store owners in inventory decision making about out of stock products based on subscriptions.</description>
11
- <notes>Second Release. Fixed email issue.</notes>
12
  <authors><author><name>Bikash Kaushik</name><user>bikashkaushik</user><email>bikashkaushik10@gmail.com</email></author></authors>
13
- <date>2017-01-18</date>
14
- <time>07:00:28</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Kaushik_Outofstock.xml" hash="fd1e66f8a5bead211c2ea44092facfce"/></dir></target><target name="magecommunity"><dir name="Kaushik"><dir name="Outofstock"><dir name="Block"><dir name="Adminhtml"><dir name="Outofstock"><file name="Grid.php" hash="0cb37482f3468997788e40fe60283717"/><dir name="Renderer"><file name="Customergroup.php" hash="6f61885eb9edf31d11bf63c377ef163b"/><file name="Productname.php" hash="075b88440a10ad72feb9feaa1cb02b3a"/><file name="Productsku.php" hash="055505ace7ea75e3af4eabc27a09192d"/></dir></dir><file name="Outofstock.php" hash="7da318da3c745ce52a0b136fdd3b2d1f"/></dir><file name="Outofstock.php" hash="61d61ac94f1effb50fa605a3b3ffc015"/></dir><dir name="Helper"><file name="Data.php" hash="300e095c1c92671fdc9b33b900f6f282"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Observer.php" hash="de5c63ffe094e4fc1941431b93bc366b"/></dir><dir name="Mysql4"><dir name="Outofstock"><file name="Collection.php" hash="c679943ae9ead796676f0b9cb5aeb708"/></dir><file name="Outofstock.php" hash="4d2a337d37c11b174d8652adf05c96f8"/></dir><file name="Observer.php" hash="a49dbe6e15adccb921d2a087edbcad8d"/><file name="Outofstock.php" hash="585524ff6b1de528db940ec27591f60d"/><file name="Status.php" hash="6aca3bcdebce0753f5853f5fe4b009ca"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="OutofstockController.php" hash="b1f10282d4ceaf5bd30e960a591c831a"/></dir><file name="IndexController.php" hash="8a860480ac5d9a03587a94b24a1fffc6"/></dir><dir name="etc"><file name="adminhtml.xml" hash="72760cb708ffcc195e12a75a40e94f16"/><file name="config.xml" hash="d753a06b9500cee54c55a98cf7d93bdf"/><file name="system.xml" hash="8e9b17fe5cedbbb222c345f0784454ec"/></dir><dir name="sql"><dir name="outofstock_setup"><file name="mysql4-install-1.0.1.php" hash="940075c23934ec1ff7f86b26b1dc908d"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="outofstock.xml" hash="8f11e51d42ac271810d0a891ec8a0bce"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="kaushik_outofstock.xml" hash="8d2c38a2d84647ee0822f8c1e762ad70"/></dir><dir name="template"><dir name="outofstock"><file name="mysubscription.phtml" hash="6c1cd3fd0eee3ca659876ffe0a2fb944"/><file name="outofstock.phtml" hash="8c5bbe2115f32f0e68ef064bc5e762fb"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="outofstock"><file name="instock.html" hash="2e2bc8eeea4c88fff55300605f0bce53"/><file name="subscribe.html" hash="59f04c27a8b6c25f675caed58778a99e"/><file name="unsubscribe.html" hash="a500cd1e6a8c238cf225dccae6b1c037"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.0.0</min><max>7.1.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ajax_out_of_stock_notification</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/osl-3.0.php">Open Software License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>This extension allows both customers and guest to sign up for alerts once out of stock products are available.</summary>
10
+ <description>This extension adds a Notify button into product detail page for out of stock products. By clicking on this button, registered members &amp; guests can enter their email to receive notifications when products are in stock. When admin adds new inventory for a product and it becomes in stock, the system will send an email notification to customers who subscribed to that product. This extension helps store owners in inventory decision making about out of stock products based on subscriptions.</description>
11
+ <notes>Third Release.</notes>
12
  <authors><author><name>Bikash Kaushik</name><user>bikashkaushik</user><email>bikashkaushik10@gmail.com</email></author></authors>
13
+ <date>2017-01-26</date>
14
+ <time>06:11:36</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Kaushik_Outofstock.xml" hash="fd1e66f8a5bead211c2ea44092facfce"/></dir></target><target name="magecommunity"><dir name="Kaushik"><dir name="Outofstock"><dir name="Block"><dir name="Adminhtml"><dir name="Outofstock"><file name="Grid.php" hash="0cb37482f3468997788e40fe60283717"/><dir name="Renderer"><file name="Customergroup.php" hash="6f61885eb9edf31d11bf63c377ef163b"/><file name="Productname.php" hash="075b88440a10ad72feb9feaa1cb02b3a"/><file name="Productsku.php" hash="055505ace7ea75e3af4eabc27a09192d"/></dir></dir><file name="Outofstock.php" hash="7da318da3c745ce52a0b136fdd3b2d1f"/></dir><file name="Outofstock.php" hash="61d61ac94f1effb50fa605a3b3ffc015"/></dir><dir name="Helper"><file name="Data.php" hash="300e095c1c92671fdc9b33b900f6f282"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Observer.php" hash="de5c63ffe094e4fc1941431b93bc366b"/></dir><dir name="Mysql4"><dir name="Outofstock"><file name="Collection.php" hash="c679943ae9ead796676f0b9cb5aeb708"/></dir><file name="Outofstock.php" hash="4d2a337d37c11b174d8652adf05c96f8"/></dir><file name="Observer.php" hash="aea8c394cc71ae80af46e530b3351945"/><file name="Outofstock.php" hash="585524ff6b1de528db940ec27591f60d"/><file name="Status.php" hash="6aca3bcdebce0753f5853f5fe4b009ca"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="OutofstockController.php" hash="b1f10282d4ceaf5bd30e960a591c831a"/></dir><file name="IndexController.php" hash="ac2c154c196d0dc9d33901c8e617ce06"/></dir><dir name="etc"><file name="adminhtml.xml" hash="72760cb708ffcc195e12a75a40e94f16"/><file name="config.xml" hash="1cf19ec9fe549ca68109a028e8d36a36"/><file name="system.xml" hash="8e9b17fe5cedbbb222c345f0784454ec"/></dir><dir name="sql"><dir name="outofstock_setup"><file name="mysql4-install-1.0.2.php" hash="940075c23934ec1ff7f86b26b1dc908d"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="outofstock.xml" hash="8f11e51d42ac271810d0a891ec8a0bce"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="kaushik_outofstock.xml" hash="8d2c38a2d84647ee0822f8c1e762ad70"/></dir><dir name="template"><dir name="outofstock"><file name="mysubscription.phtml" hash="6c1cd3fd0eee3ca659876ffe0a2fb944"/><file name="outofstock.phtml" hash="eef0abe9f456fd5435b3fcf0d083ac06"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="outofstock"><file name="instock.html" hash="2e2bc8eeea4c88fff55300605f0bce53"/><file name="subscribe.html" hash="59f04c27a8b6c25f675caed58778a99e"/><file name="unsubscribe.html" hash="a500cd1e6a8c238cf225dccae6b1c037"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.0.0</min><max>7.1.0</max></php></required></dependencies>
18
  </package>