So on my customer account registration form: domain.com/customer/account/create/
I would like to set the newsletter subscription checkbox, so it is already checked.
So I have looked in the register.phtml
code app/design/frontend/base/default/template/customer/form/register.phtml
and at lines 60 to 76 it has this code:
Added code to make registration box have the tick box automatically ticked
<?php
$checked = true;
if($this->getFormData()->getEmail()) {
if(!$this->getFormData()->getIsSubscribed()) {
$checked = true;
}
}
?>
and
<li class="control">
<div class="input-box">
/* added with the additional code above */
<input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed" checked="checked" class="checkbox" />
...
It looks as though this should do what I want but on my live site, it isn't working. I even took out the /* text */ as I thought this may have an effect but it had no effect.
Any suggestions are most welcome. Thank you.
Best Answer
Don't change any code in the base folder, since this contains Magento original files that will be used as a "backup" for your website. Also, if you update your Magento version, this "core" files will be replaced.
If you are using a custom theme, go to the folder:
If you don't have any installed theme, the folder should be:
Make the changes in one of these files and should work fine. Don't forget to undo all changes in the base folder that you made. Also, you may need to clear the cache to see the changes.