Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Quantity box in product listing 1.2 for 2.3


Recommended Posts

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).

Link to comment
Share on other sites

  • 6 months later...

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

Link to comment
Share on other sites

@@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 by The Lego Man
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 1 month later...

@@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.

Link to comment
Share on other sites

  • 1 year later...

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.

Link to comment
Share on other sites

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 by DavidSJohnston
Link to comment
Share on other sites

@@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 by greasemonkey
Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...