Ok. Here is a quick tutorial on how to add custom fields to your product and how to display them to your users:
- Enable CCK, Contemplate and CCK’s Text and Option Widgets modules.
- Go to Administer >> Content management >> Content types and edit the product type.
- Click the Add field tab.
- Add a new Text > Check boxes/radio buttons field.
- In the Allowed values list add:
Inc. VAT
Exc. VAT - Now either create a new product or edit an existing one to see your new field displayed on the create/edit product page.
- Add the field to your product so we can theme it later.
- Go to Administer >> Content management >> Content types and edit the product type.
- Click the Display fields tab.
- Select for the Label option associated with your new text field.
- Go to the product page for which you have activated the text field.
- Click the Dev render tab.
- Scroll down the page to field_nameofyourfield_field and you will see that there is an array containing your text. This is a handy way to see in what format you data is being handed to the theme. If you know what you’re doing this will be all you need to theme your content types.
- Go to Administer >> Content management >> Content templates and create a template for Products. Expand the body fieldset and click Affect body output.
- Scroll down the Body Variables pane and find the variables needed for your content type. You can copy them into a textfile with labels so you know exactly what each bit of code will display. Note: you will need to get all the variables that you wish to display on your product page.
- Copy the file node.tpl.php in your theme dir and rename it to node-product.tpl.php. Look at the file and see how it works.
- Replace the <?php print $content; ?> with the variables you got from step 15. Remember that you might need to add the correct HTML and CSS depending on which variables you picked.
This little tutorial applies to any content types created with CCK. Not just Ubercart products. Hope it helps.


