Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product listing select quantity


Czymborjeff@gmail.com

Recommended Posts

Posted

I wan't something like this

 

Yb6EAP4.png

 

I found it off a different oscommerce site

 

wan't it in product listing were it shows all the products in that category

 

 

Not sure what files to edit. might be able to figure out what to do though

Posted

catalog/includes/modules/product_listing.php

 

few addons do a search for quantity product listing

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

 

Posted

Okay having an issue here

find:

 

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;

}

 

 

 

replace with:

 

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'center';

$lc_text = '<form name="cart_quantity" method="post" action="' . tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product', 'NONSSL'). '"><input type="hidden" name="products_id" value="' . $listing['products_id'] . '"><input type="text" name="quantity" value="1" maxlength="5" size="5"><br>' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</form>';

break;

}

 

this is closest thing i can find

 

case 'PRODUCT_LIST_BUY_NOW':

$lc_text = TABLE_HEADING_BUY_NOW;

$lc_align = 'center';

break;

 

and for this

 

find:

 

$HTTP_POST_VARS['id']))+1

 

 

replace with:

 

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

 

 

I cannot find anything for this I'm guessing its 1 of these?

 

switch ($HTTP_GET_VARS['action']) {

// customer wants to update the product quantity in their shopping cart

case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {

if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {

$cart->remove($HTTP_POST_VARS['products_id'][$i]);

} else {

$attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';

$cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);

}

}

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

break;

// customer adds a product from the products page

case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

$attributes = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : '';

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

}

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

break;

Posted

Got it, thanks

 

is it possible to make it have a quantity box though were it drops down you select # instead?

 

*****
In /includes/application_top.php
*****

change from;
  // 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 {
							  $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;

to ----->
// 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)
$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+$quantity);
						    }
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;

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

Archived

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

×
×
  • Create New...