New code for modules/discount coupons/coupons.tpl
version 3.4.x - did this today for another client
Code:
{* $Id: coupons.tpl,v 1.10 2003/04/22 10:10:59 svowl Exp $ *}
{include file="location.tpl" last_location="Store coupons"}
{include file="main/popup_product_js.tpl"}
This page allows you to define coupons that you wish to accept for your store. Each coupon allows a customer to receive a discount when he/she orders products from your store.
If a customer enters a valid coupon code during checkout, the store will deduct the discount amount from their order total.
{capture name=dialog}
{if $coupons ne ""}
<table width="100%" border=0>
<form action="coupons.php" method="POST">
<tr><td class=TableHead>Coupon</td><td class=TableHead>Status</td><td class=TableHead>Disc.</td><td class=TableHead>Min.</td><td class=TableHead>Times</td><td class=TableHead colspan=2>Expires</td></tr>
{section name=prod_num loop=$coupons}
<tr>
<td>
{$coupons[prod_num].coupon}
</td>
<td>
<select name="status-{$coupons[prod_num].coupon}">
<option value=A {if $coupons[prod_num].status eq "A"}selected{/if}>Active</option>
<option value=D {if $coupons[prod_num].status eq "D"}selected{/if}>Disabled</option>
<option value=U {if $coupons[prod_num].status eq "U"}selected{/if}>Used</option>
</select>
</td>
<td>{if $coupons[prod_num].coupon_type eq "absolute"}{include file="currency.tpl" value=$coupons[prod_num].discount}{elseif $coupons[prod_num].coupon_type eq "percent"}{$coupons[prod_num].discount}%{else}Free ship.{/if}</td>
<td>{include file="currency.tpl" value=$coupons[prod_num].minimum}</td>
<td align=center>{$coupons[prod_num].times_used}/{$coupons[prod_num].times}</td>
<td nowrap>
{$coupons[prod_num].expire|date_format:"%b/%d/%Y"}
</td>
<td><input type="button" value="Delete" onClick="document.location='coupons.php?mode=delete&coupon={$coupons[prod_num].coupon}'"></td>
</tr>
<tr>
<td colspan=7>
This coupon applies on orders
{if $coupons[prod_num].productid ne 0}
which contain product
#{$coupons[prod_num].productid}
{elseif $coupons[prod_num].categoryid ne 0}
which contain product(s) from category #{$coupons[prod_num].categoryid}
{else}
greater than {include file="currency.tpl" value=$coupons[prod_num].minimum}
{/if}
</td>
</tr>
{/section}
<tr>
<td></td><td colspan=5><input type=submit value="Update"></td>
</tr>
</form>
</table>
<hr size=1 noshade>
{/if}
<font class=AdminTitle>Add new coupon</font>
<form action="coupons.php?mode=update" method="POST" name=coupon_form>
<table border=0>
<tr><td>Coupon # <font class="Star">*</font></td><td><input type=text size=24 name=coupon_new></td></tr>
<tr><td>Times to use</td><td><input type=text size=8 value="1" name=times_new></td></tr>
<tr><td>Status</td>
<td>
<select name=status_new>
<option value=A>Active</option>
<option value=D>Disabled</option>
</select>
</td></tr>
<tr><td>Discount</td><td><input type=text size=24 name=discount_new value="0.00"></td></tr>
<tr><td>Coupon type</td>
<td>
<select name=coupon_type_new>
<option value=absolute>{$config.General.currency_symbol} off</option>
<option value=percent>% off</option>
<OPTION value=free_ship>Free shipping</OPTION>
</select>
</td></tr>
<tr><td>Expires</td>
<td>
{math equation=year+1 year=$config.Company.end_year assign=endyear}
{html_select_date prefix="new_" start_year=$config.Company.start_year end_year=$endyear month_format="%b"}
</td></tr>
<TR>
<TD valign=top>Apply to</TD>
<TD>
<table border=0>
<tr><td valign=top><INPUT type=radio name=apply_to value="any" checked></td><td>order total, {$config.General.currency_symbol}
<input type=text size=24 name=minimum_new value="0.00"></td></tr>
<tr><td valign=top><INPUT type=radio name=apply_to value="product"></td><td>one product
<INPUT type=hidden name=productid_new><INPUT type=text disabled size=24 name=productname><INPUT type=button onClick="javascript:popup_product('coupon_form.productid_new','coupon_form.productname');" value="Browse"></td></tr>
<tr><td valign=top><INPUT type=radio name=apply_to value="category"></td><td>one category
<SELECT name=categoryid_new>
{section name=cats loop=$allcategories}
<OPTION value="{$allcategories[cats].categoryid}">{$allcategories[cats].category}</OPTION>
{/section}
</SELECT>
</td>
</tr>
</table>
</table>
<input type="submit" value="Add coupon">
</form>
{/capture}
{include file="dialog.tpl" title="Store coupons" content=$smarty.capture.dialog extra="width=100%"}