X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Simple Newsarchive for Customers (https://forum.x-cart.com/showthread.php?t=6190)

leon 01-24-2004 01:02 PM

Simple Newsarchive for Customers
 
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}:
Code:

{if $usertype eq "C"}


<center>[ {$lng.lbl_newsarchive} ]</center>
{/if}


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.

tcrescibene 06-07-2005 04:12 PM

Thanks
 
Leon,

Thanks for the info. Do you have this running anywhere so I can see it running?

DataViking 06-22-2005 05:14 AM

thank you, I will try it today

balinor 06-22-2005 05:23 AM

This is a very old post, so be careful implementing it into version 4.

DataViking 06-22-2005 03:50 PM

thank you I will

leon 06-24-2005 01:58 PM

Re: Thanks
 
Quote:

Originally Posted by tcrescibene
Leon,

Thanks for the info. Do you have this running anywhere so I can see it running?


Read my footer -> dmcigars.com


All times are GMT -8. The time now is 10:30 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.