pavant |
08-05-2007 07:06 PM |
Display all orders using a Specific Gift Certificate
We issue gift certificates for customer rewards so I wanted to be able to search for and display all orders that used a specific gift certificate for payment. Here are the mods I made to our 4.1.8 release of xcart gold:
In skin1/main/orders.tpl after
Quote:
['posted_data[orderid1]', '{$search_prefilled.orderid1}'],
['posted_data[orderid2]', '{$search_prefilled.orderid2}'],
|
insert the following line
Quote:
['posted_data[giftcertid]', '($search_prefilled.giftcertid)'],
|
After this code:
Quote:
<table cellpadding="0" cellspacing="0">
<tr>
<td><input type="text" size="10" maxlength="15" name="posted_data[total_min]" value="{if $search_prefilled eq ""}{$zero}{else}{$search_prefilled.total_min|forma tprice}{/if}" /></td>
<td> - </td>
<td><input type="text" size="10" maxlength="15" name="posted_data[total_max]" value="{$search_prefilled.total_max|formatprice}" /></td>
</tr>
</table>
</td>
</tr>
|
Insert the following:
Quote:
<tr>
<td class="FormButton" nowrap="nowrap">Gift Certificate Id:</td>
<td width="10"> </td>
<td>
<input type="text" name="posted_data[giftcertid]" size="25" maxlength="30" value="{$search_prefilled.giftcertid}" />
</td>
</tr>
|
In include/orders.php make the following changes
Replace:
Quote:
$advanced_options = array("orderid1", "orderid2", "total_max", "payment_method", "shipping_method", "status", "provider", "features", "product_substring", "productcode", "productid", "price_max", "customer", "address_type", "phone", "email");
|
With this:
Quote:
$advanced_options = array("orderid1", "orderid2", "total_max", "giftcertid", "payment_method", "shipping_method", "status", "provider", "features", "product_substring", "productcode", "productid", "price_max", "customer", "address_type", "phone", "email");
|
After :
Quote:
if (!empty($data["total_max"]))
$search_condition .= " AND $sql_tbl[orders].total<='".doubleval($data["total_max"])."'";
|
Insert:
Quote:
# Search by Gift Certificate
if (!empty($data["giftcertid"]))
$search_condition .= " AND $sql_tbl[orders].giftcert_ids LIKE '%".$data["giftcertid"]."%'";
|
This search appears on the admin order search panel only. This code is provided to help other xcart users but I don't provide any support so use it at your own risk.
|