Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

insert "add quantity" column to product listing


EternalOne

Recommended Posts

Posted
Actually, it takes me to the index page.
Two fixes:

 

1. admin > Configuration > My Store > Display Cart After Adding Product, set to true.

 

2. Adjust the code to include cPath among the parameters, something like adding

. 'cPath=' . $cPath

to the parameter list in the tep_href_link call.

 

Hth,

Matt

Posted

ok, so, which method actually works, i tried to take some code from b2b suite to get this to work, i got the box, but i cant figure out how to get it to add stuff to the cart, maybe do we need to modify code somewhere else??

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

 

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

Posted

ok, maybe it woul help with some code, hehehe,

ok now just taking code from the b2bsuite, this is what they seem to be using but im not sure how i would use it,

in product listing.php,

 

$form = tep_draw_form ('cart_quantity', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_product', 'NONSSL'),'post','');
     $buy_now_button = tep_image_submit('button_buy_now.gif', IMAGE_BUTTON_IN_CART);
     $submit_product_quant = '<input type="text" name="cart_quantity" value="0" maxlength="4" size="4">';
     $hidden = tep_draw_hidden_field ('products_id', $listing['products_id'],'');
     $endform = '</form>';

 

and in application top.php

 

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+($HTTP_POST_VARS['cart_quantity']), $HTTP_POST_VARS['id']);

 

now i tried that but, all that it displayed on product listing is the price, so i took some code from in here and tried some stuff, and currently this is what i have

 

in product listing.php i have

$lc_text = '<input type="text" name="cart_quantity" value="1" maxlength="2" size="2"><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> ';

 

and in applicationtop.php

i tried using the same code as the b2b method

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+($HTTP_POST_VARS['cart_quantity']), $HTTP_POST_VARS['id']);

 

now, this time sure i get the form to show up, but i cant figure out how to have the information sent from the form and added to the cart, because all that does is add 1 nomatter what is put in the cart,

 

I also tried the first method sugested in this forum, but it just wipes the cart and returns to the main index page, which really isnt any good,

 

So can someone tell me what im doing wrong, cause i cant figure out how to do this, and i need to do it because i would like to make my shop live in a week or so,

 

Please let me know what to do,

 

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

Posted

yeh, that would be good if u could do that,

 

I been trying to get it but i cant do it, hehehe

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

 

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

Posted

Yeh anytime you want to post that code would be good.

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

 

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

  • 4 weeks later...
Posted
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!

with reference to this code posted a little while ago, i have tried it and it nearly works - with a little help maybe it will work!

 

in product_listing.php i have my buy now button as:

 

'<input type="text" name="quantity" value="1" maxlength="2" size="2"><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> '

 

and in application_top.php i have found this line

 

($HTTP_GET_VARS['products_id'])+1)

 

which determines how many of a product is added to the cart. if i change it to +2 it adds two etc. HOWEVER if i change it to +$quantity it adds nothing - why is that? i note that the code quoted in the original post is very slightly different and wonder if this is something to do with the fact that i am using ms 2.2 - maybe an expert could help!

 

steve

Archived

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

×
×
  • Create New...