As I had to do this anyway if anyone needs it heres how it can be done ...
this is done for 4.1.8 but it should not be too hard to adjust it for other versions. Its basically a rehash of the max amount setting.
for starters put this into the config table
Code:
INSERT INTO `xcart_config` ( `name` , `comment` , `value` , `category` , `orderby` , `type` , `defvalue` , `variants` )
VALUES (
'minimum_order_items', 'Minimum allowed total quantity of products in an order (0 means no maximum limit)', '3', 'General', '320', 'numeric', '0', ''
);
Then edit cart.php and find ...
Code:
if ($mode == "checkout" && !$func_is_cart_empty && $config["General"]["maximum_order_items"] > 0 && func_cart_count_items($cart) > $config["General"]["maximum_order_items"]) {
#
# ERROR: Cart total must not exceeds the maximum total quantity of products in an order (defined in General settings)
#
func_header_location("error_message.php?error_max_items");
}
and just after it add this
Code:
#
# SHAN ADDED TO SET MIN AMOUNT OF PRODUCTS BEFORE CHECKOUT
#
if ($mode == "checkout" && !$func_is_cart_empty && $config["General"]["minimum_order_items"] > 0 && func_cart_count_items($cart) < $config["General"]["minimum_order_items"]) {
#
# ERROR: Cart total must not exceeds the minimum total quantity of products in an order (defined in General settings)
#
func_header_location("error_message.php?error_min_items");
}
Next up add the following language variable via the languages section
Code:
topic - errors
code - err_checkout_min_items_msg
text - The quantity of products in one order must exceed {{quantity}} items.<br />
Please review your cart and add more items before you can checkout.
next up edit skin1/customer/home_main.tpl
find
Code:
{elseif $main eq "error_max_items"}
{include file="main/error_max_items.tpl"}
and just after it add this ..
Code:
{elseif $main eq "error_min_items"}
{include file="main/error_min_items.tpl"}
finally make a new tpl file (you can make a copy of error_max_itemps.tpl)
skin1/main/error_min_items.tpl
this is the code for the template file
Code:
{* $Id: error_min_items.tpl,v 1.2 2005/11/17 06:55:39 max Exp $ *}
<font class="ErrorMessage">
{$lng.err_checkout_min_items_msg|substitute:"quantity":$config.General.minimum_order_items}
<br /><br />
{include file="buttons/go_back.tpl"}
</font>
you should now be able to set the minimum amount of items that need to be added to the cart before someone can checkout. If you leave this as zero then it will be ignored