Version Notes
Please mail to sandipansaha88@gmail.com if you notice any bug.
Download this release
Release Info
Developer | Sandipan Saha |
Extension | Sandipan_Unsubscribe |
Version | 1.0.0.1 |
Comparing to | |
See all releases |
Version 1.0.0.1
- app/code/community/Sandipan/Unsubscribe/Block/Unsubscribe.php +8 -0
- app/code/community/Sandipan/Unsubscribe/Block/Unsubscribeoverride.php +8 -0
- app/code/community/Sandipan/Unsubscribe/Helper/Data.php +6 -0
- app/code/community/Sandipan/Unsubscribe/controllers/IndexController.php +42 -0
- app/code/community/Sandipan/Unsubscribe/etc/config.xml +38 -0
- app/design/frontend/default/default/layout/unsubscribe.xml +17 -0
- app/design/frontend/default/default/template/unsubscribe/subscribe.phtml +51 -0
- app/design/frontend/default/default/template/unsubscribe/unsubscribe.phtml +20 -0
- app/etc/modules/Sandipan_Unsubscribe.xml +9 -0
- package.xml +18 -0
app/code/community/Sandipan/Unsubscribe/Block/Unsubscribe.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sandipan_Unsubscribe_Block_Unsubscribe extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
}
|
app/code/community/Sandipan/Unsubscribe/Block/Unsubscribeoverride.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sandipan_Unsubscribe_Block_Unsubscribeoverride extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function getUnsubscribeFormActionUrl()
|
5 |
+
{
|
6 |
+
return $this->getUrl("unsubscribe/index/unsubscribecus");
|
7 |
+
}
|
8 |
+
}
|
app/code/community/Sandipan/Unsubscribe/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Sandipan_Unsubscribe_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/community/Sandipan/Unsubscribe/controllers/IndexController.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sandipan_Unsubscribe_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
$this->loadLayout();
|
7 |
+
$this->renderLayout();
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Unsubscribe newsletter from frontend
|
12 |
+
*/
|
13 |
+
public function unsubscribecusAction()
|
14 |
+
{
|
15 |
+
$email = $this->getRequest()->getParam("email");
|
16 |
+
$subsModel = Mage::getModel("newsletter/subscriber");
|
17 |
+
$subscriber = $subsModel->loadByEmail($email);
|
18 |
+
|
19 |
+
$id = (int) $subscriber->getId();
|
20 |
+
$code = (string) $subscriber->getCode();
|
21 |
+
|
22 |
+
$session = Mage::getSingleton("core/session");
|
23 |
+
|
24 |
+
if ($id && $code) {
|
25 |
+
try {
|
26 |
+
Mage::getModel("newsletter/subscriber")->load($id)
|
27 |
+
->setCheckCode($code)
|
28 |
+
->unsubscribe();
|
29 |
+
$session->addSuccess($this->__("You have been unsubscribed."));
|
30 |
+
}
|
31 |
+
catch (Mage_Core_Exception $e) {
|
32 |
+
$session->addException($e, $e->getMessage());
|
33 |
+
}
|
34 |
+
catch (Exception $e) {
|
35 |
+
$session->addException($e, $this->__("There was a problem with the un-subscription."));
|
36 |
+
}
|
37 |
+
} else {
|
38 |
+
$session->addError($this->__('Invalid subscription ID.'));
|
39 |
+
}
|
40 |
+
$this->_redirectReferer();
|
41 |
+
}
|
42 |
+
}
|
app/code/community/Sandipan/Unsubscribe/etc/config.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sandipan_Unsubscribe>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Sandipan_Unsubscribe>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<unsubscribe>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Sandipan_Unsubscribe</module>
|
14 |
+
<frontName>unsubscribe</frontName>
|
15 |
+
</args>
|
16 |
+
</unsubscribe>
|
17 |
+
</routers>
|
18 |
+
<layout> <!-- New Section Added -->
|
19 |
+
<updates>
|
20 |
+
<unsubscribe>
|
21 |
+
<file>unsubscribe.xml</file> <!-- This is name of the layout file for this module -->
|
22 |
+
</unsubscribe>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<global>
|
27 |
+
<blocks>
|
28 |
+
<unsubscribe>
|
29 |
+
<class>Sandipan_Unsubscribe_Block</class>
|
30 |
+
</unsubscribe>
|
31 |
+
</blocks>
|
32 |
+
<helpers>
|
33 |
+
<unsubscribe>
|
34 |
+
<class>Sandipan_Unsubscribe_Helper</class>
|
35 |
+
</unsubscribe>
|
36 |
+
</helpers>
|
37 |
+
</global>
|
38 |
+
</config>
|
app/design/frontend/default/default/layout/unsubscribe.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<unsubscribe_index_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="unsubscribe/unsubscribe" name="unsubscribe" template="unsubscribe/unsubscribe.phtml" />
|
6 |
+
</reference>
|
7 |
+
</unsubscribe_index_index>
|
8 |
+
|
9 |
+
<default>
|
10 |
+
<reference name="left.newsletter">
|
11 |
+
<action method="setTemplate">
|
12 |
+
<template>unsubscribe/subscribe.phtml</template>
|
13 |
+
</action>
|
14 |
+
</reference>
|
15 |
+
</default>
|
16 |
+
|
17 |
+
</layout>
|
app/design/frontend/default/default/template/unsubscribe/subscribe.phtml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="block block-subscribe">
|
28 |
+
<div class="block-title">
|
29 |
+
<strong><span><?php echo $this->__('Newsletter') ?></span></strong>
|
30 |
+
</div>
|
31 |
+
<form action="<?php echo $this->getFormActionUrl() ?>" method="post" id="newsletter-validate-detail">
|
32 |
+
<div class="block-content">
|
33 |
+
<div class="form-subscribe-header"><?php echo $this->__('Sign up for our newsletter') ?></div>
|
34 |
+
<label for="newsletter"><?php echo $this->__('Sign Up for Our Newsletter:') ?></label>
|
35 |
+
<div class="input-box">
|
36 |
+
<input type="text" name="email" id="newsletter" title="<?php echo $this->__('Sign up for our newsletter') ?>" class="input-text required-entry validate-email" />
|
37 |
+
</div>
|
38 |
+
<div class="actions">
|
39 |
+
<button type="submit" title="<?php echo $this->__('Subscribe') ?>" class="button"><span><span><?php echo $this->__('Subscribe') ?></span></span></button>
|
40 |
+
</div>
|
41 |
+
<div class="unsubscribe" style="float:right;">
|
42 |
+
<a href="<?php echo Mage::getUrl('unsubscribe') ?>"><?php echo $this->__('Unsubscribe') ?></a>
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
</form>
|
46 |
+
<script type="text/javascript">
|
47 |
+
//<![CDATA[
|
48 |
+
var newsletterSubscriberFormDetail = new VarienForm('newsletter-validate-detail');
|
49 |
+
//]]>
|
50 |
+
</script>
|
51 |
+
</div>
|
app/design/frontend/default/default/template/unsubscribe/unsubscribe.phtml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $newsletterObj = new Sandipan_Unsubscribe_Block_Unsubscribeoverride(); ?>
|
2 |
+
<div class="newsletter-unsubscribe">
|
3 |
+
<div class="newsletter-unsubscribe-title"><?php echo $this->__('Submit your email id to unsubscribe newsletter') ?></div>
|
4 |
+
<form action="<?php echo $newsletterObj->getUnsubscribeFormActionUrl() ?>" method="post" name="unsubscribe-newsletter-validate" id="unsubscribe-newsletter-validate">
|
5 |
+
<div class="block-content">
|
6 |
+
<div class="input-box">
|
7 |
+
<input type="text" name="email" id="newsletter" title="<?php echo $this->__('Unsunscribe newsletter') ?>" class="input-text required-entry validate-email" />
|
8 |
+
</div>
|
9 |
+
<div class="actions">
|
10 |
+
<button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
|
11 |
+
</div>
|
12 |
+
</div>
|
13 |
+
</form>
|
14 |
+
|
15 |
+
<script type="text/javascript" language="javascript">
|
16 |
+
//<![CDATA[
|
17 |
+
var newsletterSubscriberFormDetail = new VarienForm("unsubscribe-newsletter-validate");
|
18 |
+
//]]>
|
19 |
+
</script>
|
20 |
+
</div>
|
app/etc/modules/Sandipan_Unsubscribe.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sandipan_Unsubscribe>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Sandipan_Unsubscribe>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Sandipan_Unsubscribe</name>
|
4 |
+
<version>1.0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Unsubscribe newsletter subscription</summary>
|
10 |
+
<description>User can unsubscribe newsletter subscription from front-end directly.</description>
|
11 |
+
<notes>Please mail to sandipansaha88@gmail.com if you notice any bug.</notes>
|
12 |
+
<authors><author><name>Sandipan Saha</name><user>sandipansaha</user><email>sandipansaha88@gmail.com</email></author></authors>
|
13 |
+
<date>2012-09-29</date>
|
14 |
+
<time>04:54:52</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Sandipan"><dir name="Unsubscribe"><dir name="Block"><file name="Unsubscribe.php" hash="4b2e66461018c8f2df19442b607cd10a"/><file name="Unsubscribeoverride.php" hash="a076748edbed089707f15c44f4c20843"/></dir><dir name="Helper"><file name="Data.php" hash="4ef51fb23adfb55ce1c6eb42b92ff18b"/></dir><dir name="controllers"><file name="IndexController.php" hash="2f05c85c64503c1bb6830f40db5de578"/></dir><dir name="etc"><file name="config.xml" hash="9e4d9bbe03284c9ea133a4c77b76dc0f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="unsubscribe.xml" hash="83cbcce3cfd705b0daa995f107ba93b7"/></dir><dir name="template"><dir name="unsubscribe"><file name="subscribe.phtml" hash="52c7766f564e41a3380a9ebc8cc16920"/><file name="unsubscribe.phtml" hash="28cf19e5a5676b46c3acbbb937ef97a9"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sandipan_Unsubscribe.xml" hash="208cbfc6dc9aacef76b960d72339548b"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.7</max></package></required></dependencies>
|
18 |
+
</package>
|