Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add Quantity Box?


milwiron

Recommended Posts

Hello,

Can anyone help me find the place the code shown below should be added to the product_info.php page?

Any place I've tried simply doesn't work.

Thank you for any help.

Denny

 

-------------------------------------------------------------------------------------------------------

From the latest documentation "Tips"-

Add Quantity Box

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

when ordering.

Copy this code near the "in_cart" button in the product_info.php page.

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

In application_top.php find this code:

$HTTP_POST_VARS['id']))+1

Replace with this one

$HTTP_POST_VARS['id']))+$quantity

Link to comment
Share on other sites

Look here, not my code, it works!

 

To add box of amount to the page of products_info.php | October 21st, 2005 modificate October 25st, 2005 Often we want to add box of amount to our page of products so that the clients can choose the amount with no need to go to shopping cart.

 

1/open the file produts_info.php and find:

 

<p><?php echo stripslashes($product_info['products_description']); ?></p>

 

add after:

 

<table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo ENTRY_CANTIDAD; ?>??<input type="text" name="quantity" value="1" maxlength="2" size="2"/></td>

</tr></table>

 

2/open the file includes/application_top.php and find:

 

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

 

and replace:

 

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

 

3/open the file includes/languages/english/product_info.php

 

add this before ?>

 

define('ENTRY_CANTIDAD', 'Quantity:');

Link to comment
Share on other sites

Your right, i have modified the code, heres my code:

 

open the file includes/application_top.php and find this code:

 

$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']);

 

 

and replace with this code:

 

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

 

Remember BACKUP BACKUP and BACKUP before you do anything:)

Link to comment
Share on other sites

Here you go, found a complete guide for you, forget the other one, use this. OK

 

Hope this does it for you:)

 

 

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

 

 

This adds a quantity option on the item description page, so that customers can easily add multiple quantities to their shopping cart.

 

It creates a text box with max length of 2 digits before the add to cart button. The label for the text box uses a variable from the current language.

 

================================================================================

==========================

 

in catalog/product_info.php on line 213:

 

replace:

<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>

 

with:

<td class="main" align="right"><?php echo TEXT_QUANTITY . tep_draw_input_field('quantity', '1', 'SIZE=2 maxlength=2') . tep_draw_separator('pixel_trans.gif', '5', '1') . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'align=absmiddle'); ?></td>

 

 

 

in catalog/includes/application_top.php on line 358:

 

replace:

$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']);

 

with:

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

 

 

in catalog/includes/languages/english/product_info.php on line 21 (and any other language you use):

 

after:

define('TEXT_CLICK_TO_ENLARGE', 'Click to enlarge');

 

add:

define('TEXT_QUANTITY', 'Qty:');

 

 

==============================

OPTIONAL FOR OTHER LANGUAGES

==============================

 

in catalog/includes/languages/german/product_info.php on line 21 (and any other language you use):

 

after:

define('TEXT_CLICK_TO_ENLARGE', 'Click to enlarge');

 

add:

define('TEXT_QUANTITY', 'Quantit?t:');

 

 

in catalog/includes/languages/german/product_info.php on line 21 (and any other language you use):

 

after:

define('TEXT_CLICK_TO_ENLARGE', 'Click to enlarge');

 

add:

define('TEXT_QUANTITY', 'Cantidad:');

Link to comment
Share on other sites

  • 8 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...