tags:

views:

103

answers:

2

Hello all!

I am working with Magento, in which I need to require that, if any customer signs up, he/she must be automatically be subscribed to the newsletter.

For instance, in the admin site, if we edit a customer, we get the newsletter checkbox for "Subscribed to Newsletter?". I want that check box to always be checked.

Please help me out.

+2  A: 

The simplest way would be to modify the template and substitute the checkbox with a hidden input which is always set to 1. You need to edit the file /app/design/frontend/your_interface/your_theme/template/customer/form/register.phtml.

Remove this chunk of code:

    <li>
        <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed" <?php if($this->getFormData()->getIsSubscribed()){ ?> checked="checked"<?php }elseif($this->getFormData()->getIsSubscribed == NULL){ ?> checked="checked"<?php }?> />
        <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
    </li>

And add your hidden input just after the other ones near the top of the form:

<input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
<input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
<input type="hidden" name="is_subscribed" value="1" id="is_subscribed"  />
silvo
Thanks silvo! but One thing I have done is ... I changed the controller's action...and made newsletter default subscribed
Richa
A: 

One small thing : Check this is legal in the territory you are deploying in.

For instance, several legislations insist marketing emails must default to 'Opt In' not 'Opt Out' - this is likely why Magento has the default set as is.

It is also accepted best practice not to try to 'trick' users into accidentally subscribing to things. It may be better to leave the option as 'Off' and use some other way to display a message to encourage users to subscribe.

JulesLt