greasemonkey 190 Posted April 20, 2013 Here is a simple (2 file changes) mod to add a quantity box to your Buy Now button on product_listing for 2.3.x. Located HERE Works with attributes by directing customer to product_info. If anyone wishes to contribute further I would love to figure out how to have the qty added to the box, when you are using buy now with a product with attributes, carried forward to the product_info qty box (a separate addon). 1 The Lego Man reacted to this Share this post Link to post Share on other sites
The Lego Man 0 Posted November 6, 2013 Hi Scott, I am currently trying to get this set up for my site however as my product_info file has already been modified I am unsure how to do step 2: change from; $prod_list_contents .= ' <td align="center">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id'])) . '</td>'; to -----> $prod_list_contents .= ' <td align="center">' . tep_draw_form('buy_now', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id='. $listing[$x]['products_id']), 'POST') . '<table cellSpacing="0" cellPadding="0" width="100%"><tr><td align="right" width="25%">' . tep_draw_input_field('buyqty', '1', 'size=3 maxlength=3') . '</td><td align="center" width="75%" valign="absmiddle">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart') . '<td align="absmiddle">' . '</td></tr></table></form>'; The code I have is as follows: case 'PRODUCT_LIST_BUY_NOW': $prod_list_contents .= ' <td align="center">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $listing['products_id'])) . '</td>'; $prod_list_grid .= '<br>' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'])); break; } I am using a Grid product layout for some pages. Any help with figuring out what I need to do to correctly add in the quantity boxes would be great. I am able to get the quantity box to appear alongside the buy now button however the functionality of the produced actually being added to the shopping cart is not working. Thanks, David Share this post Link to post Share on other sites
greasemonkey 190 Posted November 6, 2013 @@The Lego Man, so I understand correct... you can get the box to show, it just doesn't work (add to cart)? Have you made the changes to application_top? Also, It may help to show what you changed your code "to" to get it box showing in product_listing... Share this post Link to post Share on other sites
The Lego Man 0 Posted November 7, 2013 (edited) @@greasemonkey Thank you for the reply! Yes, I have made the changes to application_top To get the box to appear where I want it, I simply placed your suggested code in the the prod_list_grid line (please see below) Note - changing the $prod_list_contents had no effect, probably as I am using a grid layout for my products - so this line (second line) is unchanged in both code snippets below. My previous code was as follows: case 'PRODUCT_LIST_BUY_NOW': $prod_list_contents .= ' <td align="center">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $listing['products_id'])) . '</td>'; $prod_list_grid .= '<br>' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'])); break; Replaced with: case 'PRODUCT_LIST_BUY_NOW': $prod_list_contents .= ' <td align="center">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $listing['products_id'])) . '</td>'; $prod_list_grid .= '<br>' . tep_draw_form('buy_now', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id='. $listing[$x]['products_id']), 'POST') . '<table cellSpacing="0" cellPadding="0" width="100%"><tr><td align="right" width="25%">' . tep_draw_input_field('buyqty', '1', 'size=3 maxlength=3') . '</td><td align="center" width="75%" valign="absmiddle">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart') . '<td align="absmiddle">' . '</td></tr></table></form>'; break; See screenshot of before (L) and after (R ) below is shown here http://minifigbay.com/after.png Edited November 7, 2013 by The Lego Man Share this post Link to post Share on other sites
greasemonkey 190 Posted November 8, 2013 Try changing this; $prod_list_grid .= '<br>' . tep_draw_form('buy_now', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id='. $listing[$x]['products_id']), 'POST') . '<table cellSpacing="0" cellPadding="0" width="100%"><tr><td align="right" width="25%">' . tep_draw_input_field('buyqty', '1', 'size=3 maxlength=3') . '</td><td align="center" width="75%" valign="absmiddle">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart') . '<td align="absmiddle">' . '</td></tr></table></form>'; to $prod_list_grid .= '<br>' . tep_draw_form('buy_now', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id='. $listing['products_id']), 'POST') . '<table cellSpacing="0" cellPadding="0" width="100%"><tr><td align="right" width="25%">' . tep_draw_input_field('buyqty', '1', 'size=3 maxlength=3') . '</td><td align="center" width="75%" valign="absmiddle">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart') . '<td align="absmiddle">' . '</td></tr></table></form>'; 1 The Lego Man reacted to this Share this post Link to post Share on other sites
The Lego Man 0 Posted November 8, 2013 @@greasemonkey Really appreciate your help with this, it is working as hoped now. Made my day. Thank you! Share this post Link to post Share on other sites
greasemonkey 190 Posted November 8, 2013 @@The Lego Man, no prob... I've fixed the typo and uploaded as 1.2a. Share this post Link to post Share on other sites
The Lego Man 0 Posted November 12, 2013 @@greasemonkey Hi again, Just curious as to whether it is possible to have the quantity box display on the product's individual page as well as the on the category page. Currently I have it working on the category page but if you click on a product it doesn't show. Share this post Link to post Share on other sites
greasemonkey 190 Posted November 12, 2013 Yep, just search the addon area for "Quanity box product info" 1 The Lego Man reacted to this Share this post Link to post Share on other sites
The Lego Man 0 Posted November 12, 2013 @@greasemonkey I downloaded qbox and uploaded the files from the aas_v0.2_bugfixes folder. No files were overwritten so I'm taking it that all files were new. I don't see any difference to the product page. No qty box visible. Did I only upload files to fix a bug ? Any ideas? Share this post Link to post Share on other sites
greasemonkey 190 Posted November 12, 2013 I'm not sure what you installed... I would un do it. There should be no new files... Only a couple quick edits to product_info (and product info language file) and application_top. Don't forget to back up first!!!!! This is the one I use; http://addons.oscommerce.com/info/7914 @@The Lego Man 1 The Lego Man reacted to this Share this post Link to post Share on other sites
The Lego Man 0 Posted November 13, 2013 Thanks @@greasemonkey I had installed some other add-on. All removed now. Thank you! Share this post Link to post Share on other sites
Chill_Factor 0 Posted December 27, 2013 @@greasemonkey I have added the code as you have specified in the post #5. I can see the quantity box and can add items to the card, however no matter whether I use the line or grid layout the quantity box display is very long (it should only have size=3) and therefore the whole layout looks messed up. I am using oscommerce 2.3.3.4 with MTS if this is of any help. Please advice what should be done to have a nice neat box displayed. Share this post Link to post Share on other sites
♥multimixer 325 Posted December 28, 2013 @@Chill_Factor Please check my answer via PM My community profile | Template system for osCommerce - New: Responsive | Feedback channel Share this post Link to post Share on other sites
DavidSJohnston 0 Posted November 30, 2015 Hi, I was pointed to this add-on by another forum member, and I applied it to a one-click-install of osC2.3.4 and it worked fine for me. I have now installed 2.3.4BSGOLD, and The second file that needs to be modified does not have the correct original line in it, well it does, but it is very different. The forum member who pointed me in the direction of this add-on also said that it is easy to change it for BS2.3.4. Has anyone here done so? if so would you be willing to share? regards, dave. Share this post Link to post Share on other sites
greasemonkey 190 Posted November 30, 2015 @@DavidSJohnston yes this can easily be adapted to 2.3.4bs gold. Post the lines you are having an issue with. Share this post Link to post Share on other sites
DavidSJohnston 0 Posted November 30, 2015 (edited) Hi @@greasemonkey, According to the install.txt there are two parts to the install, the first was to modify /includes/application_top.php . That was a simple copy and paste job. The second part requires you to replace the following in /includes/modules/product_listing.php change from; $prod_list_contents .= ' <td align="center">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'])) . '</td>'; to -----> $prod_list_contents .= ' <td align="center">' . tep_draw_form('buy_now', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id='. $listing['products_id']), 'POST') . '<table cellSpacing="0" cellPadding="0" width="100%"><tr><td align="right" width="25%">' . tep_draw_input_field('buyqty', '1', 'size=3 maxlength=3') . '</td><td align="center" width="75%" valign="absmiddle">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart') . '<td align="absmiddle">' . '</td></tr></table></form>'; I cannot find the exact line to change, the closest I can find is (line 221 in my case) : $prod_list_contents .= ' <div class="col-xs-6 text-right">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']), NULL, NULL, 'btn-success btn-sm') . '</div>'; regards, dave. Edited November 30, 2015 by DavidSJohnston Share this post Link to post Share on other sites
greasemonkey 190 Posted November 30, 2015 (edited) @@DavidSJohnston..... Look here $prod_list_contents .= ' <div class="col-xs-6 text-right">' . tep_draw_form('buy_now', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id='. $listing['products_id'], $request_type), 'POST') . tep_draw_input_field('buyqty', '1', 'style="width:44px;text-align:center;"', 'tel') . ' ' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', NULL, NULL, NULL, 'btn-success btn-sm') . '</form></div>'; Edited November 30, 2015 by greasemonkey Share this post Link to post Share on other sites
JJTRADINGCANADA 0 Posted October 16, 2017 Hello...is there a working version of this for 2.34 using MTS? Thanks in advance Share this post Link to post Share on other sites