4 replies [Last post]
leenwebb's picture
Offline
Joined: 06/01/2008
Juice: 248
Was this information Helpful?

Is there a way to customize the Order Details screen? (The one the admin sees after an order has been placed: admin/store/orders/# )

Specifically, I'd like to remove "model" and "cost" from the table and add in the product image. Is this something that's themable, or custom-module-able? Is there (gasp!!) documentation?

Thanks!
Eileen

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Customize display of the order details page?

Actually... this page is pretty much set in stone given the way it's collecting and displaying all that data. What you can do is copy the default product order pane and its related code into a custom module, rename everything, and then modify it according to your tastes. It's not for the faint of heart, tho.

leenwebb's picture
Offline
Joined: 06/01/2008
Juice: 248
Re: Re: Customize display of the order details page?

Aw, crap, I am totally of the faint heart. But also: foolhardy!

Where might this mystical order pane code live? Is it spread about, or in one nice easy-to-copy location?

leenwebb's picture
Offline
Joined: 06/01/2008
Juice: 248
Re: Re: Customize display of the order details page?

Aw, it was not that hard. (I mean, maybe it would have been, to make a custom module and stuff. I just changed core. Foolhardy, I tell you.)

For anyone who so desires in the future:

ubercart/uc_order/uc_order_order_pane.inc
Everything is very nicely commented and easy to find in there. Down around line 686 is op_products_view_table, which controls that table on the order detail page. If you want to comment out (let's say) model # and cost, you have to comment out both the code that draws the table columns the data itself:

//$fields[] = array('name' => 'model', 'title' => t('Model'), 'weight' => 2, 'enabled' => TRUE, 'attributes' => array('class' => 'text-center', 'nowrap' => 'nowrap'));
//$fields[] = array('name' => 'cost', 'title' => t('Cost'), 'weight' => 3,'enabled' => TRUE, 'attributes' => array('class' => 'text-right'));
...
//$data['model'][] = array('data' => check_plain($product->model), 'align' => 'center', 'nowrap' => 'nowrap');
//$data['cost'][] = array('data' => uc_currency_format($product->cost), 'align' => 'right', 'nowrap' => 'nowrap');

And then if you want to add in a new column to put the thumbnail image in, you could do like so:

$fields[] = array('name' => 'image', 'title' => t('Picture'), 'weight' => 0, 'enabled' => TRUE);
...
$image_name = db_query("SELECT field_image_cache_title FROM content_field_image_cache WHERE NID=%d",$product->nid);
$image_name = db_result($image_name, $row = 0);

$data['image'][] = array('data' => '<img src="/files/imagecache/cart/files/products/'.$image_name.'">', 'class' => 'image'); 

Obviously change the path to point to your own imagecache files, and note that the "weight" thing in the first bit of the code controls the column order of the table.

Anyway. Not kosher, but now my table looks exactly how I want it to.

alexpetrov's picture
Offline
Joined: 08/19/2010
Juice: 4
Re: Re: Re: Customize display of the order details page?

Changing the core isn't a good way to solve problems, because you wouldn't be able to update the ubercart without loosing all your changes to the core.

I think it would be better to create a module, say mymodulename

and override the hook_tapir_table_alter hook.

function mymodulename_tapir_table_alter(&$table, $table_id) {
if($table_id == 'op_products_view_table'){
  unset($table['#columns']['cost']);
  unset($table['#columns']['model']);
}

something like that. It works for me.