PDA

View Full Version : Maximum Product Quantity with Admin



michael_s
02-10-2008, 06:57 PM
Many thanks to talking towns for your addition. However i just spent 3 days disseminating my bespoke code thinking i had broken my cart.

I used the

ALTER TABLE `products` ADD `maxorder` INT(4) DEFAULT NULL ;

query (STEP 6 in both kayakbabes and zlochkos contributions) but checkout kept refreshing to the shopping cart again.

therefore i am editing talkingtowns code to read


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
//regards web-junkies


More... (http://addons.oscommerce.com/info/4155)