This contribution is an excellent idea, but I found that it was possible to fill the cart with more than the maximum and proceed directly to checkout, bypassing the good work done by shopping_cart.php.

The following snippet, inserted in the top of the catalog/checkout_shipping.php file, solved the problem for me, by redirecting "overfull" carts at checkout back to /catalog/shopping_cart.php to be corrected.

If it helps you too, my work here is done!


Find
if (!tep_session_is_registered('cartID')) tep_session_register('cartID');
$cartID = $cart->cartID;

Insert after

//Check for maximum quantity
if(MAXIMUM_ORDERS == 'true'){
for ($i=0, $n=sizeof($order->products); $iproducts[$i]['id']."'");
while ($max_order = tep_db_fetch_array($max_order_query)) {
// set the cart item max var
if ($order->products[$i]['qty'] > $max_order['max_quant'] ) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART) );
}
}
}
}
//End MAXIMUM quantity code

More...