Contributions

Features (Category Index)
Search: 

Quantity Box in Product Listing v1.0

Quantity Box in Product Listing v1.0
by Aaron Hiatt
aaron@scaredrabbit.com
========================================

This Contribution will add a quantity box above your "Add to Cart" button in the Product Listing (product_listing.php) page. This module works for Version MS2.2 and may have bugs but it works perfectly on my end. If you have any enhancements or changes please feel free to make them here at the Contribution site.


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

All you need to do is make the following simple changes:

1) in catalog/includes/modules/product_listing.php


find:

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;
}



replace with:

case 'PRODUCT_LIST_BUY_NOW':
$lc_align = 'center';
$lc_text = '<form name="cart_quantity" method="post" action="' . tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product', 'NONSSL'). '"><input type="hidden" name="products_id" value="' . $listing['products_id'] . '"><input type="text" name="quantity" value="1" maxlength="5" size="5"><br>' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</form>';
break;
}




2) in catalog/includes/application_top.php

find:

$HTTP_POST_VARS['id']))+1


replace with:

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






-----------------------------------
That's it. You're done!

Expand All / Collapse All

Quantity box in product listing 1.2 6 Apr 2010

I noticed that by the original contribution that the changes made to application_top.php in previous versions of this contribution
did as they were suppose to, but if you tried to add a product with attributes to the shopping cart it would only add the product
and redirect you to the shopping cart instead of the product_info page where you should be forced to select the attributes.
This uses the add to cart button instead of the buy_now button, if you do not like that you will have to make that change.

Quantity Box in Product Listing v1.1 19 Oct 2007
How it worked for me!!! 2 Oct 2007
Cannot Add additional quantity 20 Sep 2007
Quantity Box (Dropdown) 9 Dec 2006
product_listing.php to product_listing.php 22 Dec 2005
Additional Bit for Product Info 23 Nov 2005
Quantity Box in Product Listing v1.0 Aaron Hiatt 26 Apr 2004

Note: Contributions are used at own risk.