I wish to be able to filter invoices in the edit invoice admin page with another criteria, including product. I have made a select box with product IDs, and added this
Code:
With Product (wip):
<select name="select_product" size="0">
<option value="0"<? if($select_product==0){ echo ' selected="selected"';} ?>>---All---</option>
<option value="1"<? if($select_product==1){ echo ' selected="selected"';} ?>>Product 1</option>
</select>
<input type="submit" class="button" name="sbutton" value=" Filter List " />
</td>
</tr>
</form>
<?
print_cells_row(array("Invoice", "Transid", "Customer", "Issued at", "Amount", "Payment", "Shipping", "Actions"), 1, 'tcat');
$where = "WHERE id>0";
if($inv > 0)
{
$where .= " AND invoicestatus=$inv";
}
if($ord > 0)
{
$where .= " AND orderstatus=$ord";
}
if($gat > 0)
{
$where .= " AND gateway=$gat";
}
if($select_product > 0)
{
$get_transid = $db->query_read("SELECT transid FROM ". TABLE_PREFIX ."microcart_orders WHERE productid=".$select_product." ORDER BY transid");
$where .= " AND transid=$get_transid";
}
$invoices = $db->query_read("SELECT * FROM ". TABLE_PREFIX ."microcart_invoices ".$where." ORDER BY issuedate DESC");
while($invoice = $db->fetch_array($invoices))
Am I way off? or am I just missing some array stuff? Would really appreciate any help