Guest Posted March 19, 2006 Posted March 19, 2006 at present, my orders.php search box doesn't seem to be functioning properly. here's what i have (modified): if(isset($HTTP_GET_VARS['search'])) { $search = tep_db_prepare_input($HTTP_GET_VARS['search']); $orders_query_raw = "select o.orders_id, o.customers_name, o.customers_id, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_PRODUCTS . " op on (op.orders_id = o.orders_id) left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id) left join " . TABLE_ORDERS_STATUS . " s on (o.orders_status=s.orders_status_id) where (op.products_name like '%" . tep_db_input($search) . "%' or op.products_model like '%" . tep_db_input($search) . "%' or o.customers_name like '%" . tep_db_input($search) . "%' or o.customers_email_address like '%" . tep_db_input($search) . "%') and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by orders_id DESC"; } elseif(isset($HTTP_GET_VARS['cID'])) { $cID = tep_db_prepare_input($HTTP_GET_VARS['cID']); $orders_query_raw = "select o.orders_id, o.customers_name, o.customers_id, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id =ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$cID . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by orders_id DESC",; } elseif (isset($HTTP_GET_VARS['status']) && is_numeric($HTTP_GET_VARS['status']) && ($HTTP_GET_VARS['status'] > 0)) { $status = tep_db_prepare_input($HTTP_GET_VARS['status']); $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by o.orders_id ASC"; } else { $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by o.orders_id DESC"; } $orders_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $orders_query_raw, $orders_query_numrows); $orders_query = tep_db_query($orders_query_raw); while ($orders = tep_db_fetch_array($orders_query)) { if ((!isset($HTTP_GET_VARS['oID']) || (isset($HTTP_GET_VARS['oID']) && ($HTTP_GET_VARS['oID'] == $orders['orders_id']))) && !isset($oInfo)) { $oInfo = new objectInfo($orders); } but when i type in the order id (a valid one), it doesn't find anything. and if order status is "shipped", i want it to search only orders with the "shipped status" (this should be set in whatever the pull down menu is, this is a default osc function) - but regardless of the status, if the search finds anything... it's in all statuses i want the search to work the following fields: order id, status, total, first name, last name, date purchased
Recommended Posts
Archived
This topic is now archived and is closed to further replies.