niviche Posted January 22, 2007 Share Posted January 22, 2007 (edited) This is the support thread for: Customers Drop Down In Orders List http://www.oscommerce.com/community/contributions,4818 This contribution adds a drop down menu in the orders list in the admin section. You can then choose to see only orders by a specific customer. Customers are ordered alphabetically by last name. Edited January 22, 2007 by niviche Quote Quick stock update from the product listing page | Customers Drop Down In Orders List Link to comment Share on other sites More sharing options...
marcinmf Posted January 24, 2007 Share Posted January 24, 2007 I was getting error message with unknown table if someone is having the same problem just replace: // customers drop down in orders list begins } elseif (isset($HTTP_GET_VARS['customers_id']) && ($HTTP_GET_VARS['customers_id'] > 0)) { $invoice_number = tep_db_prepare_input($HTTP_GET_VARS['customers_id']); $status = tep_db_prepare_input($HTTP_GET_VARS['status']); $orders_query_raw = "select o.orders_id, o.invoice_serial, o.invoice_number, 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)$customers_id . "' 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"; // customers drop down in orders list ends With : // customers drop down in orders list begins } elseif (isset($HTTP_GET_VARS['customers_id']) && ($HTTP_GET_VARS['customers_id'] > 0)) { $invoice_number = tep_db_prepare_input($HTTP_GET_VARS['customers_id']); $status = tep_db_prepare_input($HTTP_GET_VARS['status']); $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)$customers_id . "' 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"; // customers drop down in orders list ends Also if you want to display them with the last name than first replace: <? // customers drop down in orders list begins ?> <tr> <? $customers_query = tep_db_query("select customers_id, customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " order by customers_lastname"); while ($customers = tep_db_fetch_array($customers_query)) { $customers_firstname = $customers['customers_firstname']; $customers_lastname = $customers['customers_lastname']; $customers_array[] = array('id' => $customers['customers_id'], 'text' => $customers_firstname . ' ' . $customers_lastname); } ?> <td class="smallText" align="right"><?php echo tep_draw_form('customers', FILENAME_ORDERS, '', 'get') . TABLE_HEADING_CUSTOMERS . ' ' . tep_draw_pull_down_menu('customers_id', array_merge(array(array('id' => '', 'text' => '')), $customers_array), (isset($HTTP_GET_VARS['customers_id']) ? $HTTP_GET_VARS['customers_id'] : ''), 'onChange="this.form.submit();"'); ?></form></td> </tr> <? // customers drop down in orders list ends ?> With: <? // customers drop down in orders list begins ?> <tr> <? $customers_query = tep_db_query("select customers_id, customers_lastname, customers_firstname from " . TABLE_CUSTOMERS . " order by customers_lastname"); while ($customers = tep_db_fetch_array($customers_query)) { $customers_lastname = $customers['customers_lastname']; $customers_firstname = $customers['customers_firstname']; $customers_array[] = array('id' => $customers['customers_id'], 'text' => $customers_lastname . ' ' . $customers_firstname); } ?> <td class="smallText" align="right"><?php echo tep_draw_form('customers', FILENAME_ORDERS, '', 'get') . TABLE_HEADING_CUSTOMERS . ' ' . tep_draw_pull_down_menu('customers_id', array_merge(array(array('id' => '', 'text' => '')), $customers_array), (isset($HTTP_GET_VARS['customers_id']) ? $HTTP_GET_VARS['customers_id'] : ''), 'onChange="this.form.submit();"'); ?></form></td> </tr> <? // customers drop down in orders list ends Nice addition, all credit credit goes to niviche Quote Link to comment Share on other sites More sharing options...
niviche Posted January 25, 2007 Author Share Posted January 25, 2007 I was getting error message with unknown table if someone is having the same problem just replace: You are right, there were artifacts in this query left from another contribution installed on my site. I'm updating the contribution page with this. Quote Quick stock update from the product listing page | Customers Drop Down In Orders List Link to comment Share on other sites More sharing options...
dr_lucas Posted January 26, 2007 Share Posted January 26, 2007 A3. find: } elseif (isset($HTTP_GET_VARS['status']) && is_numeric($HTTP_GET_VARS['status']) && ($HTTP_GET_VARS['status'] > 0)) { I checked the orders.php file 10 times and couldn't find a line that resemble this one. Where do I put the code? Thanks Quote Did I help you? Click "Like" or "Thanks"! It's free of charge. :)My contributions:Total Configuration (newly updated 07/2018, for both osC 2.2 and 2.3.4.1 BS Frozen CE)User Tracking with Admin 1.0 (newly updated 07/2018)FedEx - Web Services v9, FAQ System , Who's Online Enhancement, Order Editor, MoneyBookers IPN, Ship in Cart (MS2), Admin Products Paging, Margin Report v1.00, 2Checkout INS / IPN (Instant Notification System) for MS2.2, Visitor Web Stats, Time Zone Offset - Adjust to match your location, Category Meta Tags Link to comment Share on other sites More sharing options...
niviche Posted January 26, 2007 Author Share Posted January 26, 2007 I checked the orders.php file 10 times and couldn't find a line that resemble this one. Where do I put the code? Did you modify this orders.php file while installing another contribution? This line is in the default version of this file on a regular MS2 installation. Try to find the following, around line 353: <?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 orders_id DESC"; the line you were looking for should be right below it, and the code to insert for this contribution should come in between. Quote Quick stock update from the product listing page | Customers Drop Down In Orders List 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.
Note: Your post will require moderator approval before it will be visible.