2.2.1 Miimalist Newsletter Signup Box

Very simple to do, take note cs-cart developers, people dont want a messy

signup box on their homepage



Use the following code. just replace the whole subscribe.tpl in,



skins/your-skin/customer/addons/news and emails/blocks



itll give you the newsletter box as below, just email box and go button.

defaults to HTML and signs the user up to all your mailing lists






<br />
{* $Id: subscribe.tpl 10972 2010-10-21 13:58:18Z klerik $ *}<br />
<br />
{if $items}<br />
<form action="{""|fn_url}" method="post" name="subscribe_form"><br />
<input type="hidden" name="redirect_url" value="{$config.current_url}" /><br />
{foreach from=$items item=list name="mailing_lists"}<br />
	<div class="hidden"><br />
		<label for="mailing_list_{$block.block_id}{$list.list_id}"><br />
			<input id="mailing_list_{$block.block_id}{$list.list_id}" type="hidden" class="hidden" name="mailing_lists[{$list.list_id}]" value="1" />{$list.object}<br />
		</label><br />
	</div><br />
{/foreach}<br />
<div class="hidden"><br />
	<select name="newsletter_format" id="newsletter_format{$block.block_id}"><br />
		<input type="hidden" id="newsletter_format" name="newsletter_format" value="{$smarty.const.NEWSLETTER_FORMAT_HTML}"><br />
	</select><br />
</div><br />
{strip}<br />
<div class="form-field"><br />
	<label for="subscr_email{$block.block_id}" class="cm-required cm-email hidden">{$lang.email}</label><br />
	<input type="text" name="subscribe_email" id="subscr_email{$block.block_id}" size="20" value="{$lang.enter_email|escape:html}" class="input-text cm-hint" /><br />
	{include file="buttons/go.tpl" but_name="newsletters.add_subscriber" alt=$lang.go}<br />
</div><br />
{/strip}<br />
</form>
```<br />
<br />
To get a gift voucher balance box just copy the form from the gift voucher page<br />
and place iti to a html block<br />
<br />
```php
<form action="/"> <input id="id_verify_code" class="input-text cm-hint" name="verify_code" type="text" value="Enter code" /><input class="go-button" title="Go" alt="Go" src="/skins/basic/customer/images/icons/go.gif" type="image" /><input name="dispatch" type="hidden" value="gift_certificates.verify" /> </form>

I agree this is the way to go on the homepage.



Better make the change with a hook though so your change won't be overwritten in the next update.



Thanks for the code!

Is this a double opt in method? If it’s not then this will not pass many mailing laws in various countries now! :-(

[quote name=‘AmitP’ timestamp=‘1310472877’ post=‘117015’]

Is this a double opt in method? If it’s not then this will not pass many mailing laws in various countries now! :-(

[/quote]



If by double opt in you mean they have to confirm their email address then

you just have to setup aj auto responder that contains %ACTIVATION_LINK:



Then for each mailing list you setup choose this autoresponder.



Once a user signs up they will be set an email containing a link to

click to confirm their email address.



If they dont confirm their email address you will be unable to send

a newsletter using the newsletter addon, if when your making the

newsletter / email you just tick the mailing list boxes in the send to

section

Thank you… This codes are helpful… But what window will show when someone join in? Oh well, better try it myself… :)

Updated code for 2.2.2


```php

{if $items}




{*

{$lang.text_signup_for_subscriptions}

*}
{foreach from=$items item=list name="mailing_lists"}
{*
*}


{* {$list.object} *}
{$list.object}


{/foreach}
{*
*}



{* {$lang.txt_format}
{$lang.html_format} *}


{strip}

{$lang.email}

{include file="buttons/go.tpl" but_name="newsletters.add_subscriber" alt=$lang.go}

{/strip}

{/if}
```

Awesome! This is perfect thanks for sharing kogi and cs-cart-newbie!

@kogi, thanks for the update!!!



The gift certificate balance is a great idea too… that's changed in 2.2.2 as well it looks like:



I applied this fix to 2.2.3 and it works perfectly for the sidebar block, however, on the checkout, the default layout still shows - any idea why or how to resolve?

[quote name='StellarBytes' timestamp='1321161420' post='125857']

I applied this fix to 2.2.3 and it works perfectly for the sidebar block, however, on the checkout, the default layout still shows - any idea why or how to resolve?

[/quote]



Check out is controlled by a different file.



What do you want done?

I pinpointed the checkout version down to /skins/yourtheme/customer/addons/news_and_emails/hooks/checkout/checkout_steps.pre.tpl, however, making the necessary changes does nothing, here's what I am using:

```php

{* $Id$ *}



{if $page_mailing_lists}



{include file=“common_templates/subheader.tpl” title=$lang.mailing_lists}



{$lang.text_signup_for_subscriptions}





{foreach from=$items item=list name=“mailing_lists”}





{$list.object}





{/foreach}



{$lang.txt_format}
{$lang.html_format}


{strip}

{$lang.email}

{include file="buttons/go.tpl" but_name="newsletters.add_subscriber" alt=$lang.go}

{/strip}

{/if} ```

I know this 'hack' has no effect on this file and the changes are definitely taking effect as I edited the text after {$lang.text_signup_for_subscriptions} just to ensure I was definitely editing the correct file. Any idea why this doesn't work for the checkout? The newsletter sign-up box looks like it does as default, no change whatsoever.