Only 1 Item/product In Basket

hello all,

I'd like the customer to only be able to add 1 product to the basket. I've managed to set the maximum quantity 1. however, after that 1 product is added to the basket, customer should not be able to add another.



Is this possible?

Please open the app\controllers\frontend\checkout.php file and add



if (!empty($cart['products'])) {
fn_set_notification('W', __('warning'), __('max_products_warning_lang_var'));
if (defined('AJAX_REQUEST')) {
exit;
} else {
return array(CONTROLLER_STATUS_REDIRECT, $_REQUEST['return_url']);
}
}




before this line:



// Add to cart button was pressed for single product on advanced list

Brilliant…that works…however, the following message comes up:



Warning_max_products_warning_lang_var



is there a way to change that into something more reader friendly?

You can create a language var max_products_warning_lang_var and fill in any content.

Super, thanks for that…learnt something new today.

Please add your custom notification text on the Administration → Languages → Translations → + page

Thank you :-)

Hi,

Can you help me with this :

At this point (cs-cart 4.3.x), you can choose how many items add to cart wish, if the number of items in stock is lower, an warning message appears. I wish the customers not be able to choose from (+) than the maximum of items in stock, if they choose, for example 4 and there are only 3 items in stock, an warning message appears "Only {3} items in stock".

It is possible?

Can you help me with this :

At this point (cs-cart 4.3.x), you can choose how many products add to cart wish, if the number of items in stock is lower, an warning message appears. I wish the customers not be able to choose from (+) than the maximum of products in stock, if they choose, for example 4 and there are only 3 items in stock, an warning message appears "Only {3} products in stock".

As for wishlist, we can offer you the following:

app\addons\wishlist\controllers\frontend\wishlist.php

replace:

$wishlist['products'][$_id]['amount'] = $data['amount'];

with:

$wishlist['products'][$_id]['amount'] = fn_check_amount_in_stock($product_id, $data['amount'], $data['product_options'], $_id, $data['is_edp'], 0, $cart, 0);

If you need another functionality, additional code modifications will be required

Hi,

Thanks for quick answer, i don't need for wishlist, i need for quantity and add to cart.

Unfortunately additional code modifications are required to implement such a feature.

Ok, thank you!