11 replies [Last post]
mkenney's picture
Offline
Joined: 11/10/2011
Juice: 9
Was this information Helpful?

Really struggling , like many others it sounds like, on grasping how to change/develop a product template for Ubercart 3.x. (http://www.ubercart.org/forum/development/3868/nifty_products_tutorial_p...) is a great resource for Ubercart 2.x but seems like it doesn't work with Ubercart 3.x very well.

Does anyone have a basic "node--product.tpl.php" that they would be willing to share. I'm new like many others and a simple functioning example would really help spring board the learning curve.

If this cat has already been skinned, please point me in the right direction and acdcept my apologizes for wasting people's time!!!

Thanks for any help!

Mark

dappi's picture
Offline
Joined: 11/07/2011
Juice: 12
Re: Drupal 7 Ubercart 3.x node--product.tpl.php Basic Example

This would aweseome! I must say that support from ubercart is appaling :/

mpalermo's picture
Offline
Joined: 01/20/2012
Juice: 22
Re: Drupal 7 Ubercart 3.x node--product.tpl.php Basic Example

Looking for help with this also. Did anyone find any useful information for accomplishing this?

Visit us at: http://totaldev.com

rkdarwin13's picture
Offline
Joined: 02/21/2012
Juice: 5
ditto that

I too am looking for a solution here. I'm very, very new to all of this (coming from a CF background) and could use some guidance here. A working example of Drupal 7/UC 3.x of node--product.tpl.php would be wonderfully helpful.

Geva's picture
Offline
Joined: 02/18/2011
Juice: 90
RE: Drupal 7 Ubercart 3.x node--product.tpl.php

hi,

- copy node.tpl.php and rename node--product.tpl.php - if your product type is "product" otherwise node--yourproductname.tpl.php in your theme directory
(node.tpl.php file is too in your theme directory)
- to be replace the following lines, line 102:

      <?php print render($content); ?>

- you have to print the necessary ubercart variables, in required format,
for example:

<?php
 
if ($view_mode == 'teaser')
    print
render($content['uc_product_image']['0']); <!-- in teaser print only the first product image -->
  else
    print
render($content['uc_product_image']); <!-- in full product node view the images style product_image -->
  print(
'<div class="sell">' . $sell_price) . '</div>');
  print
render($content['add_to_cart']);
  print
render($content['body']);
  print(...);
?>

- variables name by drupal devel modul,
...of course, still needs to be formatted in a css file

my drupal 7 + ubercart 3 product (theme based on PSD - test drupal site): http://drupalthemes.gevapc.hu/hu/product/business-psd
and a category list width teasers of the products: http://drupalthemes.gevapc.hu/hu/catalog/9

This will help you?

rkdarwin13's picture
Offline
Joined: 02/21/2012
Juice: 5
A thousand blessings be upon thee!

sweet buttery goodness!

You..... are my hero. This helped, thank you for pointing me in the right direction.

Geva's picture
Offline
Joined: 02/18/2011
Juice: 90
Re: A thousand blessings be upon thee!

good luck Smiling

Juc1's picture
Offline
Joined: 06/05/2011
Juice: 109
sell price field

@ Geva or anyone,

When I create a new product, sell-price is a required field. But this means that a product that has options will display both the sell price field and the options prices as seen here:

http://drupal.org/files/issues/PowerToolUseExample.jpg

or the same problem when products are listed in Views.

This sucks so I want to make the sell-price an optional field (ie so when creating a product I would use the sell-price field when a product has no options but leave it empty for a product that has options).

Can I do this in node--product.tpl.php? I think the answer is no because node--product.tpl.php kicks in after a product node is created but it is really the creating a new product code that I want to get at.

thank you

Geva's picture
Offline
Joined: 02/18/2011
Juice: 90
Re: sell price field

Hi Juc1,
I think, you have 2 different types of products - in their structures.
Set the Product content type:
- sell price value = 0 + attributes;
- you must hide the sell price (as a field of product content type), only attributes visible width their prices

You set a new class of product (Store - Products - Manage Classes and add a class, for example it's name Product2
Set the Product2 content type:
(has no attributes)
- sell price visible as a field in page Structure - Content types - Product2 ---> manage display, Format of sell price Visible

voila Smiling
is it ok?

Juc1's picture
Offline
Joined: 06/05/2011
Juice: 109
Re: sell price field

Hey Geva

Thanks for your help. I think that will work for a node view but not in a View because the choice in Views is to output the sell-price field for all products or for no products.

But I think there is a solution to this -

2 classes of products - options and no options
hide the sell-price in both product classes
create "new-price-field" for only the no-options class
in Views the "new-price-field" will output for the no-options class but not for the options class (because the field doesn't exist)
In both the node and the View, the no-options class will output "new-price-field" and not the sell-price field
In both the node and the View, the options class will output the options prices and not the sell-price field
the sell-price field will not be seen at all by the shopper but behind the scenes will get the relevant price into the cart.

I haven't tried it yet but it sounds good.

By the way it seems that when a product has options they just show up in a View ie without being a field which can be selected or not for the View. This seems strange but I guess it works ok with the above.

Thanks

Juc1's picture
Offline
Joined: 06/05/2011
Juice: 109
Re: Re: sell price field

On second thoughts maybe I don't need separate product classes at all. I could just use the "new-price-field" for the no-options products and leave it empty for the options products then in Views 'hide this field if empty'.

thanks

Geva's picture
Offline
Joined: 02/18/2011
Juice: 90
Re:Re:Re: sell price field

Hi Juc1,
thanks for the additional thoughts, your are right width Views,
Good luck and success in your work,
Geva