Community Add-Ons
Add Quantity to Listings
for osCommerce Online Merchant v2.2
*ZIP FILE SAYS SAME THING*
To add a quantity field in the product listing view go to
includes/modules/product_listing.php
replace
case 'PRODUCT_LIST_BUY_NOW':
$lc_align = 'center';
$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
break;
}
With
case 'PRODUCT_LIST_BUY_NOW':
$lc_align = 'center';
$lc_text = tep_draw_form('buy_now' . $listing['products_id'], tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']), 'POST') . tep_draw_input_field('list_quantity', '1', 'size=2') . tep_image_submit('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</form> ';
break;
}
Legend:
Download
Report
(nothing more in .zip)
product_listing.php near line 200 :
case 'PRODUCT_LIST_BUY_NOW':
$prod_list_contents .= ' <td align="center">' . tep_draw_form('buy_now',
tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id')) .
'action=buy_now&products_id='. $listing[$x]['products_id']), 'POST') . '<input type="text"
name="cart_quantity" value="1" maxlength="2" size="2">' . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart',
null, 'primary') . '</form></td>';
break;
application_top.php near line 380 :
case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) {
if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' .
$HTTP_GET_VARS['products_id']));
} else {
$cart->add_cart($HTTP_GET_VARS
['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$HTTP_POST_VARS['cart_quantity'],
$HTTP_POST_VARS['id']);
}
