Quantity Box

Add a quantity text box before the ‘add to cart’ button on the product page to allow a quantity to be posted to the shopping cart.

Demo:

Step 1:
in includes/application_top.php
find:
$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

change to:
$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+$HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);


( This changes the +1 to
$HTTP_POST_VARS[‘cart_quantity’] )

Step 2:
in product_info.php
find:
<?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>

just in front of that add:
<input type="text" name="cart_quantity" value="1" maxlength="2" size="2">

(this is also posted on ‘Tips and Tricks’ section of the OSCommerce Forum)
Add a Quantity box