1) First create a file called "on_sale.php" --> customer/on_sale.php:
Code:
<?
#
# $Id: on_sale.php,v 1.14.2.2 2004/02/05 12:29:22 mclap Exp $
#
require "../smarty.php";
require "../config.php";
@include "./https.php";
require "./auth.php";
require "../include/categories.php";
require "./sales_items.php";
#
# Assign Smarty variables and show template
#
$tmp = strstr($QUERY_STRING, "$XCART_SESSION_NAME=");
if (!empty($tmp))
$QUERY_STRING = ereg_replace("([&]*)$XCART_SESSION_NAME=([0-9a-zA-Z]*)([&]*)", "", $QUERY_STRING);
if ( !defined('XCART_SESSION_START') ) { header("Location: home.php"); die("Access denied"); }
if ($new)
$smarty->assign("sales",mainsales);
$smarty->display("customer/sales.tpl");
?>
2) The create a file called "sales_items.php" ---> customer/sales_items.php:
Code:
<?
// the database query
$query = "SELECT * FROM $sql_tbl[products],$sql_tbl[pricing] WHERE forsale='Y' AND avail>0 AND $sql_tbl[products].list_price - $sql_tbl[pricing].price > 20 ORDER BY xcart_products.productID DESC LIMIT 0,6 ";
// give the product array to smarty to make it available sitewide.
$salesproducts = func_query($query);
$smarty->assign("salesproducts",$salesproducts);
?>
PLEASE NOTE IN: "$sql_tbl[products].list_price - $sql_tbl[pricing].price > 20" THAT 20 can be any number you choose!!!
3) Now go to "skin1/customer" and create the following 3 files:
- #new_sales.tpl#
Code:
{capture name=dialog}
{if $salesproducts ne ""}
{include file="customer/onsale.tpl" products=$salesproducts}
{else}
{$lng.txt_sales_items}
{/if}
{/capture}
{include file="dialog.tpl" title=$lng.lbl_sales_items content=$smarty.capture.dialog extra="width=100%"}
- #on_sale.tpl#
Code:
{* $Id: onsale.tpl,v 1.2 2003/04/24 09:50:33 svowl Exp $ *}
<center><table border=0 width="100%"><tr><td>
<center><table border=0 width=100%>
{section name=product loop=$products}
{if $smarty.section.product.index is div by 2}
</tr><tr valign="top">
{/if}
<td valign="top"width=350>
<center><table border=0 width=100%><tr>
<td width=150 align=center valign=top><a href=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}>{include file="product_thumbnail.tpl" productid=$products[product].productid product=$products[product].product}
{$products[product].param02}
</td>
<td valign=top width=200>
{$products[product].product|escape}</font>
<font size=1>{$products[product].descr|truncate:80:"...":true}</font>
<hr size=1 noshade width=130 align=left>
{if $active_modules.Subscriptions ne "" and $products[product].catalogprice}
{include file="modules/Subscriptions/subscription_info_inlist.tpl"}
{else}
{if $products[product].price ne 0}
{if $products[product].discount ne 0}
<font class=MarketPrice>{$lng.lbl_market_price}: <s>{math equation="(price/(100-discount))*100" price=$products[product].price discount=$products[product].discount format="%d.00" assign=unformatted}{include file="currency.tpl" value=$unformatted}</s></font>
{/if}
<font class=TableCenterProductTitleOrange>
{include file="currency.tpl" value=$products[product].price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].price}</font>{if $products[product].discount ne 0}, save {$products[product].discount}%{/if}
{else}
<font class=TableCenterProductTitleOrange>{$lng.lbl_enter_your_price}</font>
{/if}
{/if}
</td></tr>
</table>
</center>
</td>
{/section}
</td></tr></table></center>
</td></tr></table> </center>
And finally:
- #sales.tpl#
Code:
{* $Id: sales.tpl,v 1.3 2003/04/09 10:13:30 olga Exp $ *}
{ config_load file="$skin_config" }
<html>
<head>
<title>
Uppity Footwear - On Sale!!!!</title>
{ include file="meta.tpl" }
<link rel="stylesheet" href="{$SkinDir}/{#CSSFile#}">
</head>
<body LEFTMARGIN=0 TOPMARGIN=0 RIGHTMARGIN=0 BOTTOMMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>{ include file="head.tpl" }
<table border=0 width="750" cellpadding=0 cellspacing=0 align="center">
<tr>
<td valign=top width=750>
{include file="customer/new_sales.tpl"}
</td>
</tr>
</table>
{ include file="rectangle_bottom.tpl" }
</body>
</html>
Now where ever you have your main links, whether in "head.tpl" or in "rectangle_bottom.tpl" go and add your link to the on_sale.php page there!!
Remember if you're using DHTML Drop down menus, you have to add you javascript code to the meta.tpl file, without "{literal} {/literal}. That's it. I will continue to post as I figure new things out. I appreciate all of the posts that everyone has made. They have helped me tremendously. I will do the same in return!!