ralfix Posted June 8, 2011 Share Posted June 8, 2011 Hi, i need help with this code. It works fine, when all orders are displayed, but i would be fine if it works like this... Display only all payed orders and then sort (Option order status should be intergratet in this code) Thanks a lot <tr class="dataTableHeadingRow"> <!-- Sortieren beginn --> <?php $listing = $_GET['listing']; switch ($listing) { case "id-asc": $ordersort = "o.date_purchased"; break; case "customers_name": $ordersort = "o.customers_name"; break; case "customers_name-desc": $ordersort = "o.customers_name DESC"; break; case "preis": $ordersort = "ot.text"; break; case "preis-desc": $ordersort = "ot.text DESC"; break; default: $ordersort = "o.date_purchased DESC"; } ?> <!-- Sortieren ende --> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?><br> <!-- Sortieren beginn --> <a href="<?php echo tep_href_link(FILENAME_ORDERS, 'listing=customers_name'); ?>"><?php echo tep_image('images/icon_up.gif', ' Sortierung ' . TABLE_HEADING_CUSTOMERS . ' aufsteigend '); ?></a> <a href="<?php echo tep_href_link(FILENAME_ORDERS, 'listing=customers_name-desc'); ?>"><?php echo tep_image('images/icon_down.gif', ' Sortierung ' . TABLE_HEADING_CUSTOMERS . ' absteigend '); ?></a> <!-- Sortieren ende --> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ORDER_TOTAL; ?><br> <!-- Sortieren beginn --> <a href="<?php echo tep_href_link(FILENAME_ORDERS, 'listing=preis'); ?>"><?php echo tep_image('images/icon_up.gif', ' Sortierung ' . TABLE_HEADING_ORDER_TOTAL . ' aufsteigend '); ?></a> <a href="<?php echo tep_href_link(FILENAME_ORDERS, 'listing=preis-desc'); ?>"><?php echo tep_image('images/icon_down.gif', ' Sortierung ' . TABLE_HEADING_ORDER_TOTAL . ' absteigend '); ?></a> <!-- Sortieren ende --> </td> </td> <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_DATE_PURCHASED; ?><br> <!-- Sortieren beginn --> <a href="<?php echo tep_href_link(FILENAME_ORDERS, 'listing=id-asc'); ?>"><?php echo tep_image('images/icon_up.gif', ' Sortierung ' . TABLE_HEADING_DATE_PURCHASED . ' aufsteigend '); ?></a> <a href="<?php echo tep_href_link(FILENAME_ORDERS, 'llisting=id-desc'); ?>"><?php echo tep_image('images/icon_down.gif', ' Sortierung ' . TABLE_HEADING_DATE_PURCHASED . ' absteigend '); ?></a> <!-- Sortieren ende --> </td> <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td> <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> </tr> <?php if (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 $ordersort"; } 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 $ordersort"; } 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 $ordersort"; } $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); } if (isset($oInfo) && is_object($oInfo) && ($orders['orders_id'] == $oInfo->orders_id)) { echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit') . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID')) . 'oID=' . $orders['orders_id']) . '\'">' . "\n"; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.