7 replies [Last post]
newbstah's picture
Offline
Joined: 07/04/2008
Juice: 90
Was this information Helpful?

Hi There -

Would like to display the 'My order history' section that's currently on the profile in a panel on a dashboard and eventually in a service.

Unfortunately, I couldn't figure out how to make it into a view to bring it into a block or a pane in a panel. Is there a more elegant way to do this than digging around in the module and tables and recreating the database calls?

(I'm also needing to do this for buddylist management. So if someone knows how to do that too, I'd be grateful.)

The path is currently '/user/$uid/orders'

Thanks!

kerunt's picture
Offline
Bug Finder
Joined: 05/05/2008
Juice: 158
This should do it: - Create

This should do it:

- Create a new block
- Set input format to PHP
- Use this:

<?php
global $user;
print
uc_order_history($user->uid);
?>
newbstah's picture
Offline
Joined: 07/04/2008
Juice: 90
Thanks! Hope something

Thanks!

Hope something terrific happens to you today!

mattGWS's picture
Offline
Joined: 11/26/2008
Juice: 21
Re: Thanks! Hope something

Just an addition to this - if youre using Ubercart 2x its just

<?php
global $user;
print
uc_order_history($user);
?>
mach5_kel's picture
Offline
Joined: 03/25/2008
Juice: 79
Updated to Order History Block?

Anyone have an update to this PHP snippet?

I am trying to get the order history into a panel, instead of a tab from the user account.

I find the uber 2.0 suggested snippet crashes my site, and just gives me an error message. Opps.

newbstah's picture
Offline
Joined: 07/04/2008
Juice: 90
Re: Updated to Order History Block?

Can you paste the error you're getting here?

I looked into Ubercart and found the function

function uc_order_history($user)

in uc_order.admin.inc

on line 1017

Its final return looks like this:

return theme('table', $header, $rows, array('class' => 'uc-order-history'))
       . theme('pager', NULL, 20, 0);

You might try creating a variable, like $order_history doing this:

$order_history = uc_order_history($user);
print $order_history;

Please let the thread know what the results are for trying this!

Cookies And Java's picture
Offline
Joined: 11/15/2010
Juice: 3
mach5_kel wrote: Anyone have
mach5_kel wrote:

Anyone have an update to this PHP snippet?

I am trying to get the order history into a panel, instead of a tab from the user account.

I find the uber 2.0 suggested snippet crashes my site, and just gives me an error message. Opps.

I think I am getting the same problem, the error message I get is

Fatal error: Call to undefined function uc_order_history() in D:\*****.co.uk\wwwroot\includes\common.inc(1685) : eval()'d code on line 3

I'm using my own custom theme.

gurufoo's picture
Offline
Joined: 05/04/2009
Juice: 11
Include the file that contains the function

I had to put

<?php
include_once drupal_get_path('module', 'uc_order') . '/uc_order.admin.inc';
?>

before my call to uc_order_history($user);

Fixed my problem.