Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sign in to follow this  
niviche

Customers Drop Down In Orders List

Recommended Posts

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.

 

customers_drop_down_in_orders_list.jpg

Edited by niviche

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×