5 replies [Last post]
awebmanager's picture
Offline
Joined: 11/11/2010
Juice: 54
Was this information Helpful?

I am quite new to Ubercart but have used Drupal for quite a while and can add custom fields etc. What I can't do is get my product information to appear to the customer in the desired format/order.

I am selling cheese and what I really want is this (in this order):

Description with inline image
"Display price & type" (a custom text field I've added to the product content type submit form that says e.g. "£2.60 per kilo" or "£3.99 each")
Select amount (a custom option I've added and can configure in admin/store/attributes/1/options)
Add to cart button.

Instead what I've got is:

Display price & type
Select amount
Add to cart button
Description
Image floating above the description

I can configure my custom fields added to the product content type in admin/content/node-type/product/display and can turn the standard fields on and off and reorder them in admin/store/settings/products/edit/fields but there seems to be no way of ordering ALL of the fields in relation to each other (preferably on a single form) so they display to the customer the way I want them to. Unless I'm missing something, I can't see why this is so difficult!

Cheers

awebmanager's picture
Offline
Joined: 11/11/2010
Juice: 54
Re: How do I customise the product layout wth (custom) fields?

Sorry to bump this, but I really need some help. Any assistance would be appreciated...

kthull's picture
Offline
Joined: 01/05/2009
Juice: 87
template file

If you are talking about your individual product node display, then you'll need to create a template file to achieve what you want to do. If your node type is product, then you would duplicate your theme's node.tpl.php and rename it to node-product.tpl.php (or if you have a product class assigned to a cheese content type, then it would be node-cheese.tpl.php). You'll also need to use the devel module to look at the array structure in order to see which php print statements to sprinkle throughout your template file's markup.

I can't get really get more specific than that, but there are plenty of introductory theming videos out there from past camps and cons. The Lullabot theming videos are also stellar.

FYI, I'm @dkcreations on twitter.

WebNewCastle's picture
Offline
Joined: 04/29/2009
Juice: 595
Re: How do I customise the product layout wth (custom) fields?

Ditto on the above. And to get some ideas on how to do this, I know I've seen at least one sample on the site in the past. I want to say it had a title like Nifty Product ... layout or tutorial or something along those lines - if you want to do a search for it.

Some have opted to use the Contemplate module to make changes to the way parts of nodes are displayed, but I have no idea if the module will handle Ubercart products or not. I don't use it; I almost always have a completely custom product node template on my projects.

- Matt

Matthew Winters / WebNewCastle.com - Drupal & Ubercart development, training, and consulting. Drupal profile
Online community, product development, & policy management.

awebmanager's picture
Offline
Joined: 11/11/2010
Juice: 54
Re: Re: How do I customise the product layout wth (custom) field

Belated thanks to both of you for these replies Smiling This helps a lot. I am investigating!

awebmanager's picture
Offline
Joined: 11/11/2010
Juice: 54
Success!

Thank you both again very much for your comments Smiling I first off consulted the theming section of John K VanDyk's excellent Pro Drupal Development, which made some sense although as a beginner in PHP and Drupal development most of it went over my head. He has a handy bit of debug code that he suggests adding to the top of the node.tpl.php file which lists all the properties of a node:

<pre>
  <?php print_r($node) ?>
</pre>

I wasn't able to do much with what came out however, as I didn't know the conventions.

Then I tried WebNewCastle's suggestion of the Contemplate module (incidentally I had trouble getting it to show up in my modules list so had to clear the Drupal cache to get it to show) and it worked a treat Smiling I have now successfully laid out my product template exactly as I wanted it using this module.

So, thanks again guys!