How to redirect Magento newsletter subscriber to a landing page url
This article is in response to unanswered Magento Post, found at http://www.magentocommerce.com/boards/viewthread/178109/
Magento does a good job with their newsletter infrastructure, but just like their web app, it does require you to fine tune it to your specifications. One such fine tuning is the way the newsletter handles it’s subscribers, once they subscribe. Ideally, when the customer subscribes you would want them to keep shopping and not to read a form about newsletter policy.
1. A pop up would do the trick, but what if they have pop ups from being displayed.
2. A simple note saying, Thank you for your subscription. For more info on our Newsletter Policy please click here. Magento already has this feature but without the link being dispalyed.
3. Or redirect to a CMS page which shows special discounted products viewed only by new subscribers. Here you can place your newsletter policy in short format, so it’s not obtrusive, but yet is available if the subscriber wants to read.
Either of these methods require hacking in Magento Core files. I’ll show you Method 2 and 3.
Method 2.
A simple note saying, Thank you for your subscription. For more info on our Newsletter Policy please click here.Log into Magento Admin>CMS>Manage Pages>Add New Page
Create a Newsletter Policy CMS page, i.e. newsletter-promotions
Open SubscriberController.php file located in:
MagentoStore\App\Code\Core\Mage\Newsletter\controllers\
Change
$session->addSuccess($this->__('Thank you for your subscription'));
To
$session->addSuccess($this->__('Thank you for your subscription. For more info on our Newsletter Policy, please click <a href="newsletter-promotions" target="_self">here</a>.'));
It would be a good idea to also do the same for; Please enter a valid email address; Confirmation request has been sent; and There was a problem with the subscription, messages.
Method 3.
Redirect to a special page of discounted products vieable only by subscribers, which contains the newsletter policy.Magento Admin>Catalog>Manage Products>Add New Product
Create new special discounted products, with Visibilty attribute set to, Nowhere. Make a note of the product ID.
Magento Admin>CMS>Manage Pages>Add New Page
Create a Newsletter Policy CMS page, i.e. newsletter-policy-and-promotions. In this page you can add your special products you created for your new subscribers. (This is not covered in the scope of this, How To)
Change at approx line 65:
$this->_redirectReferer();
To
$this->_redirectUrl(Mage::getBaseUrl().'newsletter-policy-and-promotions');
Change at approx line 92:
$this->_redirectUrl(Mage::getBaseUrl());
To
$this->_redirectUrl(Mage::getBaseUrl().'newsletter-policy-and-promotions');
Now the subscriber will automatically be redirected to your new page, and the, "Thank you for your subscription" message will still be displayed.
Hope this helps you.


















" How to redirect Magento newsletter url "
Thanks a lot, it works in magento enterprise 1.9.
$this->_redirectReferer();
to
$this->_redirectUrl(Mage::getBaseUrl().’newsletter-policy-and-promotions’);
also
$this->_redirectUrl(Mage::getBaseUrl().’newsletter-policy-and-promotions’);
$this->_redirectUrl(Mage::getBaseUrl());
to
$this->_redirectUrl(Mage::getBaseUrl());
" How to redirect Magento newsletter url "
Thanks a lot, it works in magento enterprise 1.9.
$this->_redirectReferer();
to
$this->_redirectUrl(Mage::getBaseUrl().’newsletter-policy-and-promotions’);
also
$this->_redirectUrl(Mage::getBaseUrl());
to
$this->_redirectUrl(Mage::getBaseUrl().’newsletter-policy-and-promotions’);
" How to redirect Magento newsletter url "
Custom Magento Themes Based on an Existing Design.If you already have a starting point for your Magento theme design and need it implemented or improved on then we’re here for you.
" How to redirect Magento newsletter url "
thankyou for the read I loved it.
I really like the layout of your site.
I have bookmarked. thanks
" How to redirect Magento newsletter url "
Great post. I’ll add one more option, which is somewhat similar to Method 3 above. You can redirect to a CMS page (or another page outside magento) by using Magento events. There are two things you have to do.
First define the event in your module’s config.xml file. Something like this…
singleton
yourmodule/observer
redirectNewsletterSuccess
singleton
yourmodule/observer
redirectNewsletterConfirm
Then create a new class in app/code/local/Yournamespace/Yourmodule/Model/Observer.php…
class Yournamespace_Yourmodule_Model_Observer {
public function redirectNewsletterSuccess ($observer){
Mage::app()->getResponse()->setRedirect(Mage::getBaseUrl().”newsletter-thanks.html”);
}
public function redirectNewsletterConfirm($observer) {
Mage::app()->getResponse()->setRedirect(Mage::getBaseUrl().”newsletter-confirmed.html”);
}
}
(This assumes that you have two CMS pages with ids “newsletter-success.html” and “newsletter-confirmed.html”)
The main advantage of this over Method 3 is that it doesn’t require a controller override, and is potentially more safe for upgrades. One downside is that you might not get the special error/success messages displayed on the cms, depending on your theme.
" How to redirect Magento newsletter url "
Woops looks like Wordpress stripped out a bunch of the xml tags I pasted in… I’ll try one more time.
<frontend>
<events>
<controller_action_postdispatch_newsletter_subscriber_new>
<observers>
<newsletter_subscribe_observer>
<type>singleton</type>
<class>yourmodule/observer</class>
<method>redirectNewsletterSuccess</method>
</newsletter_subscribe_observer>
</observers>
</controller_action_postdispatch_newsletter_subscriber_new>
<controller_action_postdispatch_newsletter_subscriber_confirm>
<observers>
<newsletter_subscribe_observer>
<type>singleton</type>
<class>yourmodule/observer</class>
<method>redirectNewsletterConfirm</method>
</newsletter_subscribe_observer>
</observers>
</controller_action_postdispatch_newsletter_subscriber_confirm>
</events>
</frontend>
" How to redirect Magento newsletter url "
These are great tips. Find your post very informative. Thanks a lot!
" How to redirect Magento newsletter url "
I got it worked with this very simple solution, you just have to change the confirmation message:
$status = Mage::getModel(’newsletter/subscriber’)->subscribe($email);
if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) {
$session->addSuccess($this->__(’Confirmation request has been sent.’));
}
else {
$session->addSuccess($this->__(’Thank you for your subscription.’));
}
TO
$status = Mage::getModel(’newsletter/subscriber’)->subscribe($email);
if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) {
$session->addSuccess($this->__(’location = “/newsletter-subscribe(or whatever page you wanted”;’));
}
else {
$session->addSuccess($this->__(’location = “/newsletter-subscribe”;’));
}