Minimum and Maximum Quantity
Copyright © 2002, William Weiland
Overview
Set minimum and maximum quantity order rules. You can establish a required minimum number of each product that must be ordered. You can also establish a maximum number of each product that can be in a single order.
Initial Setup
1) In admin, click Add Modules
2) Click the file upload button
3) Browse to find the cim_qmin.mv file on your hard drive and upload
4) Click Add to add it to the domain
5) Click the image to the left of your store name
6) Click on the System Extension Configuration link
7) Check the box to the left of CIM Minimum and Maximum Quantity and select Update

System Configuration

You can include a message box when the customer attempts to order a quantity that is below the minimum or above the maximum for the product. If you leave the override messages blank, then there will be no message box displayed when the customer is out of bounds.

Product code quantity rules are set by including the product code, the minimum and the maximum. Each are separated with the ^ character and the line is terminated with the | character. Example: XYZ123^1^20| would apply the rule to product XYZ123 with an order minimum of 1 and maximum of 20. If you effectively have no maximum, put in the number 999999 or whatever you think would be necessary to limit the quantity.

In the compiled version of the module (Merchant 4.14 and newer with OpenUI), you can have an optional multiple select box replace the text input for quantity. To do this, include a 4th parameter on the line. The 4th parameter must be equal to the 2nd (minimum) and be evenly divisible into the 3rd (maximum), e.g. XYZ123^2^24^2| or you can map the entire select list e.g. XYZ123^2^24^+2,6,12,18,24| With this latter, start the 4th parameter with a + character and follow with the list from the minimum to the maximum with each value separated with a comma. If you use the + at the beginning of the 4th parameter, you can have a 5th parameter for labels. The label is what is seen in the drop down box. Example:
4th parameter: +2,6,12,18,24
5th parameter: 2 @ $5.00,6 @ $4.75,12 @ $4.50,18 @ $4.25,24 @ $4.00
This is merely an example of using labels. In order to get the actual discount pricing you would need to be using our Volume Pricing module.

Alternatively, you can apply the rules to every product code in your store. ALL^1^999999| would apply the 1 minimum and 999999 maximum to all products.

These rules apply to product codes. The attributes do not make the entry start a new calculation. Hence, if you have a shirt as product XYZ123 and set the limit to 10, the customer could buy 5 blue and 5 red to total 10. But they could not buy 10 blue and 10 red as the product code would exceed the 10 maximum for that product code.


Editing Option (skip if using the OpenUI)
If you are using the Miva Merchant User Interface (mmui) you will need to make some very simple edits to the core files. Be sure to do that with a text editor (NO WYSIWYG editors) such as Programmer's File Editor (PFE) so as not to damage the mv files. ALWAYS BACKUP your unmodified mv files in case you make a mistake. Note: If you are using Merchant 4.14-4.2X use cim_qmin.mvc instead of cim_qmin.mv in the below three edits.

In the mmui.mv file locate the MMUI_Begin_Screen function. On the line before the first <TABLE tag in this function, place the following line:
<MvDO FILE = "{g.Module_Root$'modules/system/cim_qmin.mv'}" NAME = "l.showbox" VALUE = "{Show_QMin_Errors()}">

In the mmui.mv file locate the MMUI_ProductDisplay function. Within that function locate the following line:
<INPUT TYPE = "text" NAME = "Quantity" VALUE = 1 SIZE = 4>
Change that line to read (with the double ## at both ends):
<##INPUT TYPE = "text" NAME = "Quantity" VALUE = 1 SIZE = 4##>
then insert the following line after it.
<MvDO FILE = "{g.Module_Root$'modules/system/cim_qmin.mv'}" NAME = "l.showbox" VALUE = "{Show_QMin_Prompt()}">

In the mmui.mv file locate the MMUI_DisplayBasket function. Locate the quantity input like you did in the productdisplay function and comment it out. Then insert the following.
<MvDO FILE = "{g.Module_Root$'modules/system/cim_qmin.mv'}" NAME = "l.showbox" VALUE = "{Show_QMin_Basket_Prompt()}">