Jump to content

How to automatically check the newsletter checkbox during registration


djhunlimited

Recommended Posts

During new user registration I would like for the newsletter checkbox to be checked, instead of the user having to manually check it to receive newsletters. This way the user will have to uncheck the box to not receive newsletters when registering a new account.

I think something needs added or changed in the authentication.tpl but I may be wrong. I will be grateful for any help Thanks.

Link to comment
Share on other sites

Change line 134 of authentication.tpl from:

<input type="checkbox" name="newsletter" id="newsletter" value="1" {if isset($smarty.post.newsletter) AND $smarty.post.newsletter == 1} checked="checked"{/if} />



to:

<input type="checkbox" name="newsletter" id="newsletter" value="1" {if !sizeof($errors) OR (sizeof($errors) AND $smarty.post.newsletter == 1)} checked="checked"{/if} />

Link to comment
Share on other sites

  • 1 month later...
  • 8 months later...
  • 1 month later...
  • 1 year later...
  • 1 month later...
  • 9 months later...

The code in "order-opc-new-account.tpl" is not the same, for me it looks like this:

<input type="checkbox" name="newsletter" id="newsletter" value="1" {if isset($guestInformations) && $guestInformations.newsletter}checked="checked"{/if} />

What should i change it to, to make the checkbox checked as standard?

Link to comment
Share on other sites

instead the {if isset($guestInformations) && $guestInformations.newsletter}checked="checked"{/if} use simple checked="checked"

You mean like this?

<input type="checkbox" name="newsletter" id="newsletter" value="1"checked="checked"{/if} />

Link to comment
Share on other sites

  • 4 months later...

The code today is as following

<input type="checkbox" name="newsletter" id="newsletter" value="1" {if isset($smarty.post.newsletter) && $smarty.post.newsletter == '1'}checked="checked"{/if} autocomplete="off"/>

What is autocomplete="off" ?

 

Should that be removed or stay as below?

<input type="checkbox" name="newsletter" id="newsletter" value="1" checked="checked" autocomplete="off" />
Edited by claybourg (see edit history)
Link to comment
Share on other sites

The autocomplete attribute specifies whether or not an input field should have autocomplete enabled.

 

Autocomplete allows the browser to predict the value. When a user starts to type in a field, the browser should display options to fill in the field, based on earlier typed values.
Link to comment
Share on other sites

  • 10 months later...
  • 2 months later...

This should work:

 

In the order-opc-new-account.tpl (or the account create template) just replace:

<input type="checkbox" name="newsletter" id="newsletter" value="1"{if isset($guestInformations) && isset($guestInformations.newsletter) && $guestInformations.newsletter} checked="checked"{/if}

with:

<input type="checkbox" name="newsletter" id="newsletter" value="1" checked="checked" autocomplete="off"/>
Edited by jsmit2 (see edit history)
Link to comment
Share on other sites

<div class="checkbox">
	<div class="checker" id="uniform-newsletter"><span><input type="checkbox" value="1" id="newsletter" name="newsletter"></span></div>
					<label for="newsletter">Inscrivez-vous à notre lettre d'information</label>
				</div>

this is the html code 

Link to comment
Share on other sites

<div class="checkbox">
	<div class="checker" id="uniform-newsletter"><span><input type="checkbox" value="1" id="newsletter" name="newsletter"></span></div>
					<label for="newsletter">Inscrivez-vous à notre lettre d'information</label>
				</div>

this is the html code 

 

Hmm. I recommend my javascript/jquery solution.

Link to comment
Share on other sites

  • 4 weeks later...
  • 10 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...