Contributions
Maximum Product Quantity with Admin
# MAXIMUM Product Quantity with Admin 1.0
# A little history on this contrib:
It is based very very heavily on
MINIMUM Product Quantity with admin version 1.5 that was started by Mark Rickert
Contribution located at: http://www.oscommerce.com/community/contributions,2953
I needed to be able to limit specific products to a maximum purchase quantity, especially products on special or upsale at checkout.
This contributions puts a limitation of how many items a customer can purchase, also takes into account products with different attributes.
I wanted to only sell one of an item regardless of the options it had.
That way I could run a sale on an item but still give the customer a choice about what color or size they wanted.
With this contribution I can make sure they only get 1 T-shirt per order, but they can still get the size option they need.
So in the spirit of oscommerce and the gnu... I have not only modified the minimum quantity purchase, but I have shamelessly taken the documentation and just changed a few words and updated several queries and things.
I haven't tested the combo, but I beleive this will work well with minimum purchase quantity too!
Kayakbabe - 9 April 2006
Expand All / Collapse All
If you want to use NULL as the default value for maximum product quantity and set individual levels via the admin please use this contribution.
This is a complete package to fix broken checkout and maximum quantity changing from null to 0 when editing a product.
The support thread link has also been updated.
the changes have been made to step 10 in kayakbabes and zlochkos contributions and also icludes the changes to talkingtowns tweak below.
Regards, web-junkies
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); $i<$n; $i++) {
$max_order_query = tep_db_query("select p.maxorder as max_quant FROM " . TABLE_PRODUCTS . " p where p.products_id = '".$order->products[$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
This is the whole package. It contains one more step in the installation procedure - step 2.5.
This step allows you to change the input field in the shopping cart with a select box. The select box will allways have the maximum number of items allowed for pruchasing per product.
http://forums.oscommerce.com/index.php?showtopic=203840
# MAXIMUM Product Quantity with Admin 1.0
# A little history on this contrib:
It is based very very heavily on
MINIMUM Product Quantity with admin version 1.5 that was started by Mark Rickert
Contribution located at: http://www.oscommerce.com/community/contributions,2953
I needed to be able to limit specific products to a maximum purchase quantity, especially products on special or upsale at checkout.
This contributions puts a limitation of how many items a customer can purchase, also takes into account products with different attributes.
I wanted to only sell one of an item regardless of the options it had.
That way I could run a sale on an item but still give the customer a choice about what color or size they wanted.
With this contribution I can make sure they only get 1 T-shirt per order, but they can still get the size option they need.
So in the spirit of oscommerce and the gnu... I have not only modified the minimum quantity purchase, but I have shamelessly taken the documentation and just changed a few words and updated several queries and things.
I haven't tested the combo, but I beleive this will work well with minimum purchase quantity too!
Kayakbabe - 9 April 2006
Note: Contributions are used at own risk.