Product Minimum for Checkout (6.x/UC2)

Contrib type: 
Module
Status: 
Uploaded for testing
Moderation: 
Awaiting moderation

Downloads

Compatibility: 
Ubercart 2.x

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.
  • 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:

    • 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.

    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:

    • 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

PreviewAttachmentSize
uc_product_min-6.x-2.x.tar.gz3.05 KB
jpdaut's picture
Offline
Joined: 02/25/2009
Juice: 70
How to download

Same here. I would like to download this but cannot find a link on this page.

fred0's picture
Offline
Joined: 07/05/2009
Juice: 10
Updated module

I too needed this module and couldn't find anywhere to download the update. Instead, I used the deadwood converter mentioned above to do the basic update and then added some manual fixes:
-added hook_theme registration (as described here http://deekayen.net/new-hooktheme-drupal-6 and here http://api.lullabot.com/file/examples/nodeapi_example.module/6/source)
-rearranged posistion of functions in .module file to group them in way that was easier to read

While this seems to work just fine, I have not fully tested the module so standard disclaimers apply.

AttachmentSize
uc_product_min.tar.gz 3.22 KB
Scott M. Sanders's picture
Offline
Joined: 04/24/2009
Juice: 326
Does this work anymore?

With RC6, both above versions appear on product edit, but only Fred's appears on product view, and yet neither actually enforce either the minimum nor multiples requirements...

Scott M. Sanders's picture
Offline
Joined: 04/24/2009
Juice: 326
Custom Price!

I figured out how to enforce sets with the lovely Custom Price module instead: http://drupal.org/project/uc_custom_price

$item->qty = 12*round($item->qty/12);
if($item->qty == 0) $item->qty = 12;

For example, this will force shoppers to order a product in sets of 12. You should let them know this on the product page.

fred0's picture
Offline
Joined: 07/05/2009
Juice: 10
Combined modules

FYI, I combined min & max modules and released them via the drupal.org repository here:
http://drupal.org/project/uc_product_minmax