Hello,
Please, I need your help.
How to set the maximum number of products in cart
I need to set up the maximum number of ordered products in a cart in a way which is similar to the setting option for the products themselves: Maximum order quantity:
Thank you for your response.
This is my solution to the problem:
Edit the function “fn_add_product_to_cart()” in the “fn.cart.php” file, line number 2041
This formule should be written before the function :
if ( $cart[‘amount’] == 1 && $cart[‘amount’] >= 1 ){
fn_set_notification(‘W’, fn_get_lang_var(‘notice’), fn_get_lang_var(‘incorrect_max_amount_notice’));
return false;
}
" lang_var: incorrect_max_amount_notice " is your own definition.
The result is that only one product item (one product item maximum) can be added to the cart.
Peter
Thank you for posting your solution. It may be helpful to others.
[quote]
if ( $cart[‘amount’] == 1 && $cart[‘amount’] >= 1 ){
[/quote]
this llne will fail for any amount > 1. I think you want this to be:
if( $cart[‘amount’] > 1 ) {
You are specifying that the amount must be EQUAL to 1 AND that it is GREATER THAN OR EQUAL to 1. Can’t be both at the same time unless amount == 1.