Configure Ubercart Subproduct (uc_subproduct)

Goal

To configure Ubercart subproduct to enable display of sub-product nodes in a table on a master node.

Example

We are working towards creating a page like this.

Glossary

  • Sub-product - regular Ubercart products that are grouped together due to a common element. Referring to the example, the subproducts there are as follows:
    • Lift Off Rocket Single Quilt Cover Set
    • Lift Off Rocket Double Quilt Cover Set
    • Lift Off Rocket Novelty Cushion
  • Master-product - the node that is used to group the sub products together. Note that this node-type is not a product class. Referring again to the example, the master product here is Lift Off' Rocket Quality Bed Linen & Accessories - the example page is the node page for the master product.

Configuration

1. At admin/content/types, configure the content type(s) for the products that will be your sub-products. (You can use either the standard Ubercart “products” content type, or a new product class that you create at admin/store/products/classes.) If you need to add additional CCK fields, add them under the “manage fields” tab. Set your field display options under the “display fields” tab. DO NOT add a node reference field to this content type. DO NOT check the Ubercart boxes under “submission form settings.” Set up the content type as you would for any product, without worrying about the sub-product module. Referring to the example, the node type used is the standard Ubercart product. Only the image field supplied by Ubercart is added to that content type. 2. At node/add/[sub-product content type], create your various sub-products as you would create any other ubercart product. Referring to the example, these nodes are
  • Lift Off Rocket Single Quilt Cover Set
  • Lift Off Rocket Double Quilt Cover Set
  • Lift Off Rocket Novelty Cushion
3. Create a new content type for your master product at admin/content/types. NOTE: The new master product content type should be a standard node, not an Ubercart product, even though it is referred to as a “master product.” This node is essentially a carrier for a table that lists the sub-products. In the example the node type chosen was called 'master'. 4. Under “submission form settings” for the master product type, check the box for “setup display fields for UC sub-product” and “treat this node type as an Ubercart product.” 5. Using the “manage fields” tab for the master product, add a node reference field to your master product. Select the “check boxes/radio buttons” widget type, check the “required” box, and set the permissible number of values. Check the node type(s) that you will refer to. In the case of the example, the node type chosen was 'product'. 6. Using the “display fields” tab for the master product, set the display type for your node reference field to “UC sub-product add to cart form.” Make this setting on only the “basic” tab - the “UC sub product” tab is irrelevant. 7. At node/add/[master product content type], create a master product. You will find a CCK node reference field (check boxes) for your sub-products. Check the boxes for the nodes (products) that you want to include in your sub-product table. You will also find a section for “sub product display.” Add and arrange the product fields that you want to display in your table. So in the example, we created a node of type 'master' titled 'Lift Off' Rocket Quality Bed Linen & Accessories' and chose the following sub products with our node-reference field:
  • Lift Off Rocket Single Quilt Cover Set
  • Lift Off Rocket Double Quilt Cover Set
  • Lift Off Rocket Novelty Cushion
8. Save your new master product. It should display a table with your sub-products and either an “add to cart” link next to each one, or (if you have installed a template override in your template.php file as mentioned elsewhere) one “add to cart” link at the bottom. 9. To control how the CCK fields you added to the 'sub-product' are displayed, visit admin/content/types then choose the node type of the sub-product (in the example this is the product type), click on the display fields tab and then on the “UC sub product” tab. Here you can control how the CCK fields - eg images are displayed in the table of sub-products. In the case of the example, the images are displayed as smaller thumbnails in the table.