Sign up for Magento Newsletter

I work with Magento, in which I need to require that if any client subscribes, he / she should be automatically subscribed to the newsletter.

For example, on the administrator’s site, if we edit the client, we will check the “Subscribe to newsletter?” Bulletin. I want this flag always checked.

Please help me.

+3
source share
2 answers

The easiest way is to change the template and replace the checkbox with 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 piece 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>

:

<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"  />
+4

: , , .

, , "Opt In" not "Opt Out" - , , , Magento , .

, "" , . , "Off" , .

+7

Source: https://habr.com/ru/post/1758884/


All Articles