Zen Cart Logo
Forums / Managing Customers and Orders / Priority Handling Search

Priority Handling Search

Views: 1,088

Results 1 to 2 of 2
10 Dec 2013, 9:28 PM
#1
riomaha avatar

riomaha

New Zenner

Join Date:
Oct 2013
Location:
MTL
Posts:
66
Plugin Contributions:
1

Priority Handling Search

Hi Everyone,

I am working on developing a seach function in Orders Module of ZC 1.51 to be able to filter priority handling orders and process them prior to regular orders. So, I downloaded and install the Priority Handling module and it works great. Saddly, there is no search/filter function to help agents sidentify and process those orders at a glance.

So I started building my own and for now parts of the code will be hard coded. Any help is greatly appreciated.

What I would like to do is create a drop down list as a search list and then be able to filter futher by order status. Similar to search by product or customer info.

The code below allows me to have a drop down list but I can only use it as a filter status/priority. I need to compound that search instead of one or the other
...........................
// prepare order-priority pulldown list
$priority = array($priority_array);
$priority_array = array();
..................
<tr><?php echo zen_draw_form('priority', FILENAME_ORDERS, '', 'get', '', true); ?>
<td class="smallText" align="right">
<?php
echo PRIORITY . ' ' . zen_draw_pull_down_menu('priority', array_merge(array(array('id' => 'ot_priority_handling', 'text' => 'Priority

Handling')), $priority), $_GET['priority'], 'onChange="this.form.submit();"');
echo zen_hide_session_id();
?>
</td>
</form></tr>
..............................
Code that needs to be worked on or changed is below but works as a filter now
..............................

//echo '<BR><BR>I SEE ABC: ' . $orders_query_raw . '<BR><BR>';

} elseif ($_GET['priority'] != '') {
  $priority = zen_db_prepare_input($_GET['priority']);
  $orders_query_raw = "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, 

o.currency, o.currency_value, s.orders_status_name, ot.class, ot.title, ot.text as order_total" .
$new_fields . "
from (" . TABLE_ORDERS_STATUS . " s, " .
TABLE_ORDERS . " o " .
$new_table . ")
left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id ) " . "
where ot.class like 'ot_priority_handling' and o.orders_status = s.orders_status_id" .
$search . " order by o.orders_id DESC";

14 Dec 2013, 9:03 AM
#2
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Priority Handling Search

If you are looking to build a search...
admin/orders.php

Zen already has one started...

<?php // Only one or the other search // create search_orders_products filter $search = ''; $new_table = ''; $new_fields = ''; if (isset($_GET['search_orders_products']) && zen_not_null($_GET['search_orders_products'])) { $new_fields = ''; $search_distinct = ' distinct '; $new_table = " left join " . TABLE_ORDERS_PRODUCTS . " op on (op.orders_id = o.orders_id) "; $keywords = zen_db_input(zen_db_prepare_input($_GET['search_orders_products'])); **$search = " and (op.products_model like '%" . $keywords . "%' or op.products_name like '" . $keywords . "%')";** if (substr(strtoupper($_GET['search_orders_products']), 0, 3) == 'ID:') { $keywords = TRIM(substr($_GET['search_orders_products'], 3)); $search = " and op.products_id ='" . (int)$keywords . "'"; } } else { ?> <?php // create search filter $search = ''; if (isset($_GET['search']) && zen_not_null($_GET['search'])) { $search_distinct = ' '; $keywords = zen_db_input(zen_db_prepare_input($_GET['search'])); **$search** = " and (o.customers_city like '%" . $keywords . "%' or o.customers_postcode like '%" . $keywords . "%' or o.date_purchased like '%" . $keywords . "%' or o.billing_name like '%" . $keywords . "%' or o.billing_company like '%" . $keywords . "%' or o.billing_street_address like '%" . $keywords . "%' or o.delivery_city like '%" . $keywords . "%' or o.delivery_postcode like '%" . $keywords . "%' or o.delivery_name like '%" . $keywords . "%' or o.delivery_company like '%" . $keywords . "%' or o.delivery_street_address like '%" . $keywords . "%' or o.billing_city like '%" . $keywords . "%' or o.billing_postcode like '%" . $keywords . "%' or o.customers_email_address like '%" . $keywords . "%' or o.customers_name like '%" . $keywords . "%' or o.customers_company like '%" . $keywords . "%' or o.customers_street_address like '%" . $keywords . "%' or o.customers_telephone like '%" . $keywords . "%' or o.ip_address like '%" . $keywords . "%')"; $new_table = ''; I'm certain you can modify it to work with the particular fields you'd like to search for.