Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Changing redirect after newsletter subscription
 
mrgad
Member
 
Total Posts:  60
Joined:  2008-08-29
 

This question refers to the file:

app/code/core/Mage/Newsletter/controllers/SubscriberController.php

specifically line 70 (my line # might be off, but I think it’s 70):

$this->_redirectReferer();

-----

Here’s what I’m trying to do:

1.  Keep the Newsletter Subscription box as it is by default on my magento store (store.mydomain.com).  When user enters an email address, the line above causes a page refresh - and the rest of the code in this file causes a “Thank you” message to be displayed at the top.  This goal is already accomplished perfectly by the Magento code right out of the box.

2. I’d also like to add the following function:  I’d like to use the code found in the template file (subscribe.phtml) to post a sign-up for newsletter box on one of the main pages of my domain (http://www.mydomain.com).  A user can also sign up for the newsletter here, too.  I COULD create a separate database, and then merge the two lists together later (i.e. people who sign up for newsletter via main site, and people who sign up for newsletter via magento store part of site), but that is obviously not ideal.  Right now, if I don’t change the code in SubscriberController.php, the functionality WORKS, but the line above ($this->_redirectReferer();) causes the page not to refresh to the same page (i.e. the page on http://www.mydomain.com), but rather takes the user to the home page of store.mydomain.com.

So I need to edit the controller file so that if the user is on one of the magento pages, it keeps them right where they are and displays the thank you message, but if they’re on one of the mainsite pages, it displays the thank you page and keeps them there on the same page in the main site.

I can’t seem to figure this out with PHP.  Can someone please help?

THANK YOU!

- Mark

 
Magento Community Magento Community
Magento Community
Magento Community
 
Customy
Jr. Member
 
Avatar
Total Posts:  10
Joined:  2011-05-11
Czech Republic
 

Heres how to redirect user to specific page after subscription: http://www.customy.com/blog/redirect-to-specific-page-after-newsletter-subscription/

 
Magento Community Magento Community
Magento Community
Magento Community
 
Customy
Jr. Member
 
Avatar
Total Posts:  10
Joined:  2011-05-11
Czech Republic
 

Free extension: http://www.customy.com/newsletter-redirect.html

 
Magento Community Magento Community
Magento Community
Magento Community
 
hotextension
Jr. Member
 
Avatar
Total Posts:  17
Joined:  2008-07-15
 

Have a look at this extension http://hotextension.com/sendy-newsletter-integration-for-magento.html

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top