Auto-Subscribe on Register - How To

Last modified by bcelenza on Fri, June 25, 2010 09:49
Source|Old Revisions  

This article was written under the assumption that you are running at least version 1.1.6 of Magento, and that Varien hasn’t removed this functionality from the AccountController.php lines 204-206:

  1. if ($this->getRequest()->getParam('is_subscribed', false)) {
  2.   $customer->setIsSubscribed(1);
  3. }

If you would like to have your new users automatically subscribed to the default newsletter on register, the process is fairly simple.

The account controller looks for a request param called “is_subscribed.” If this value is set to 1 or true, it will subscribe the user. In order to set this param, all you need to do is find the following code in register.phtml:

  1. <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">

And change it to:

  1. <form action="<?php echo $this->getPostActionUrl() ?>is_subscribed/1/" method="post" id="form-validate">

Your users should now be automatically subscribed to the newsletter upon registration.




 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs