9 replies [Last post]
kulvik's picture
Offline
Uber DonorBug FinderEarly adopter... addicted to alphas.Cool profile pic award.Internationalizationizer
Joined: 08/14/2007
Juice: 336
Was this information Helpful?

Hi uberpeople.

I was just wondering if there have been created a theme_product function lately? I'm sitting on a crap computer without a subversion client today so I can't really check the repositories myself. In the version i'm currently working on I have these theme functions for products:

function theme_uc_product_form_prices($prices)
function theme_uc_product_model($model)
function theme_uc_product_add_to_cart($node)
function theme_uc_product_price($price, $class)
function theme_uc_product_sell_price($price, $teaser)
function theme_uc_product_weight($weight, $unit = null)

They are all good, but it would be nice to have one for the overall layout of the products as well. Right now i'm doing this by creating custom node-product.tpl.php files, but that's not exactly ideal as I have to use a lot of code and it looks like hell with all the CCK variables.

______________
Thomas Kulvik
Ny Media AS
www.nymedia.no

zmove's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Internationalizationizer
Joined: 08/13/2007
Juice: 1192
Re: theme function for products?

If you talk about the possibility to theme the overall product page, to order things like you want.... you can use a core drupal theme system by naming a node-product.tpl.php which is a copy of node.tpl.php and design your product page exactly as you want.

You may want the excellent content template module to easily know which variable contain which content. (because for people that have little difficulty with complex array, drupal is a nightmare) ^^

kulvik's picture
Offline
Uber DonorBug FinderEarly adopter... addicted to alphas.Cool profile pic award.Internationalizationizer
Joined: 08/14/2007
Juice: 336
Thanks for the reply. What

Thanks for the reply.

What you're suggesting is exactly what i've done. I have themed 4-5 stores with ubercart now and they all have very different layout on the product view pages (and teasers/lists). But I just don't think it's the easiest way to do it. When you create a node-.tpl.php you basically just use it as it is, but you replace $content. So what's happening is that drupal formats the product like übercart wants and stores that in the $content variable, but I have never used that data on any og the stores i've created. That's why it just seems like a "hack" to do it in this way. It would be much better to just be able to use node-.tpl.php for the overall layout and override a theme function for the actual presentation of the product data. Or am I wrong? Smiling

I guess it's very individual what people prefer Smiling

______________
Thomas Kulvik
Ny Media AS
www.nymedia.no

zmove's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Internationalizationizer
Joined: 08/13/2007
Juice: 1192
Re: Thanks for the reply. What

I don't think it's a kind of hack, it's the way content template, CCK, view.... advice to theme a node.

kulvik's picture
Offline
Uber DonorBug FinderEarly adopter... addicted to alphas.Cool profile pic award.Internationalizationizer
Joined: 08/14/2007
Juice: 336
Re: Re: Thanks for the reply. What

Yeah, i'll just keep on using the previous method Smiling

______________
Thomas Kulvik
Ny Media AS
www.nymedia.no

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Thanks for the reply.

I don't know... I think I understand your needs, kulvik, and this would be fairly trivial for us to put in. I'm not sure if it'll be 7c or not, but we should do it before Alpha 8. Functionally, folks using the other method will notice nothing different.

EDIT: Now that I think about it... why wouldn't you just use hook_nodeapi() to unset the fields you didn't want to bother with and change the ones you wanted to change?

EDIT-2: Just realized... is it because you'd like to do it all from a theme file? I don't know if hooks work from themes or not, but I'm guessing they don't...

mikejoconnor's picture
Offline
AdministratorBug FinderGetting busy with the Ubercode.
Joined: 08/07/2007
Juice: 536
Re: Re: Re: Re: Thanks for the reply.

I believe theme_uc_product was in the product module pre alpha 7. It was used more in earlier versions, but seemed to be replaced with hook_view. I've been using content templates, but I've longed for a good theme_uc_product.

starkos's picture
Offline
Joined: 12/10/2007
Juice: 4
Did anything come of this?

Was a theme function ever added? I can't find anything in the sources.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Did anything come of this?

theme_uc_product() wasn't ever added. This is mostly because you can create a product-specific node template. This gives the designer complete control over the display of the node and all of its fields.

incaic's picture
Offline
Joined: 10/13/2007
Juice: 115
Re: Re: Did anything come of this?

If interested, I added another solution rather than using hook_nodeapi()
here: http://www.ubercart.org/forum/support/1911/product_node#comment-9179
(sorry, didn't want to enter the info twice)

e.