Add Quantity Box to Products PageLast Update: 17th August, 2005
Article ID: 246



Introduction

This code can be added in the product_info.php page to add a quantity box for customers when ordering.

Solution

Find this code in product_info.php:

<td class="main" align="right"><?php echo osc_draw_hidden_field('products_id', $Qproduct->valueInt('products_id')) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>


and after the php code and before the </td> add:

<input type="text" name="quantity" value="1" maxlength="2" size="2">


It will look like this and puts the quantity box to the right of the "add to cart" graphic button:

<td class="main" align="right"><?php echo osc_draw_hidden_field('products_id', $Qproduct->valueInt('products_id')) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?><input type="text" name="quantity" value="1" maxlength="2" size="2"></td>



Then in includes\application_top.php around line 143 find this code:

$cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id']))+1, $_POST['id']);



Replace with this one

$cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id']))+$_POST['products_id'], $_POST['id']);


 

 

Trademark Policy | Copyright Policy | Sitemap

Copyright © 2000-2005 osCommerce. All rights reserved.