joeB
joeB

Reputation: 53

how to make the newsletter checkbox checked by default in prestashop?

I am using Prestashop and I want the newsletter checkbox to be checked by default. For that, I edited the file : Theme/myTemplate/authentification.tpl

I Changed the following lines from:

<div class="checkbox">
    <input type="checkbox" name="newsletter" id="newsletter" value="1" {if isset($smarty.post.newsletter) AND $smarty.post.newsletter == 1} checked="checked"{/if} />
    <label for="newsletter">{l s='Sign up for our newsletter!'}</label>
</div>

To:

<div class="checkbox">
    <input type="checkbox" name="newsletter" id="newsletter" value="1" {if isset($smarty.post.newsletter) AND $smarty.post.newsletter == 1} checked="checked"{/if} checked="checked" />
    <label for="newsletter">{l s='Sign up for our newsletter!'}</label>
</div>

but it's still not working.

Upvotes: 1

Views: 1751

Answers (1)

Florian Lemaitre
Florian Lemaitre

Reputation: 5748

Hi your approach is right and you could remove the condition which is useless now:

<div class="checkbox">
    <input type="checkbox" name="newsletter" id="newsletter" value="1" checked="checked" />
    <label for="newsletter">{l s='Sign up for our newsletter!'}</label>
</div>

Did you try clearing the cache in Backoffice > Advanced Parameters > Performance? Also on this page is the option Recompile templates if the files have been updated checked?


Also note that this practice is forbidden in certain country (France for example)


For One page checkout you need to do the same changes in /themes/your_theme/order-opc-new-account.tpl and /themes/your_theme/order-opc-new-account-advanced.tpl.

Upvotes: 1

Related Questions