Product Minimum for Checkout

Contrib type: 
Module
Status: 
Complete and working

Downloads

Compatibility: 
Ubercart 1.x

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.
  • 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.tar10.5 KB
Mariano's picture
Offline
Joined: 09/04/2007
Juice: 110
Alpha 8 Revision

As a matter of fact, this module also works with Ãœbercart's current alpha 8 version.

jmary's picture
Offline
Joined: 01/09/2008
Juice: 55
How to modify this to ...

We have supplier content type made with CCK. And clients can order from several suppliers but each supplier may have a minimum amount to proceed order. That minimum amount is stored in a CCK field.

I want to modify this module in order to have that minimum amount checked according to each supplier preference and If it is not reached the client is given message about what to do.

Any hint/suggestion ?

--
Julien
http://www.progression-asia.com/index.php

Strompf's picture
Offline
Joined: 12/27/2008
Juice: 69
Doesn't seem to work

Strange: It doesn't seem to work on the site I'm working on right now. The two controls appear, and in the Catalog, the message is displayed about the minimum amount, but it isn't functioning. I can still add whatever quantity I want to.

Any help is appreciated, although I suspect this to be an excellent opportunity to delve a bit into the internals of Drupal and/or Ubercart.

bibeksahu's picture
Offline
Joined: 06/09/2009
Juice: 76
Updated version for Drupal 6.x / Ubercart 2.x

Updated contribution page: http://www.ubercart.org/contrib/11407

Converted mostly by deadwood (http://boombatower.com/tools/deadwood) with a tiny bit of hand-tweaking.

N8thh's picture
Offline
Joined: 07/01/2009
Juice: 9
Using content import with product mimimum.

Hi there,

Does anyone know how to get the product import to work with a field for this product minimum as i find when mapping the fields, there is no selection for minimum order number.

Many thanks