An update of "Product Minimum for Checkout" module (http://www.ubercart.org/contrib/274) to work with Drupal 6.x / Ubercart 2.x.
The majority of the work was done by deadwood (http://boombatower.com/tools/deadwood), with me only making one trivial change to get it running. The previous version was "Complete and Working"; this version is not yet tested on a production system, but appears to work just fine.
Description copied from http://www.ubercart.org/contrib/274
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.
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: