1
votes

Our company sells pharmaceuticals online and by law we are limited to how much of a particular drug a customer can purchase. For singular products with one brand this is easily controllable through default Magento functionality, my problem arises when we have different brands of a particular drug. In a nutshell I can currently limit a customer to 1 pack of paracetamol from brand A but there is nothing to stop them getting another pack from brand B at the same time.

I would like to be able to check the cart for products with a particular attribute and limit them to 1 per cart. Ideally this would be when the customer clicks add to cart and the message would be displayed via the default Magento alerts that we currently have.

EDIT: I think the easiest way to solve this would be to check the SKU codes currently in the basket when adding a product to the cart. If there is a match, Throw up an error else add the item to the cart.

2

2 Answers

0
votes

I think this link will help you but you need to modify as per your requirement. http://ceckoslab.com/magento/magento-check-if-product-is-in-cart/..

This link is to check the cart whether the same product is added or not? So modify this as per you requirement

0
votes

You can set maximum allowed quantity in cart from admin panel. System->configuration. From left tab see catalog->inventory. Set Maximum qty allowed in shopping cart to 1.

If you want to add check on whole cart. see this paid extension