Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add quantity to the product listing


dacystorm

Recommended Posts

Posted

So i need to put quantitybox to the product listing-page (not to the product page), i got these codes but they don't work, they are meant for 2.3.1 version, i have 2.3.3.

 

I got the codes in place, but when i set the quantity and click add, nothing happens, no errors no nothing, i can see it tries to do something and finished, but no products are added to the basket. Can someone help me with this one? Help is much appreciated, maybe even a gift through paypal (if needed).

 

Here are the codes:

 

product_listing.php near line 200 :

 

case 'PRODUCT_LIST_BUY_NOW':

$prod_list_contents .= ' <td align="center">' . tep_draw_form('buy_now', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id='. $listing[$x]['products_id']), 'POST') . '<input type="text" name="cart_quantity" value="1" maxlength="2" size="2">' . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary') . '</form></td>';

break;

 

 

application_top.php near line 380 :

 

case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) {

if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {

tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));

} else {

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

 

 

 

Original codes are here:

 

product_listing.php:

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')) . 'action=buy_now&products_id=' . $listing['products_id'])) . '</td>';

break;

}

 

applications_top.php:

 

case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) {

if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {

tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));

} else {

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

}

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

Posted

@@dacystorm

 

There is no difference between the product_listing.php files in 2.3.1 and 2.3.3 so if it worked with 2.3.1, it should work with 2.3.3

 

 

 

Chris

Posted

product_listing.php:

 

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'right';

$lc_text = 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=2 maxlength=2') . '</td><td align="center" width="75%" valign="absmiddle">' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'align=absmiddle') . '</td></tr></table></form>';

break;

}

 

***********************************

 

application_top.php

 

// performed by the 'buy now' button in product listings and review page

case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) {

if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {

tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));

} else {

//modification by Alexander Dimelow (www.web-project.co.uk)

if($HTTP_POST_VARS['buyqty']=="") {

$quantity = 1;

}else{

$quantity = $HTTP_POST_VARS['buyqty'];

}

//end of modification by Alexander Dimelow (www.web-project.co.uk)

 

 

This is for osCommerce Online Merchant v2.2 RC2a but except for the Html should work for 2.3

example...

 

http://www.corfusupplies.com/still-water-c-39_40_113.html

 

just have to tweak the html a bit example

tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART,

To improve is to change; to be perfect is to change often.

 

Posted

product_listing.php:

 

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'right';

$lc_text = 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=2 maxlength=2') . '</td><td align="center" width="75%" valign="absmiddle">' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'align=absmiddle') . '</td></tr></table></form>';

break;

}

 

***********************************

 

application_top.php

 

// performed by the 'buy now' button in product listings and review page

case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) {

if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {

tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));

} else {

//modification by Alexander Dimelow (www.web-project.co.uk)

if($HTTP_POST_VARS['buyqty']=="") {

$quantity = 1;

}else{

$quantity = $HTTP_POST_VARS['buyqty'];

}

//end of modification by Alexander Dimelow (www.web-project.co.uk)

 

 

This is for osCommerce Online Merchant v2.2 RC2a but except for the Html should work for 2.3

example...

 

http://www.corfusupplies.com/still-water-c-39_40_113.html

 

just have to tweak the html a bit example

tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART,

 

I got the code inserted into the php-files, but now there is no quantitybox or submit-button on the page.

 

Here are the current codes:

 

application_top.php http://setit.fi/osc/application_top.txt

product_listing.php http://setit.fi/osc/product_listing.txt

 

Screenshot of the listing: http://setit.fi/osc/screenshot.jpg

Archived

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

×
×
  • Create New...