3 replies [Last post]
shizzlebiscuits's picture
Offline
Joined: 02/11/2008
Juice: 7
Was this information Helpful?

I'm relatively new to Drupal and Ubercart and have a question about theming.

I have created a store using Ubercart and have themed it. However, I think that I went about theming it the wrong way and was hoping you could provide me with some links/info that can help. Currently, all my theming was done inside the Ubercart module rather than in my them. For example, if when I wanted to theme the cart block I went into uc_cart.module and changed the:
function theme_uc_cart_block_content(...)
{
...
}

Is there a way I can do this from within my theme rather than having to change the .module code. As you can imagine it's now somewhat painful for me to update the Ubercart modules because I might lose my theme changes.

Thanks for the help!

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: Correctly Themeing Ubercart

You have just learned why this is the "wrong" way to do it Smiling

To put the function override into your theme, copy the "theme_" function into template.php (Found in your theme directory. If it's not there just create it - some themes don't have a version of this file). Edit template.php and change the "theme_" in the function name to be "yourthemename_", where "yourthemename" is the actual name of your theme, or you can use "phptemplate_" instead. Then modify the code in the function to emit the HTML you want.

<tr>.
shizzlebiscuits's picture
Offline
Joined: 02/11/2008
Juice: 7
Re: Re: Correctly Themeing Ubercart

Awesome, thanks for the info. I knew there had to be a better way Smiling

Thanks!

sevenshadow's picture
Offline
Joined: 05/27/2009
Juice: 45
Re: Re: Correctly Themeing Ubercart

Thank you TR for this post. This solved my issue.