This is a simple mod so customers can see what information could be sent to them when they subscribe, and to keep an archive handy for them as well.
This mod will display newsletters SENT only, and limited to the recent 10 newsletters, but you can change it easily inside the script.
Step 1:
Create 3 language label variables:
lbl_newsarchive = News Archive
lbl_newsarchive_none = No Newsletters have been sent
lbl_newsarchive_published = Published
Step 2:
Create a file called
newsarchive.php and save it in your /customer directory, with the following code in it:
Code:
<?php
#
# $Id: newsarchive.php,v 1.0 2004/01/24 08:00:00 leon Exp $
# News Archive
#
require "./auth.php";
require $xcart_dir."/include/categories.php";
if($active_modules["Bestsellers"])
include "../modules/Bestsellers/bestsellers.php";
#
# Get Newsletters that have been sent and store it into $newsarchive array
#
$newsarchive = func_query("SELECT newsid, subject, body, send_date, status FROM $sql_tbl[newsletter] WHERE status='S' ORDER BY send_date DESC LIMIT 0, 10");
if (count($newsarchive) ==0) $newsarchive="";
$smarty->assign("newsarchive",$newsarchive);
$smarty->assign("main","newsarchive");
$smarty->display("customer/home.tpl");
?>
Note: Notice the
DESC LIMIT 0,10, this is where you limit the max amount of archived newsletters to display, you can fix the 10 to whatever number you like.
Step 3:
In your /skin1/common_templates.tpl file add this line:
Code:
{elseif $main eq "newsarchive"}
{include file="customer/newsarchive.tpl"}
Step 4:
In your /skin1/today_news.tpl file add this after {$lng.txt_today_news}:
Step 5:
Create a file under /skin1/customer named
newsarchive.tpl with the following code in it:
Code:
{* $Id: newsarchive.tpl,v 1.0 2004/01/24 08:00:00 leon Exp $ *}
{capture name=newsarchive}
{if $newsarchive}
{section name=num loop=$newsarchive}
<table width=100% border=0 cellspacing=0 cellpadding=2>
<tr>
<td>{$newsarchive[num].subject} [ {$lng.lbl_newsarchive_published}: {$newsarchive[num].send_date|date_format:$config.Appearance.date_format} ]</td>
</tr>
<tr>
<td>{$newsarchive[num].body}</td>
</tr>
</table>
<HR>
{/section}
{else}
{$lng.lbl_newsarchive_none}
{/if}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_newsarchive content=$smarty.capture.newsarchive extra="width=100%"}
Thats all, simple and directly let your customers see what kind of information you send out on your newsletters.