Downloads
Development sponsored by: Plum Drama, a personalized party favors site.
The Product Minimum module lets you specify a minimum order size for products in your catalog. It also lets you specify whether the product must be ordered in multiples of that value or not.
It does this by adding two fields to the product edit form:
- A text field where you can enter the minimum amount that must be purchased.
- A checkbox that may be checked to specify this product as only sold in sets of that value.
- uc_product_min_checkout_pane() - defines the checkout pane; gives it a default weight that ensures it is called first
- uc_checkout_pane_product_min() - Since checkout panes are called first on the checkout page, you can redirect back to the cart page if your conditions aren't met and the customer will not notice.
- uc_product_min_nodeapi() - lets this module hook into the node process to save, load, display, and delete data attached to the node
- uc_product_min_form_alter() - hooks into the product form to add the fields for product settings enabled by this module
- theme_uc_product_min() - the theme function used to display the content added to the node by this module; a theme function is used so other admins can override the way this is displayed
The module will also display a message on the product view page telling the settings to the customer. Appropriate error messages are displayed if a customer tries to checkout inappropriately.
Code examples:
Use this module for an example of using a checkout pane to require certain conditions to be met before a customer can proceed to checkout. Look specifically at the following functions:
Also use this module for an example of how to add fields to products. Because product nodes may be of many different types, you need to use a special if statement in hook_form_alter() to determine if the admin is editing a product node form. Look specifically at the following functions:
Development
| Preview | Attachment | Size |
|---|---|---|
| uc_product_min.tar | 10.5 KB |
