This module provides a tab on the product page named “Purchases” and provides a listing of the orders made for the product. The default listing includes all orders and is sorted descending by date. To access this tab, a user must have the ‘view purchases list’ permission (available with this module).
There are 3 list formats with corresponding tabs:
List View
3 column table, column one has the order details (including attributes), column 2 has the billing address, column 3 has the delivery address. The addresses here are formatted using the us_address_format function. If the user has ‘view all orders’ permission, the ID value is displayed as a link to that page.
Table View
This view provides the data in one large table. The addresses here are currently US centric (I need a better understanding of international addresses). If the user has ‘view all orders’ permission, the ID value is displayed as a link to that page. If the product has attributes, the attributes populate separate columns.
Download
Not really a view per se, but this option provides the data as a CSV file. The method for creating the file follows the method used by the Webform module.
Currently you can query the listing by date, the default dates are the first/last order dates and the defaults.
It’s just a start and I already see a number of ways of improving on the module. Any thoughts or ideas would be appreciated. I created this module as we have a number of events that people can sign up for and we wanted to be able to provide access to “registration” information to users who are organizing the event, but are not administrators of ubercart. I found the some posts on signup/event module integration (noted below), but since that integration doesn’t currently exist, I thought this might work in the short term.
The files are attached as both .tar.gz and .zip
| Attachment | Size |
|---|---|
| uc_purchases.zip | 4.64 KB |
| uc_purchases.tar.gz | 4.38 KB |



Re: Purchases Listing
Just wanted to say this is a great module. One suggestion, have you considered adding a status filter it?
It seems it would be really useful to narrow purchases by date and order status. Looks like I need to learn some PHP...
Re: Re: Purchases Listing
Definately a good idea. My original intention was to include status in the filter in this first iteration, but we really needed something fast, so I skipped it for the short term as it wasn't vital for what we needed. I hope to get back to this in the next week or so as there are some other changes that I would like to make as well.
Thanks
File Update
I have updated the files.
1. There was a small bug in the date selector that has been fixed
2. Added Order Status to the filter
3. Updated a number of string values to use the t() function.
Re: File Update
wow, that's killer. I'll install it and let you know if I have any bumps.
Found / Fixed a bug
In my use of the module I found that the first page hit of the product listing showed proper information. But if you refresh the page, you'll notice that the start and end dates are both set to 1969 (this also occurs if you click on the Table or Download links). I think I was overly aggressive in fixing this for my site, since I effectively fixed it two different ways. You can take you pick which you'd like to include;
1st way : lines 69-71
//added extra check to handle error
$start_date = isset($_SESSION['uc_purchases']['start_date']) ? $_SESSION['uc_purchases']['start_date'] : $_SESSION['uc_purchases']['created_min'];
$end_date = isset($_SESSION['uc_purchases']['end_date']) ? $_SESSION['uc_purchases']['end_date'] : $_SESSION['uc_purchases']['created_max'];
2nd way : lines 79-84
$_SESSION['uc_purchases']['order_count']=0;
$_SESSION['uc_purchases']['start_date']=$now;
$_SESSION['uc_purchases']['end_date']=$now;
$_SESSION['uc_purchases']['created_max']=$now;
$_SESSION['uc_purchases']['created_min']=$now;
$_SESSION['uc_purchases']['qty_sum']=0;
2nd way : lines 87-92
$_SESSION['uc_purchases']['order_count']=$row->order_count;
$_SESSION['uc_purchases']['start_date']=$row->created_max;
$_SESSION['uc_purchases']['end_date']=$row->created_min;
$_SESSION['uc_purchases']['created_max']=$row->created_max;
$_SESSION['uc_purchases']['created_min']=$row->created_min;
$_SESSION['uc_purchases']['qty_sum']=$row->qty_sum;\
The problem was caused by relying on the update function to set the start_date and end_date functions with the proper value while also setting other session variables like created_min and created_max during the first page hit. Since it is possible for a user to hit the page a second time without executing and update, the error resulted.
For the first way I fixed this problem, I added a check for the existance of start_date and end_date. If they don't exist I use the created_min and created_max values.
After doing that I realized that the truly proper way of fixing this is the set the start_date and end_date during the first hit along with the rest of the session variables. So the two parts I've included accomplishes this for both outcomes of the logic tree provided near line 74.
Is it possible to make the table view sortable?
Hi,
first of all, thanks for this great module! It is very useful for my needs.
Could you make it possible to have the table view sortable, especially sortable for product options?
So far I have to download the list and sort it somewhere else, that means extra work...
Greetings
Markus
Re: Is it possible to make the table view sortable?
is it possible to have a list of all products for which an order has been placed? i actually want to have a list of products for which an order has been placed, so that i can place an order for it at my end, and then dispatch it to my customers.