1. copy this code near your in_cart button in product_info.php, actually you can add this code anywhere.
---------------------------------------------
<input type="text" name="quantity" value="1" maxlength="2" size="2">
--------------------------------------------
2. search your application_top.php
find this code:
---------------------------------------------
$HTTP_POST_VARS['id']))+1
--------------------------------------------
replace with this one
------------------------------------------
$HTTP_POST_VARS['id']))+$quantity
------------------------------------------
done!!
Legend: 
Download

Report
+ added the multilanguage of the term "quantity"
+ changed the dropdown quantity to 15
+ cosmetic changes and alignement
If you use the original version with a textbox (not a dropdown), in application_top.php, change these lines:
case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+$quantity, $HTTP_POST_VARS['id']);
to this:
case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
$qty = preg_replace('/[^0-9]/i', '', $HTTP_POST_VARS['quantity']);
$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+ ($qty == '' || $qty < 1 || $qty > 99 ? '1' : $qty), $HTTP_POST_VARS['id']);
The difference is that if the customer enters something like, "3" as a quantity, it'll be smart enough to add 3 items to the cart instead of telling the customer that it wasn't added to the shopping cart. If they try to add more than 99 or less than 1, it'll add 1 item to the cart anyway.
I needed a solution to list a monthly fee that was to be paid annually or quarterly in the catalog and force the script to add the desired quantity. eg item £1.99 X 12 months. I did not want a quantity box and I wanted to make the quantity different in different products.
Simple one liner .
and 1 mod in application_top.
Just a minor mod of the work below.
Modified from Brandon Clark's version, which was built off of Sean Wang's and Doug Murray's versions.
Notes from 420: Difference in this version is purely cosmetic. I did this for those who aren't familiar enough with HTML to fix it themselves. Changes are as follows:
- Changed "Quantity" to "Qty:"
- Fixed the misalignment issue between the Qty box and the Add to Cart button.
- Added a space between the Qty label and textbox
- Added a .gif seperator between the Qty box and the Add to Cart button
- Added translations for "Quanity" for those who use the German and Espanol languages
This adds a quantity option on the item description page, so that cusomers can easily add multiple quantities to their shopping cart.
Modified from sean wang's and Doug Murray's versions.
It creates a text box with max length of 2 digits right before the add to cart button. The label for the text box uses a variable from the current language.
If you would rather have a pull down quantity menu than a quantity box
in the product information area, this code will do the trick.
1. The best spot for this code is likely after the options and before the in cart button but you
can add it anywhere in the file you want. This code limits the quantity to a max of 5 but you
can change it to anything.
----------------------------------------------
<tr>
<?php
for ($i=0; $i<5; $i++) {
$qty_array[] = array('id' => $i+1, 'text' => $i+1);
}
?>
<td class="main"><?php echo 'Quantity: ' . tep_draw_pull_down_menu('quantity', $qty_array, 1) ; ?></td>
</tr>
-------------------------------------------
2. Like Sean's contribution, search application_top.php for the following code:
---------------------------------------------
$HTTP_POST_VARS['id']))+1
--------------------------------------------
and replace with this:
$HTTP_POST_VARS['id']))+ (int)$HTTP_POST_VARS['quantity']
And that's all folks!
1. copy this code near your in_cart button in product_info.php, actually you can add this code anywhere.
---------------------------------------------
<input type="text" name="quantity" value="1" maxlength="2" size="2">
--------------------------------------------
2. search your application_top.php
find this code:
---------------------------------------------
$HTTP_POST_VARS['id']))+1
--------------------------------------------
replace with this one
------------------------------------------
$HTTP_POST_VARS['id']))+$quantity
------------------------------------------
done!!