Hello Drupal community!

I have spent the past few weeks diving into Drupal and I am surprised at how much I have learned since then. I still consider myself a newbie, but I am sure I know more than the average joe. I have done as much as I can with the admin/modules, and now I need to customize how the HTML is processed to make CSS themeing easier.

I am using Ubercart with the Catalog module. The product detail page gives me:
1. the SKU in the top left
2. the price in the top right
3. an image below 1 and 2
4. description text below the image
5. item dimensions below the description
6. and an add to cart button at the bottom

This isnt the way the customer wants to view his products.. he would prefer a page like so:
1. image
2. description floated left
3. price / add to cart / item dimensions floated right

I dug around the template/PHP and realized that all the HTML exists in a PHP variable called $content. I need to do things with the HTML in $content like add div wrappers and adjust the order the div elements are outputted so applying CSS can be easier.

I think im on the right track by saying "I need to preprocess $content" but im sure im light years away from the solution. To be honest, im a little burnt out on Drupal, but my boss isnt going to give me a break. If I could get some links to nice tutorials, guides or whatever I should be reading to get my desired result, I would be most grateful.

THANKS! :)

Comments

styro’s picture

I don't think you want to directly change the $content variable in the page or node templates.

You should look at overriding the stuff Ubercart (which I'm not familiar with) does which then gets used by Drupal for $content.

If you install the devel module, the theme developer bit will tell you which theme functions and templates Drupal is using to do what. Then you can override those lower level bits.

http://drupal.org/node/209561

--
Anton

treadings’s picture

by creating a node-product.tpl.php (copy and re-name node.tpl.php in theme directory)

you will find the $content variable is printed somewhere midway down the page. Commenting this out removes the unwieldy $content variable and you can just print things like $node->content['body']['#value'] or $node->content['image']['#value'] for the image.

if you haven't installed the devel module do it immediately - it'll save you loads of time:

in this example, if you click on the dev render tab from a product node it will show you a complete krumo breakdown of the node object so you can see what data is available to your template. Watch out with the included theme developer module though, especially if you have Dhtml menus installed, as it can cause issues (issues resolved by just disabling it).

I realise this post is probably too late for nick, thought it might help others though.