Jump to content

Archived

This topic is now archived and is closed to further replies.

EternalOne

insert "add quantity" column to product listing

Recommended Posts

is there a contribution or way to put an "add quantity" column in the product listing pages. like something so customers can type in for more than one of the same item. its already on the shopping cart page, but i wanted something thats always on the product listing pages. i've tried looking through the forums but i always get results that have nothing to do with what im looking for.

Share this post


Link to post
Share on other sites
Guest

Search for the contributions "easy way add Qty box" and/or "Add Multiple Products"...should point you in the right direction

 

-J

Share this post


Link to post
Share on other sites

Thanks, I was looking for the same thing; that link really helped.

 

Now, does anybody know how I would add that next to the "buy now" column in the index.php listing of products? This would help a ton.

Share this post


Link to post
Share on other sites
Guest

On the product listing pages, you would have to either add a form to each row or find a way to catch all the quantity boxes. Note: the recently released Master Products contribution does something like this. Maybe it might fit your needs, or you could steal code from it for your purposes.

 

Hth,

Matt

Share this post


Link to post
Share on other sites

I tried adding a form to each row, but I can't figure it out. I've looked at master products, and it's not going to work for me.

 

I'm really rather stuck, which is bad because my customer REALLY wants this feature one their site.

Share this post


Link to post
Share on other sites
Guest
I tried adding a form to each row, but I can't figure it out.

Take another look at how its done in Master Products - there is only one form which covers all the rows - the file is includes/modules/master_listing.php... or, look at one of the 'multiple' contributions (product_listing.php).

 

Matti

Share this post


Link to post
Share on other sites
Guest

Do you mean like this?

 

Link

 

It does not have a buy now button next to each row, but rather a single add to cart button below the list. It is just this contribution http://www.oscommerce.com/community/contributions,1129

 

 

With the file modified a bit to add the images and align the rows a bit better if you do not use attributes. I posted my file here:

http://forums.oscommerce.com/index.php?showtopic=39875&st=30

Share this post


Link to post
Share on other sites

Does this work with Ms2??


Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Share this post


Link to post
Share on other sites

ok, does someone know how to do it individually, not for the whole list, and have it working with ms2,

 

please let me know

 

 

thanks


Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Share this post


Link to post
Share on other sites
Guest

To make it so that your quantities only work one row at a time, change (around lines 131-4 of includes/modules/product_listing.php)

          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;

to

          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']), 'GET') . tep_draw_input_field('quantity', '1') . tep_image_submit('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</form> ';
           break;

and around line 367 of includes/application_top.php, change

                                  $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);

to

                                  $cart->add_cart($HTTP_GET_VARS['products_id'], ((isset($HTTP_GET_VARS['quantity'])) ? $HTTP_GET_VARS['quantity']) : $cart->get_quantity($HTTP_GET_VARS['products_id']) + 1));

Note: first, this code replaces the quantity in the cart with the one that is picked (i.e. if you have 3 in the cart and select 2 here, you will have 2 in the cart, not 5); second, I'm not sure that there is any real gain doing it this way over a method that handles all the rows (except that it is simpler to write) and there is a loss. Under this method, if someone changes quantities in a row but clicks the buy_now button in a different row, the quantity change in that row will be lost. Some customers will probably find that confusing.

 

Hth,

Matt

Share this post


Link to post
Share on other sites

so, is that all i need to add, no contributions or anything,

because i put that in and the product listing doesnt even show up, i just get a blank screen,


Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Share this post


Link to post
Share on other sites

i think it has something to do with the code for the application_top, if i dotn change that the quantitybox shows up, just what would be wrong with the code in application top?????


Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Share this post


Link to post
Share on other sites
Guest

Looks like the () were wrong, try

                                 $cart->add_cart($HTTP_GET_VARS['products_id'], ((isset($HTTP_GET_VARS['quantity'])) ? $HTTP_GET_VARS['quantity'] : ($cart->get_quantity($HTTP_GET_VARS['products_id']) + 1));

Hth,

Matt

Share this post


Link to post
Share on other sites

nup, still no luck,


Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Share this post


Link to post
Share on other sites
Guest
                                $cart->add_cart($HTTP_GET_VARS['products_id'], ((isset($HTTP_GET_VARS['quantity'])) ? $HTTP_GET_VARS['quantity'] : ($cart->get_quantity($HTTP_GET_VARS['products_id']) + 1)));

Share this post


Link to post
Share on other sites

ok, i havent tried that, i installed b2bsuite and its good, because it had this option,


Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Share this post


Link to post
Share on other sites

ok, because b2bsutie does not properly work i went back to this method, but when i click buy now, it doesnt add anything to the cart, the page just refreshes to the index.php page.

whats going on??


Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Share this post


Link to post
Share on other sites

easy way add Qty box in your product_info.php

1. copy this code near your in_cart button in product_info.php, actually you can add this code anywhere.

 

---------------------------------------------

<input type="text" name="quantity" value="1" maxlength="2" size="2">

--------------------------------------------

 

2. search your application_top.php

 

find this code:

---------------------------------------------

$HTTP_POST_VARS['id']))+1

--------------------------------------------

replace with this one

------------------------------------------

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

------------------------------------------

 

done!

Share this post


Link to post
Share on other sites

i did that, but it only adds one item to the cart what am i doing wrong, can u give me an example of hwere to put this code?

 

Thanks

 

kristofor


Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Share this post


Link to post
Share on other sites
Guest
ok, because b2bsutie does not properly work i went back to this method, but when i click buy now, it doesnt add anything to the cart, the page just refreshes to the index.php page.

whats going on??

It looks like you are missing the 'GET' parameter from the tep_draw_form call. It's doing a form post instead, which doesn't match the other code.

 

Hth,

Matt

Share this post


Link to post
Share on other sites

ok so what do i do then??


Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Share this post


Link to post
Share on other sites

Thanks, Matt. You're awesome.

 

I've got this running on my site. Unfortunately, there are two bugs:

The quantity field is too big (easily fixable, I'm sure)

 

The buy now button takes me to the login page (a much bigger problem)

 

It's up at www.scrapbookersparadise.com/catalog/

 

Any ideas what's wrong?

Share this post


Link to post
Share on other sites

×