Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding quantity box to products new


tormo3

Recommended Posts

Hi all!

 

I have added product quantity box in "products new". But I have a problem with this box. When I click on the button "Add to cart" - in the shopping cart does not add anything - is written "Your shopping cart is empty".

 

here is php code from products_new.php

<!-- Added quantity box -->
           <?php echo 
		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"><tr align="right"><td>' . tep_draw_input_field('buyqty1', '1', 'size=2 maxlength=2') . '</td>
		<td>' . 
 tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART)
		. '	</tr></table></form>';
          ?>
	 <!-- EOF Added quantity box -->

 

here is php code from application_top.php


       // 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'])) {
                               $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+(int)$HTTP_POST_VARS['buyqty1'], $HTTP_POST_VARS['id']);
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;
     // 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'])+(int)$HTTP_POST_VARS['buyqty']);
                               }
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;

 

Where is mistake?

 

P.S. in "product listing" and "product info page" all is working good.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...