I know that you can change the layout of the order history/order listings pages by editing the uc_orders_user View (which I have done a bit), but how can you theme the order details page?

For example, http://mysite.com/admin/store/orders/1450

Comments

m.roma created an issue. See original summary.

tr’s picture

Issue summary: View changes
Issue tags: -themes, -admin, -order details

You can theme that page the same as you would theme any other page in Drupal - is there something specific to Ubercart that's causing you a problem?

m.roma’s picture

Probably theming was a bad choice of words....what I want to do is move around the elements on that page - like a view. Add and subtract different fields and such.

tr’s picture

In addition to CSS, hook_uc_order_pane_alter() will allow you to modify the 'panes' of information shown on that page.

chrisck’s picture

Hi TR,

I noticed my other post was marked as duplicate because the it's similar to this support request. I'm still learning how to use hooks and I've used hook_form_alter but not so sure about this one. I looked into uc_order.module and found what I needed to change.

However, my code below doesn't seem to be correct:

function HOOK_uc_order_pane_alter(){
  $panes['bill_to'] = array(
    'weight' => 1,
  );
  $panes['ship_to'] = array(
    'weight' => 2,
  );
}

And this doesn't work either:

function HOOK_uc_order_pane_alter(&$panes){
  $panes['bill_to']['weight'] = 1;
  $panes['ship_to']['weight'] = 2;
}

Am I close to getting it right? Any help would be greatly appreciated.

tr’s picture

You need the second form, with the &$panes argument - that allows you to modify the $panes variable and have the modified $panes passed back to the calling routine.

I suggest printing out the contents of $panes so you can see the structure, to ensure you're setting the correct values. But yes, that looks about right.

But if you're just trying to reorder the checkout panes, try the configuration settings at /admin/store/settings/checkout instead - just drag the panes into the order you want then save.

chrisck’s picture

Thanks for the reply. I had a look around the uc_order.module because I couldn't seem to figure out how to print the content of $panes. If would be really nice if I could see the array structure.

function mymodule_uc_order_pane_alter(&$panes) {
  echo "<pre>";
  print_r($panes);

  // This also doesn't print the array 
  dsm($panes);
}

I'm trying to reorder the panes in the admin order edit form. Checkout is all good.

m.roma’s picture

OK, so what you want to do is something like:

function yourthemename_uc_order_pane_alter(&$panes){

	print "<pre>";
        print_r($panes);
        print "</pre>";

}

Keep in mind that your admin theme may be something different from your website user theme.

This should spit out a nicely formatted list of the array.

m.roma’s picture

However - the problem with all of this is that it still doesn't reveal the information I would like to manipulate. It shows the pane itself, but not the products listed in the pane (i.e. $panes contains information about the structure of the panes on this page, but not the variable or arrays for the data itself).

For example:

[products] => Array
        (
            [callback] => uc_order_pane_products
            [title] => Items
            [desc] => Manage the products an order contains.
            [class] => abs-left
            [weight] => 5
            [show] => Array
                (
                    [0] => view
                    [1] => edit
                    [2] => customer
                )

            [id] => products
            [enabled] => 1
        )

I need the information on the data listed in the panes - not regarding the panes themselves.

chrisck’s picture

m.roma can you explain what exactly you would like to do, inside of which panes?

chrisck’s picture

Title: Theming Order Details Page » Rearrange and adjust pane content in Admin Order page
m.roma’s picture

I would like to count the number of products and use other data points like product status and that sort of thing in the pane that lists the products.

m.roma’s picture

Is there no way to accomplish this?