xcart 4.0.13
include/orders.php
Code:
# Search by order status
if (!empty($data["status"]) && $data["status"] != array(""=>"1"))
if (is_array($data["status"])) {
$sql_status = "";
foreach ($data["status"] as $k=>$v)
$sql_status .= " OR $sql_tbl[orders].status='".$k."'";
$search_condition .= " AND (".substr($sql_status,4).")";
} else {
$search_condition .= " AND $sql_tbl[orders].status='".$data["status"]."'";
}
the
$data["status"] != array(""=>"1")) is so that the blank option can be selected to return any order status
skin1/main/order_status.tpl
Code:
<OPTION value="I" {if $status eq "I" || $status.I eq 1}selected{/if}>{$lng.lbl_not_finished}</OPTION>
<OPTION value="Q" {if $status eq "Q" || $status.Q eq 1}selected{/if}>{$lng.lbl_queued}</OPTION>
<OPTION value="P" {if $status eq "P" || $status.P eq 1}selected{/if}>{$lng.lbl_processed}</OPTION>
<OPTION value="B" {if $status eq "B" || $status.B eq 1}selected{/if}>{$lng.lbl_backordered}</OPTION>
<OPTION value="D" {if $status eq "D" || $status.D eq 1}selected{/if}>{$lng.lbl_declined}</OPTION>
<OPTION value="F" {if $status eq "F" || $status.F eq 1}selected{/if}>{$lng.lbl_failed}</OPTION>
<OPTION value="C" {if $status eq "C" || $status.C eq 1}selected{/if}>{$lng.lbl_complete}</OPTION>
adding the || $status entries ensures backwards compatibility with other scripts that use order_status.tpl
skin1/main/orders.tpl
Code:
<TD class="FormButton" nowrap>{$lng.lbl_order_status}:</TD>
<TD width="10"></TD>
<TD>{include file="main/order_status.tpl" status=$search_prefilled.status mode="select" name="posted_data[status][]" extended="Y" ex
tra="style='width:70%' multiple size=8"}</TD>
name="posted_data[status][]" has an extra [] at the end to turn it into an array
the html code to make it a multiple select is passed with the
extra parameter
On my order screen I have also moved the status selection box out of advanced order options up to the top to make it more accessible.
suggestions welcome, for i am not a great php coder by any means