Zen Cart Logo
Forums / General Questions / Pull up orders from multiple order status like pending and processing on one page.

Pull up orders from multiple order status like pending and processing on one page.

Views: 1,135

Results 1 to 3 of 3
29 Apr 2015, 1:03 PM
#1
jpietrowiak avatar

jpietrowiak

Zen Follower

Join Date:
May 2009
Posts:
122
Plugin Contributions:
0

Pull up orders from multiple order status like pending and processing on one page.

Have issues with orders not being monitored since I have multiple order statuses for various things. I am trying to be able to display on one page multiple orders from multiple status via a simple link.

Currently Zencart has this built in for each status by going to "Admin home" page and just clicking on the status to see what orders are currently assigned to it.
The URL would look something like this for "Pending"
----website.com/admin/orders.php?selected_box=customers&status=1

What I would like to do is something like this to pull up orders from "Pending" which =1 and "Custom Status" which =5
The URL I would think should look like something like this
----website.com/admin/orders.php?selected_box=customers&status=1 & 5

I think I found the code that generates this URL from admin/index.php which is below. Maybe this would help elaborate on what would need to be changed or to add my own seperate link into page somewhere else and hard code the customer status numbers in myself.

$orders_contents .= '<div class="row"><span class="left"><a href="' . zen_href_link(FILENAME_ORDERS, 'selected_box=customers&status=' . $orders_status->fields['orders_status_id'], 'NONSSL') . '">' . $orders_status->fields['orders_status_name'] . '</a>:</span><span class="rigth"> ' . $orders_pending->fields['count'] . '</span> </div>';

I am not a coder, but have played with this stuff enough to be dangerous. Any help would be appreciated. Thanks

29 Apr 2015, 3:34 PM
#2
bislewl avatar

bislewl

Totally Zenned

Join Date:
Dec 2011
Location:
Wisconsin, USA
Posts:
674
Plugin Contributions:
12

Re: Pull up orders from multiple order status like pending and processing on one page.

jpietrowiak:

Have issues with orders not being monitored since I have multiple order statuses for various things. I am trying to be able to display on one page multiple orders from multiple status via a simple link.

Currently Zencart has this built in for each status by going to "Admin home" page and just clicking on the status to see what orders are currently assigned to it.
The URL would look something like this for "Pending"
----website.com/admin/orders.php?selected_box=customers&status=1

What I would like to do is something like this to pull up orders from "Pending" which =1 and "Custom Status" which =5
The URL I would think should look like something like this
----website.com/admin/orders.php?selected_box=customers&status=1 & 5

I think I found the code that generates this URL from admin/index.php which is below. Maybe this would help elaborate on what would need to be changed or to add my own seperate link into page somewhere else and hard code the customer status numbers in myself.

$orders_contents .= '<div class="row"><span class="left"><a href="' . zen_href_link(FILENAME_ORDERS, 'selected_box=customers&status=' . $orders_status->fields['orders_status_id'], 'NONSSL') . '">' . $orders_status->fields['orders_status_name'] . '</a>:</span><span class="rigth"> ' . $orders_pending->fields['count'] . '</span> </div>';

I am not a coder, but have played with this stuff enough to be dangerous. Any help would be appreciated. Thanks

you would need to modify the YOUR_ADMIN/orders.php

This modification is not for the faint of heart.

Notice this code here:

 } elseif ($_GET['status'] != '') {
      $status = zen_db_prepare_input($_GET['status']);
      $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.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 and ot.class = 'ot_total') " . "
                          where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$_SESSION['languages_id'] . "' and s.orders_status_id = '" . (int)$status . "'  " .
                          $search . " order by o.orders_id DESC";

You need to some how modify it so that to replace

 s.orders_status_id = '" . (int)$status . "' "

With some thing like (s.orders_status_id = '5' OR s.orders_status_id = '1')
keep in mind above is "hard coded" and you would need to determine the order status type from a url like
orders.php?selected_box=customers&status=1&status=5, additionally you would have to re-code the order status drop down choices. Or create links to those specified, or create a special check-box or something for this.

This is something that an advanced zen-cart developer should do, since it WILL require several significant core overwrites.

12 May 2015, 11:03 PM
#3
jpietrowiak avatar

jpietrowiak

Zen Follower

Join Date:
May 2009
Posts:
122
Plugin Contributions:
0

Re: Pull up orders from multiple order status like pending and processing on one page.

Thanks Bislewl... This is way over my head and looks like it really messes with the way zencart works. I think I might have to be happy with what I have on this one. Thanks for the response though. Cheers!