Closed (won't fix)
Project:
Ubercart
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
30 Sep 2009 at 19:46 UTC
Updated:
27 Jan 2013 at 20:14 UTC
The order history page calls uc_order_history, which gathers data, throws it through theme('table') and theme('pager'), and returns the result... making it impossible to theme the table differently without using hook_menu_alter to override uc_order_history() itself.
We need a theme_order_history function which takes the collection of history data that is currently gathered in uc_order_history, and then outputs it as a table, so that the output can be changed/rethemed.
If I find the time, I'll make a patch.
Comments
Comment #1
tr commentedYes, this is definitely needed.
Comment #2
agileware commented+1 for this
Comment #3
tr commentedComment #4
tr commentedTagging
Comment #5
tr commentedThis is solved for Ubercart 7.x-3.x because the order history page is now a View that can be easily customized and themed. That change isn't going to be backported to 6.x-2.x.
Comment #6
ericbroder commentedAnother option is to implement an override of theme_table in template.php and adjust this table there. For example:
Comment #7
drupalfever commentedI agree that there is no easy way to theme the order history. But, where there is a will, there always is a way.
One thing I cannot say enough is how useful the "devel" module was for me while I was working on this.
The two things I use the most on the "devel" module are:
1) The "dsm()" function to inspect arrays.
2) The "Execute PHP Code" page located at "http://YOUR_DOMAIN/devel/php"
I am going to say it again, this is not an easy solution. This is just a work around.
Here is how I did it:
1) I used the "devel_ themer" module to figure out the name of the template page that would allow me to theme the content of the order history page.
2) I went to my custom theme folder and made a copy of the "page.tpl.php" file. I named the copy as "page-user-order.tpl.php".
3) Then I figured out the current invoice being viewed by the customer by doing the following:
4) With a little bit of SQL magic, I retrieved all the information required from the database.
5) With the $products array at hand I can recreate the table with the content of the current order. What I need to do now is to remove the list of products that is currently there. I can do that with a little bit of PHP:
6) Now you can do a simple loop and generate a table with the order content like so:
The above example of how to generate the HTML is overly simplified. You will also have to loop through the attributes array if there are any attributes set for your products.
7) Now, the only thing left to do is to put all the HTML segments back together like so:
I told you it was not an easy solution for this problem. However, it worked for me.
I hope that this little article will help the next Drupal developer looking for answers.
Comment #8
MakeOnlineShop commentedHello,
Still no easy way ?
Thanks.