3 replies [Last post]
BigMike's picture
Offline
Joined: 10/20/2008
Juice: 1113
Was this information Helpful?

Hello UC,

D6.22, UC2.6

I would like to know what is a URL that can change the Sales Order display to view by status "Active orders".

I see it is easy to get these URLs...
Pending ... admin/store/orders/sort/pending
Processing ... admin/store/orders/sort/processing
Completed ... admin/store/orders/sort/completed

et cetera, but what I don't see is a URL to return the view by status to "Active Orders". At first, it seems I could use just simply admin/store/orders, but this does not work if you are already viewing by a different status.

Question: What is a single URL that will return any "View by status" selection to the "Active orders" view?

I've tried the obvious, admin/store/orders/sort/active_orders and also admin/store/orders/sort/active, but both of these links return a blank list of orders. Examining the code, it is using Javascript to return the view to "Active orders" and I don't think I'd be able to invoke whatever the javascript is through a single URL link anyhow.

Please help!

Thank you very much in advance!!

Regards,
BigMike

BigMike's picture
Offline
Joined: 10/20/2008
Juice: 1113
Re: Need a link to display only "Active orders" please

Here is the function that is being used when the drop-down menu is updated via this.form.submit();:

uc_order\File uc_order.admin.inc (Line 565)

function uc_order_admin_sort_form_submit($form, &$form_state) {
  if ($form_state['values']['status'] == '-1') {
    unset($_SESSION['sort_status']);
    drupal_goto('admin/store/orders');
  }
  else {
    $_SESSION['sort_status'] = $form_state['values']['status'];
    drupal_goto('admin/store/orders/sort/'. $form_state['values']['status']);
  }
}

I *might* be able to build a javascript that can be used to perform a task and redirect the browser, but this unset($_SESSION['sort_status']); is PHP so I don't think I can make this happen....

BigMike's picture
Offline
Joined: 10/20/2008
Juice: 1113
Re: Need a link to display only "Active orders" please

I think the reason why I can't figure this out is because, despite what Ubercart says, "Active orders" is not an order status type. This makes sense because it displays orders with varying statuses...

BigMike's picture
Offline
Joined: 10/20/2008
Juice: 1113
Ok, I figured this out. I

Ok, I figured this out.

I simply injected my own term for the 4th argument of the URL that unsets the sort_status session and redirects the browser to 'admin/store/orders'.

File: uc_order/uc_order.admin.inc
Near line: 441

Original function:

441    if (arg(3) == 'sort' && !is_null(arg(4))) {
442      $_SESSION['sort_status'] = arg(4);
443      $args[] = arg(4);
444    }

New function:

    if (arg(3) == 'sort' && !is_null(arg(4))) {
      if (arg(4) == 'reset') {
        unset($_SESSION['sort_status']);
        drupal_goto('admin/store/orders');
      }
      else {
        $_SESSION['sort_status'] = arg(4);
        $args[] = arg(4);
      }
    }

Now, when I access the URL admin/store/orders/sort/reset, it performs the same code as in the function uc_order_admin_sort_form_submit() to reset the sort status to "Active orders".

Done.

Regards,
BigMike