Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Limit Quantity of Each Product Ordered


Guest

Recommended Posts

Hi!

 

I am currently modifying the osCommerce catalog to purchase videos via DIVX download. I am running into an issue where I need to limit the shopping cart in such a way that a user can only add 1 of each product (never 2), but could still have 2 or 3 products.

 

I implemented a solution that let's only 1 product be in the cart (courtesy of Linda) by adding a case statement to the application_top.php file:

 

   case ($cart->count_contents()>0): 

              // don't do anything 

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

        break;

 

Does anybody have any ideas? I've been racking my brain on this one and can't seem to figure it out.

 

Thanks,

Zac

Link to comment
Share on other sites

Make the add to cart and update cart both replace qty with 1 and remove the quantity field from the shopping cart.

 

Look in /includes/application_top.php under

 

// Shopping cart actions

 

... for starters

Link to comment
Share on other sites

  • 3 months later...

I tried to do that so I in application_top.php I changed:

 

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

 

into

//Cart Quantity always 1

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

 

So that works, the quantity is now always one.

But I cannot figure out what to do to make the textbox where you enter the quantity disappear.????

 

Maurice

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...