View Single Post
  #6  
Old 10-26-2003, 03:07 PM
 
pipercub pipercub is offline
 

Advanced Member
  
Join Date: Oct 2002
Posts: 82
 

Default

Here's the code...

First, create a new template called 'order_colors.tpl' (or whatever you prefer). This file should live in the 'Main' directory. Paste the following into this new file:

Code:
{* $Id: orders_colors.tpl,v 1.0 2003/10/26 13:07:50 pipercub Exp $ *} {if $orders[cat_num].status eq "C"} bgcolor="#00CC00"} {/if} {if $orders[cat_num].status eq "P"} bgcolor="#FFFF99"} {/if} {if $orders[cat_num].status eq "F"} bgcolor="#FF33333"} {/if}

Obviously, you can add all of the status indicators that you need, but I only use these three. This is also where you change the colors.

Next, open 'main/orders.tpl'. Find the part of the code where the 'section' loop begins. Replace everything between {section name=cat_num loop=$orders} and {/section} with the following code:

*This is the easy method. Scroll down for the custom method.

Code:
{section name=cat_num loop=$orders} {math equation="x + ordertotal" x=$total ordertotal=$orders[cat_num].total assign="total"} {if $orders[cat_num].status eq "P" or $orders[cat_num].status eq "C"} {math equation="x + ordertotal" x=$total_paid ordertotal=$orders[cat_num].total assign="total_paid"} {/if} { if %cat_num.first% } <table border=0 width=100% cellspacing="1" cellpadding="0"> {/if} <tr> <td align="center" {include file="main/orders_colors.tpl"}> #{$orders[cat_num].orderid} </td> <td align="center" {include file="main/orders_colors.tpl"}> <input type=radio name=orderid value="{ $orders[cat_num].orderid }" { if %cat_num.first% }checked{/if}> </td> <td align="center" nowrap class=Text {include file="main/orders_colors.tpl"}> {$orders[cat_num].status} </td> <td nowrap align="center" {include file="main/orders_colors.tpl"}> <font class=Text>{$orders[cat_num].date|date_format:"%b-%d-%Y"}</font> </td> <td nowrap align="center" {include file="main/orders_colors.tpl"} class=Text> {if $usertype eq "A"}<a href="order.php?orderid={$orders[cat_num].orderid}"> { $orders[cat_num].firstname } { $orders[cat_num].lastname }</a> {/if} </td> <td nowrap align="center" {include file="main/orders_colors.tpl"} class=Text> {if $usertype eq "A"} { $orders[cat_num].provider } {else}<a href="order.php?orderid={$orders[cat_num].orderid}"> { $orders[cat_num].firstname } { $orders[cat_num].lastname }</a> {/if} </td> <td nowrap align=right class=Text {include file="main/orders_colors.tpl"}> {include file="currency.tpl" value=$orders[cat_num].total} </td> </tr> { if %cat_num.last% } <tr><td colspan=7 align=right height=20>{$lng.lbl_gross_total}: {include file="currency.tpl" value=$total}</td></tr> <tr><td colspan=7 align=right height=20>{$lng.lbl_total_paid}: {include file="currency.tpl" value=$total_paid}</td></tr> </table> {/if} {/section}

For theose who don't want to replace their file (due to other mods), you can simply paste:

Code:
{include file="main/orders_colors.tpl"}

between all of the <td> tags for the cells that you want to affect.

Example:
<td align="center" {include file="main/orders_colors.tpl"}>

Enjoy,
Piper
Reply With Quote