Contributions

Features (Category Index)
Search: 

Add Quantity to Listings

*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>&nbsp;';
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>&nbsp;';
break;
}

Expand All / Collapse All

update osc 2.3 23 Apr 2011

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

Making it work 2 Sep 2010
Extra change 13 Jun 2007
Contrib that worked for me Alex Norden 14 Oct 2004
AddQuantityToListingv1.2 Aernout Koole 22 Sep 2004
Add Quantity to Listings v1.1 Raven 30 Aug 2004
Added Qty text next to box Mike Benstead 11 Aug 2004
AddQuantityToListing v1.0 Joachim Ott 3 Aug 2004
Quantity errors Raven 1 Jun 2004
Add Quantity to Listings agiftco.com 21 May 2004

Note: Contributions are used at own risk.